geometry
draw
create a two-dimensional plot of objects supported in the geometry package
Calling Sequence
Parameters
Description
Examples
draw(obj,...)
draw([obj_1,...,obj_n],...)
obj
-
object to be plotted
[obj_1, ..., obj_n]
list of object(s) to be plotted
The routine draw provides the graphical visualization of all objects supported in the geometry package that have definite coordinates.
A typical call to the draw function is draw([ obj_1( localopts_1 ), ..., obj_n( localopts_n )], globalopts) where obj_1, ..., obj_n are geometric objects, localopts_1, ..., localopts_n are local options for a particular object, and globalopts are options which apply to all of the objects.
localopts_i is a sequence of type equation. The set of options allowed for localopts_i is color, legend, linestyle, numpoints, style, symbol, symbolsize, thickness, printtext, filled, transparency. Options legend, filled, and numpoints can only be provided as local options.
The printtext option, when set to true, allows the "text" to be printed out; e.g., when a triangle is drawn, the names of its vertices will also be printed. The default mode is false.
The filled option applies to closed curves (i.e., triangles, squares, circles, and ellipses). When using this option, it is important to note that the order in which the objects are given is important, as the first object in the call to draw is drawn on top of the other objects. For example, if you wanted to plot two filled circles (e.g., a small circle contained inside of a larger circle), then you would make the small circle the first object, and the large circle as the second object. Reversing the order of the objects would "hide" the small circle.
For detailed descriptions of other options, see plot/options.
globalopts: the set of options allowed for globalopts is the same as that for plot except for the adaptive and sample options. See plot/options for detailed descriptions of each option.
Note that the localopts_i that are defined for an object have precedence over globalopts when obj_i is drawn.
An example for the following theorem. These are the commands to create the plot from the Plotting Guide.
Theorem: The orthocenter H, the circumcenter OO, and the centroid G of a triangle A1A2A3 are collinear and HG = 2*GOO.
with⁡geometry:
Define triangle T
triangle⁡T,point⁡A2,0,0,point⁡A1,2,4,point⁡A3,7,0:
Find the circumcircle of A1A2A3
circumcircle⁡C,T,centername=OO:
Find the altitudes of T
altitude⁡A2A22,A2,T,A22:
altitude⁡A3A33,A3,T,A33:
altitude⁡A1A11,A1,T,A11:
Find the orthocenter and centroid of T
orthocenter⁡H,T:centroid⁡G,T:
Find the medians of T
median⁡A1M1,A1,T,M1:
median⁡A2M2,A2,T,M2:
median⁡A3M3,A3,T,M3:
dsegment⁡dsg1,OO,H:dsegment⁡dsg2,H,G:
dsegment⁡OM1,OO,M1:dsegment⁡OM2,OO,M2:
dsegment⁡OM3,OO,M3:
triangle⁡T1,M1,M2,M3:
Check if H, OO, G are concurrent
AreCollinear⁡OO,H,G
true
Test if the distance between H and G is twice the distance between G and OO
simplify⁡distance⁡H,G−2⁢distance⁡G,OO
0
draw⁡C⁡color=COLOR⁡RGB,1.00000000,1.00000000,0.8000000000,filled=true,T⁡color=blue,T1,A3M3,A2M2,A1M1,A2A22,A3A33,A1A11,dsg1⁡style=line,color=green,thickness=3,dsg2⁡thickness=3,color=green,OM1,OM2,OM3,axes=none,printtext=true
An example of translation, rotation, and dilatation of circles
Angle≔table⁡:
n≔8:
foritondoAnglei≔2⁢π⁢inenddo:dsegment⁡dseg,point⁡A,0,0,point⁡B,4,0:point⁡o,0,0:circle⁡c,o,1:homothety⁡c1,c,32,point⁡M,−1,0:homothety⁡c2,c,2,point⁡M,−1,0:homothety⁡c3,c,52,point⁡M,−1,0:translation⁡t,c,dseg:translation⁡tt,c1,dseg:translation⁡ttt,c2,dseg:translation⁡tttt,c3,dseg:forito8dorotation⁡t‖i,t,Anglei,counterclockwise,o;rotation⁡tt‖i,tt,Anglei,counterclockwise,o;rotation⁡ttt‖i,ttt,Anglei,counterclockwise,o;rotation⁡tttt‖i,tttt,Anglei,counterclockwise,oenddo:draw⁡seq⁡op⁡t‖i⁡color=red,tt‖i⁡color=green,ttt‖i⁡color=blue,tttt‖i⁡color=plum,i=1..n,printtext=false,filled=true,axes=none,title=An example of translation, rotation, and dilatation of a circle
See Also
geometry/objects
geometry/transformation
Download Help Document