Difference between revisions of "Asymptote: Filling"

(Created page with 'As explained above, you can create closed objects such as: <tt>draw(origin--(5,0)--(3,4)--cycle);</tt> <asy> draw(origin--(5,0)--(3,4)--cycle); </asy> Now introducing the [b]f…')
 
Line 1: Line 1:
As explained above, you can create closed objects such as:
+
As explained in [[Asymptote: Drawing]], you can create closed objects such as:
  
 
<tt>draw(origin--(5,0)--(3,4)--cycle);</tt>
 
<tt>draw(origin--(5,0)--(3,4)--cycle);</tt>

Revision as of 17:02, 16 July 2009

As explained in Asymptote: Drawing, you can create closed objects such as:

draw(origin--(5,0)--(3,4)--cycle);

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

Now introducing the [b]fill()[/b] command. You would fill this triangle with green by the following:

fill(origin--(5,0)--(3,4)--cycle, green);

[asy] fill(origin--(5,0)--(3,4)--cycle, green); [/asy]

Note how there is no outline. To create an outline and fill, without making two different statements, use the filldraw() command. Like the order of filldraw, you put the color of the fill before the draw.

filldraw(origin--(5,0)--(3,4)--cycle, green, red+linewidth(1));

[asy] filldraw(origin--(5,0)--(3,4)--cycle, green, red+linewidth(1)); [/asy]