Difference between revisions of "Asymptote: Marking Angles"

m
(Added rightanglemark command)
 
(One intermediate revision by one other user not shown)
Line 23: Line 23:
 
draw(anglemark((5,0),(0,0),(3,4)));
 
draw(anglemark((5,0),(0,0),(3,4)));
 
</nowiki></pre>
 
</nowiki></pre>
 
+
What we are doing with the draw(anglemark((a,b),(c,d),(e,f))) command is the code to mark the angle that has ends at (a,b) and (e,f) and a vertex at (c,d).
 
<asy>
 
<asy>
 
import olympiad;
 
import olympiad;
Line 50: Line 50:
 
draw(anglemark((5,0),(0,0),(3,4)));
 
draw(anglemark((5,0),(0,0),(3,4)));
 
</asy>
 
</asy>
 +
The larger the scale factor, the bigger the angle mark is.  Note: On some images, you might not be able to see the angle mark unless you set it to a large scale factor.
  
We can add properties to this:
+
We can add properties to this mark:
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 85: Line 86:
 
markscalefactor=0.1;
 
markscalefactor=0.1;
 
filldraw(anglemark((5,0),(0,0),(3,4)),green,red+linewidth(1));
 
filldraw(anglemark((5,0),(0,0),(3,4)),green,red+linewidth(1));
 +
</asy>
 +
There also exists a command called rightanglemark to create a right angle.
 +
<pre><nowiki>
 +
import olympiad;
 +
draw((0,0)--(0,4),EndArrow);
 +
draw((0,0)--(5,0),EndArrow);
 +
draw(rightanglemark((5,0),(0,0),(0,4)));
 +
</nowiki></pre>
 +
<asy>
 +
import olympiad;
 +
draw((0,0)--(0,4),EndArrow);
 +
draw((0,0)--(5,0),EndArrow);
 +
draw(rightanglemark((5,0),(0,0),(0,4)));
 
</asy>
 
</asy>

Latest revision as of 00:23, 6 March 2019

Asymptote (Vector Graphics Language)
Getting Started - Basics - Drawing - Labeling - Filling - Useful functions - Examples - Macros and Packages

Help - Reference - Advanced Asymptote - 3D Graphics - CSE5 Package - How to

You can use the olympiad package to create nice marks for the angles.

Let's look at this angle.

draw((0,0)--(3,4),EndArrow);
draw((0,0)--(5,0),EndArrow);

[asy] draw((0,0)--(3,4),EndArrow); draw((0,0)--(5,0),EndArrow); [/asy]

Now we mark this angle:

import olympiad;
draw((0,0)--(3,4),EndArrow);
draw((0,0)--(5,0),EndArrow);
draw(anglemark((5,0),(0,0),(3,4)));

What we are doing with the draw(anglemark((a,b),(c,d),(e,f))) command is the code to mark the angle that has ends at (a,b) and (e,f) and a vertex at (c,d). [asy] import olympiad; draw((0,0)--(3,4),EndArrow); draw((0,0)--(5,0),EndArrow); draw(anglemark((5,0),(0,0),(3,4))); [/asy]

(The import olympiad code is not required on the forums, but you need to use it on your home computer).

This angle is too small, so we change the scale factor:

import olympiad;
draw((0,0)--(3,4),EndArrow);
draw((0,0)--(5,0),EndArrow);
markscalefactor=0.1;
draw(anglemark((5,0),(0,0),(3,4)));

[asy] import olympiad; draw((0,0)--(3,4),EndArrow); draw((0,0)--(5,0),EndArrow); markscalefactor=0.1; draw(anglemark((5,0),(0,0),(3,4))); [/asy] The larger the scale factor, the bigger the angle mark is. Note: On some images, you might not be able to see the angle mark unless you set it to a large scale factor.

We can add properties to this mark:

import olympiad;
draw((0,0)--(3,4),EndArrow);
draw((0,0)--(5,0),EndArrow);
markscalefactor=0.1;
draw(anglemark((5,0),(0,0),(3,4)),red);

[asy] import olympiad; draw((0,0)--(3,4),EndArrow); draw((0,0)--(5,0),EndArrow); markscalefactor=0.1; draw(anglemark((5,0),(0,0),(3,4)),red); [/asy]

We can get fancy with this:

import olympiad;
draw((0,0)--(3,4),EndArrow);
draw((0,0)--(5,0),EndArrow);
markscalefactor=0.1;
filldraw(anglemark((5,0),(0,0),(3,4)),green,red+linewidth(1));

[asy] import olympiad; draw((0,0)--(3,4),EndArrow); draw((0,0)--(5,0),EndArrow); markscalefactor=0.1; filldraw(anglemark((5,0),(0,0),(3,4)),green,red+linewidth(1)); [/asy] There also exists a command called rightanglemark to create a right angle.

import olympiad;
draw((0,0)--(0,4),EndArrow);
draw((0,0)--(5,0),EndArrow);
draw(rightanglemark((5,0),(0,0),(0,4)));

[asy] import olympiad; draw((0,0)--(0,4),EndArrow); draw((0,0)--(5,0),EndArrow); draw(rightanglemark((5,0),(0,0),(0,4))); [/asy]