Difference between revisions of "Asymptote: Useful functions"
(Fix prototype syntax.) |
(→Intersection points) |
||
Line 41: | Line 41: | ||
dot(x[1],3bp+blue); | dot(x[1],3bp+blue); | ||
draw(x[0] -- x[1],1bp+red);</asy> | draw(x[0] -- x[1],1bp+red);</asy> | ||
+ | Note that this function will cause an error if the paths involved do not intersect. | ||
<!-- | <!-- |
Revision as of 13:56, 2 September 2011
Intersection points
pair[] intersectionpoints(path, path);
Example:
size(8cm,0); import math; import graph; real r,s; pair a,b, common; path circ1, circ2; r=1; s=1; a=(0,0); b=(1,0); circ1=circle(a,r); circ2=circle(b,s); draw(circ1,linewidth(1bp)); draw(circ2,1bp+green); pair [] x=intersectionpoints(circ1, circ2); dot(x[0],3bp+blue); dot(x[1],3bp+blue); draw(x[0] -- x[1],1bp+red);
Note that this function will cause an error if the paths involved do not intersect.