1

I would like to make a picture to Brianchon's theorem. To make my code more simple, would like to use an array instead of producing point, by point and line by line. Is it possible to take in one cycle calling the points as an array.

Thank you for your help. Here is my code:

settings.outformat="pdf";

import geometry;        
size(11cm,0);

conic c2=conic(bqe(1,0,2,2,0,-5));
draw(c2,blue+2bp);

pair F1=(-1-sqrt(3.5),0);
pair F2=(-1+sqrt(3.5),0);

pair p1=point(c2,Relative(0.8));
pair p2=point(c2,Relative(0.6));
pair p3=point(c2,Relative(0.4));
pair p4=point(c2,Relative(0.3));
pair p5=point(c2,Relative(0.1));
pair p6=point(c2,Relative(0.95));

dot("$A$",p1,N);
dot("$B$",p2,NE);
dot("$C$",p3,SE);
dot("$D$",p4,S);
dot("$E$",p5,SW);
dot("$F$",p6,W);

//tangents in the points of ellipse
pair Mn1=p1+dir(p1--F1,p1--F2); 
pair Mt1=rotate(90,p1)*Mn1;
path t1= interp(p1,Mt1,-2)--interp(p1,Mt1,2);
draw(t1);

pair Mn2=p2+dir(p2--F2,p2--F1); 
pair Mt2=rotate(90,p2)*Mn2;
path t2= interp(p2,Mt2,-2)--interp(p2,Mt2,2);
draw(t2);

pair Mn3=p3+dir(p3--F1,p3--F2); 
pair Mt3=rotate(90,p3)*Mn3;
path t3= interp(p3,Mt3,-2)--interp(p3,Mt3,2);
draw(t3);

pair Mn4=p4+dir(p4--F1,p4--F2); 
pair Mt4=rotate(90,p4)*Mn4;
path t4= interp(p4,Mt4,-2)--interp(p4,Mt4,2);
draw(t4);

pair Mn5=p5+dir(p5--F1,p5--F2); 
pair Mt5=rotate(90,p5)*Mn5;
path t5= interp(p5,Mt5,-2)--interp(p5,Mt5,2);
draw(t5);

pair Mn6=p6+dir(p6--F1,p6--F2); 
pair Mt6=rotate(90,p6)*Mn6;
path t6= interp(p6,Mt6,-2)--interp(p6,Mt6,2);
draw(t6);
     
pair P1 = intersectionpoint(t1,t2);     
pair P2 = intersectionpoint(t2,t3);     
pair P3 = intersectionpoint(t3,t4);     
pair P4 = intersectionpoint(t4,t5);     
pair P5 = intersectionpoint(t5,t6);     
pair P6 = intersectionpoint(t1,t6);     

draw(line(P1,P4),dashed);
draw(line(P2,P5),dashed);
draw(line(P3,P6),dashed); 
 
dot(intersectionpoint(P1--P4,P2--P5),blue+1bp,Fill(red));

shipout(bbox(5mm,invisible));
4
  • Only wanna to tell to you to replace: conic c2=conic(bqe(1,0,2,2,0,-5)); by ellipse c2=(ellipse) conic(bqe(1,0,2,2,0,-5)); ; (-1-sqrt(3.5),0) by (pair) c2.F1 ; (-1+sqrt(3.5),0) by (pair) c2.F2. Oct 15 at 12:44
  • To make my code more simple, it can be seen as your homework about array! Is it possible to take in one cycle calling the points as an array: Yes, certainly. Oct 15 at 12:55
  • for your first block of points: pair[] points = new pair[]; for (real t : new real[] {0.8, 0.6, 0.4, 0.3, 0.1, 0.95}) { points.push(point(c2,Relative(t))); } Oct 15 at 20:25
  • wow, thank you a lot to both of you! that's really look pretty. I'm very sorry for so silly, easy questions for you. @CharlesStaats thank you, helping with the start. The similar is possible with the path segment, gonna try
    – ewa
    Oct 16 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.