morley_demo.cas 2.75 KB
find_equi():={
local a1,a2,A,Anum,B,Bnum,C0,C,Cnum,P1,P1num,P2,P2num,P3,P3num,P4,P5,j,k,q,r,s,tmp,cpt,trequi;
assume(a1=0.2); // a1:=0.2;
assume(a2=0.4); // a2:=0.4;
A:=[0,1+i*texpand(tan(a1)),1+i*texpand(tan(2*a1)),1+i*texpand(tan(pi/3+a1)),
1+i*texpand(tan(2*a1+2*pi/3)),1+i*texpand(tan(a1+2*pi/3)),
1+i*texpand(tan(pi/3+2*a1))];
Anum:=evalf(A);
B:=[1,i*texpand(tan(2*a2)),i*texpand(tan(a2)),i*texpand(tan(2*a2+2*pi/3)),
i*texpand(tan(a2+pi/3)),i*texpand(tan(pi/3+2*a2)),i*texpand(tan(2*pi/3+a2))];
Bnum:=evalf(B);
C0:=texpand(tan(a2*3)/(tan(a1*3)+tan(a2*3))*(1+i*tan(a1*3)));
C:=[C0,C0+1+i*texpand(tan(pi/3+2*a1-a2)),C0+1+i*texpand(tan(2*pi/3+a1-2*a2)),
C0+1+i*texpand(tan(2*pi/3+2*a1-a2)),C0+1+i*texpand(tan(pi/3+a1-2*a2)),
C0+1+i*texpand(tan(2*a1-a2)),C0+1+i*texpand(tan(a1-2*a2))];
Cnum:=evalf(C);
P1num:=[0$36];
P2num:=[0$36];
P3num:=[0$36];
for (q:=0;q<36;q++) {
  k:=iquo(q,6)+1;
  j:=irem(q,6)+1;
  P1num[q] =< affix(single_inter(line(Anum[0],Anum[k]),line(Bnum[0],Bnum[j])));
  P2num[q] =< affix(single_inter(line(Bnum[0],Bnum[k]),line(Cnum[0],Cnum[j])));
  P3num[q] =< affix(single_inter(line(Cnum[0],Cnum[k]),line(Anum[0],Anum[j])));
}:;

trequi:=[];
for (q:=0;q<36;q++) {
  print(q);
  P1:=0;
  for (r:=0;r<36;r++){
    P4:=affix(rotation(P1num[q],pi/3,P2num[r]));
    P5:=affix(rotation(P1num[q],-pi/3,P2num[r]));
    for (s:=0;s<36;s++){
      if (abs(distance2(P4,P3num[s]))<1e-6 ) {
        print("test equilateral",q,r,s);
        k:=iquo(q,6)+1; j:=irem(q,6)+1;
        if (P1==0) P1:=single_inter(line(A[0],A[k]),line(B[0],B[j]));
        k:=iquo(r,6)+1; j:=irem(r,6)+1;
        P2:=single_inter(line(B[0],B[k]),line(C[0],C[j]));
        k:=iquo(s,6)+1; j:=irem(s,6)+1;        
        P3:=single_inter(line(C[0],C[k]),line(A[0],A[j]));
        Ptest:=rotation(P1,pi/3,P2);
        test:=normal(Ptest-P3);
        if (test==0){
          trequi:=append(trequi,[[iquo(q,6)+1,irem(q,6)+1],[iquo(r,6)+1,irem(r,6)+1],[irem(s,6)+1,iquo(s,6)+1]]);
          print("equilateral",q,r,s,"confirme");
        }
        else print(test);
      }
      if (abs(distance2(P5,P3num[s]))<1e-6 ) {
        print("test equilateral",q,r,s);
        k:=iquo(q,6)+1; j:=irem(q,6)+1;
        if (P1==0) P1:=single_inter(line(A[0],A[k]),line(B[0],B[j]));
        k:=iquo(r,6)+1; j:=irem(r,6)+1;
        P2:=single_inter(line(B[0],B[k]),line(C[0],C[j]));
        k:=iquo(s,6)+1; j:=irem(s,6)+1;        
        P3:=single_inter(line(C[0],C[k]),line(A[0],A[j]));
        Ptest:=rotation(P1,-pi/3,P2);
        test:=normal(Ptest-P3);
        if (test==0){
          trequi:=append(trequi,[[iquo(q,6)+1,irem(q,6)+1],[iquo(r,6)+1,irem(r,6)+1],[irem(s,6)+1,iquo(s,6)+1]]);
          print("equilateral",q,r,s,"confirme");
        }
        else print(test);
      }
    }
  }
}
return trequi;
}:;
F:=find_equi([]); dim(F) ;