Difference between revisions of "Asymptote: Useful commands and their Output"
Line 31: | Line 31: | ||
'''Example 4:''' | '''Example 4:''' | ||
− | + | include math; | |
+ | pair A,B,C,D,E; | ||
+ | A=(0,0); C=(50,0); B=(10,10); D=(40,20); | ||
+ | E=extension(A,B,C,D); // extension is a command from the math package | ||
+ | // that returns the intersection of lines AB and CD | ||
+ | draw(A--B); draw(C--D); | ||
+ | draw(B--E--D,orange); | ||
+ | |||
'''Output 4:''' | '''Output 4:''' | ||
[[Image:Figure5.gif]] | [[Image:Figure5.gif]] | ||
Line 38: | Line 45: | ||
'''Example 5:''' | '''Example 5:''' | ||
− | + | include graph; | |
+ | draw(Circle((0,0),20)); | ||
'''Output 5:''' | '''Output 5:''' | ||
[[Image:Figure6.gif]] | [[Image:Figure6.gif]] | ||
− | + | ||
---- | ---- | ||
'''Example 6:''' | '''Example 6:''' | ||
+ | path p=(0,0)..(20,15)..(40,-5)..(50,0); | ||
+ | draw(p); | ||
+ | draw(rotate(90)*p,green); | ||
+ | draw(rotate(180,(-5,0))*p,orange); | ||
+ | draw(shift((5,20))*p,magenta); | ||
+ | draw(shift((0,-25))*yscale(1.4)*p,red); | ||
'''Output 6:''' | '''Output 6:''' | ||
Line 52: | Line 66: | ||
'''Example 7:''' | '''Example 7:''' | ||
+ | include olympiad; | ||
+ | pair A,B,C,O,I; | ||
+ | A=origin; B=2*right; C=1.5*dir(70); | ||
+ | O=circumcenter(A,B,C); // circumcenter is a command in the Olympiad package | ||
+ | I=incenter(A,B,C); // incenter is a command in the Olympiad package | ||
+ | draw(A--B--C--cycle); | ||
+ | dot(O); | ||
+ | dot(I); | ||
+ | draw(circumcircle(A,B,C)); | ||
+ | draw(incircle(A,B,C)); | ||
+ | label("<math>I</math>",I,W); | ||
+ | label("<math>O</math>",O,S); | ||
'''Output 7:''' | '''Output 7:''' |
Revision as of 16:09, 3 February 2007
For each of the following, we have put a blue dot at the origin in order to indicate relative location of the output on the coordinate plane. In other words, assume that before each of the examples below is the command
dot((0,0),blue);.
Example 1:
dot((20,0));
Example 2:
draw((0,0)--(50,0),BeginArrow); draw((0,-10)--(50,-10),MidArrow); draw((0,-30)--(50,-30),Arrows);
Example 3:
draw((0,0)--(50,0)); arrow((30,0),dir(180),green);
Example 4:
include math; pair A,B,C,D,E; A=(0,0); C=(50,0); B=(10,10); D=(40,20); E=extension(A,B,C,D); // extension is a command from the math package // that returns the intersection of lines AB and CD draw(A--B); draw(C--D); draw(B--E--D,orange);
Example 5:
include graph; draw(Circle((0,0),20));
Example 6:
path p=(0,0)..(20,15)..(40,-5)..(50,0); draw(p); draw(rotate(90)*p,green); draw(rotate(180,(-5,0))*p,orange); draw(shift((5,20))*p,magenta); draw(shift((0,-25))*yscale(1.4)*p,red);
Example 7:
include olympiad; pair A,B,C,O,I; A=origin; B=2*right; C=1.5*dir(70); O=circumcenter(A,B,C); // circumcenter is a command in the Olympiad package I=incenter(A,B,C); // incenter is a command in the Olympiad package draw(A--B--C--cycle); dot(O); dot(I); draw(circumcircle(A,B,C)); draw(incircle(A,B,C)); label("",I,W); label("
",O,S);
Example 8: