 geometry - Maple Programming Help

Home : Support : Online Help : Graphics : 2-D : geometry/draw

geometry

 draw
 create a two-dimensional plot of objects supported in the geometry package

 Calling Sequence draw(obj,...) draw([obj_1,...,obj_n],...)

Parameters

 obj - object to be plotted [obj_1, ..., obj_n] - list of object(s) to be plotted

Description

 • The routine draw provides the graphical visualization of all objects supported in the geometry package.
 • 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.

Examples

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.

 > $\mathrm{with}\left(\mathrm{geometry}\right):$

Define triangle T

 > $\mathrm{triangle}\left(T,\left[\mathrm{point}\left(\mathrm{A2},0,0\right),\mathrm{point}\left(\mathrm{A1},2,4\right),\mathrm{point}\left(\mathrm{A3},7,0\right)\right]\right):$

Find the circumcircle of A1A2A3

 > $\mathrm{circumcircle}\left(C,T,'\mathrm{centername}'=\mathrm{OO}\right):$

Find the altitudes of T

 > $\mathrm{altitude}\left(\mathrm{A2A22},\mathrm{A2},T,\mathrm{A22}\right):$
 > $\mathrm{altitude}\left(\mathrm{A3A33},\mathrm{A3},T,\mathrm{A33}\right):$
 > $\mathrm{altitude}\left(\mathrm{A1A11},\mathrm{A1},T,\mathrm{A11}\right):$

Find the orthocenter and centroid of T

 > $\mathrm{orthocenter}\left(H,T\right):$$\mathrm{centroid}\left(G,T\right):$

Find the medians of T

 > $\mathrm{median}\left(\mathrm{A1M1},\mathrm{A1},T,\mathrm{M1}\right):$
 > $\mathrm{median}\left(\mathrm{A2M2},\mathrm{A2},T,\mathrm{M2}\right):$
 > $\mathrm{median}\left(\mathrm{A3M3},\mathrm{A3},T,\mathrm{M3}\right):$
 > $\mathrm{dsegment}\left(\mathrm{dsg1},\mathrm{OO},H\right):$$\mathrm{dsegment}\left(\mathrm{dsg2},H,G\right):$
 > $\mathrm{dsegment}\left(\mathrm{OM1},\mathrm{OO},\mathrm{M1}\right):$$\mathrm{dsegment}\left(\mathrm{OM2},\mathrm{OO},\mathrm{M2}\right):$
 > $\mathrm{dsegment}\left(\mathrm{OM3},\mathrm{OO},\mathrm{M3}\right):$
 > $\mathrm{triangle}\left(\mathrm{T1},\left[\mathrm{M1},\mathrm{M2},\mathrm{M3}\right]\right):$

Check if H, OO, G are concurrent

 > $\mathrm{AreCollinear}\left(\mathrm{OO},H,G\right)$
 ${\mathrm{true}}$ (1)

Test if the distance between H and G is twice the distance between G and OO

 > $\mathrm{simplify}\left(\mathrm{distance}\left(H,G\right)-2\mathrm{distance}\left(G,\mathrm{OO}\right)\right)$
 ${0}$ (2)
 > $\mathrm{draw}\left(\left[C\left(\mathrm{color}='\mathrm{COLOR}'\left(\mathrm{RGB},1.00000000,1.00000000,0.8000000000\right),\mathrm{filled}=\mathrm{true}\right),T\left(\mathrm{color}=\mathrm{blue}\right),\mathrm{T1},\mathrm{A3M3},\mathrm{A2M2},\mathrm{A1M1},\mathrm{A2A22},\mathrm{A3A33},\mathrm{A1A11},\mathrm{dsg1}\left(\mathrm{style}=\mathrm{line},\mathrm{color}=\mathrm{green},\mathrm{thickness}=3\right),\mathrm{dsg2}\left(\mathrm{thickness}=3,\mathrm{color}=\mathrm{green}\right),\mathrm{OM1},\mathrm{OM2},\mathrm{OM3}\right],\mathrm{axes}=\mathrm{none},\mathrm{printtext}=\mathrm{true}\right)$ An example of translation, rotation, and dilatation of circles

 > $\mathrm{Angle}≔\mathrm{table}\left(\right):$
 > $n≔8:$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}n\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{Angle}\left[i\right]≔\frac{2\mathrm{\pi }i}{n}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$$\mathrm{dsegment}\left(\mathrm{dseg},\mathrm{point}\left(A,0,0\right),\mathrm{point}\left(B,4,0\right)\right):$$\mathrm{point}\left(o,0,0\right):$$\mathrm{circle}\left(c,\left[o,1\right]\right):$$\mathrm{homothety}\left(\mathrm{c1},c,\frac{3}{2},\mathrm{point}\left(M,-1,0\right)\right):$$\mathrm{homothety}\left(\mathrm{c2},c,2,\mathrm{point}\left(M,-1,0\right)\right):$$\mathrm{homothety}\left(\mathrm{c3},c,\frac{5}{2},\mathrm{point}\left(M,-1,0\right)\right):$$\mathrm{translation}\left(t,c,\mathrm{dseg}\right):$$\mathrm{translation}\left(\mathrm{tt},\mathrm{c1},\mathrm{dseg}\right):$$\mathrm{translation}\left(\mathrm{ttt},\mathrm{c2},\mathrm{dseg}\right):$$\mathrm{translation}\left(\mathrm{tttt},\mathrm{c3},\mathrm{dseg}\right):$$\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}8\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{rotation}\left(t‖i,t,\mathrm{Angle}\left[i\right],\mathrm{counterclockwise},o\right);\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{rotation}\left(\mathrm{tt}‖i,\mathrm{tt},\mathrm{Angle}\left[i\right],\mathrm{counterclockwise},o\right);\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{rotation}\left(\mathrm{ttt}‖i,\mathrm{ttt},\mathrm{Angle}\left[i\right],\mathrm{counterclockwise},o\right);\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{rotation}\left(\mathrm{tttt}‖i,\mathrm{tttt},\mathrm{Angle}\left[i\right],\mathrm{counterclockwise},o\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$$\mathrm{draw}\left(\left[\mathrm{seq}\left(\mathrm{op}\left(\left[t‖i\left(\mathrm{color}=\mathrm{red}\right),\mathrm{tt}‖i\left(\mathrm{color}=\mathrm{green}\right),\mathrm{ttt}‖i\left(\mathrm{color}=\mathrm{blue}\right),\mathrm{tttt}‖i\left(\mathrm{color}=\mathrm{plum}\right)\right]\right),i=1..n\right)\right],\mathrm{printtext}=\mathrm{false},\mathrm{filled}=\mathrm{true},\mathrm{axes}=\mathrm{none},\mathrm{title}="An example of translation, rotation, dilatation of a circle"\right)$ 