Node:Drawing and Filling Paths, Next:Labelling Paths, Previous:Applying Transformations to Paths, Up:Path Reference
void draw ([const Color& ddraw_color = *Colors::default_color , [const string ddashed = "", [const string ppen = "", [Picture& picture = current_picture ]]]])
|
const virtual function |
void draw (Picture& picture, [const Color& ddraw_color = *Colors::default_color, [string ddashed = "", [string ppen = ""]]]) | const Virtual function |
Allocates a copy of the Path on the free store, puts a pointer to
the copy on picture.shapes , sets
its fill_draw_value to DRAW , and
the values of its
draw_color , dashed , and pen according to the
arguments.
The second version is convenient for passing a
All of the arguments to Point A; Point B(2); Point C(3, 3); Point D(1, 2); Point E(-1, 1); Path p("..", true, &A, &B, &C, &D, &E, 0); p.draw();
The arguments:
|
void draw_help ([const Color& ddraw_color = *help_color, [string ddashed = help_dash_pattern, [string ppen = "", [Picture& picture = current_picture ]]]])
|
const function |
void draw_help (Picture& picture, [const Color& ddraw_color = *help_color , [string ddashed = help_dash_pattern , [string ppen = ""]]])
|
const function |
This functions are for drawing help lines.
They are like draw() , except that draw_help() returns immediately,
if do_help_lines (a static data member in
Path ) is false .
Also, the defaults for ddraw_color and
ddashed differ from those for draw() .
|
void drawarrow ([const Color& ddraw_color = *Colors::default_color , [string ddashed = "", [string ppen = "", [Picture& picture = current_picture ]]]])
|
const virtual function |
void drawarrow (Picture& picture, [const Color& ddraw_color = *Colors::default_color , [string ddashed = "", [string ppen = ""]]])
|
const virtual function |
Like draw() , except that the MetaPost command drawarrow is
written to out_stream when picture
is output.
The second version is convenient for passing a Picture argument
without having to specify all of the other arguments.
Point m; Point n(2, 2); m.dotlabel("$m$", "bot"); n.dotlabel("$n$"); m.drawarrow(n);
|
void draw_axes ([real dist = 2.5, [string pos_x = "bot", [string pos_y = "lft", [string pos_z = "bot", [const Color& ddraw_color = *Colors::default_color , [const string ddashed = "", [const string ppen = "", [const Point& shift_x = origin , [const Point& shift_y = origin , [const Point& shift_z = origin , [Picture& picture = current_picture ]]]]]]]]]]])
|
Non-member function |
void draw_axes (const Color& ddraw_color, [real dist = 2.5, [string pos_x = "bot", [string pos_y = "lft", [string pos_z = "bot", [const string ddashed = "", [const string ppen = "", [const Point& shift_x = origin , [const Point& shift_y = origin , [const Point& shift_z = origin , [Picture& picture = current_picture ]]]]]]]]]])
|
Non-member function |
These functions draw lines centered on the origin, and ending in arrows in the
directions of the positive x,
y, and z-axes, and labels them with the appropriate letters.
draw_axes() is used in
many of the figures in this handbook. It can be helpful in determining
whether a Focus has a good "up " direction.
See Focus Reference; Data Members.
In the first version, all of the arguments are optional. In the second
version, ddraw_color is required and has been moved to the front
of the argument list. This version is often convenient, when a
The arguments:
|
void fill ([const Color& ffill_color = *Colors::default_color , [Picture& picture = current_picture ]])
|
const function |
void fill (Picture& picture, [const Color& ffill_color = *Colors::default_color ])
|
Function |
Allocates a copy of the The second version is convenient for passing a
The arguments are similar to those of p.fill(gray);
|
void filldraw ([const Color& ddraw_color = *Colors::default_color , [const Color& ffill_color = *Colors::background_color , [string ddashed = "", [string ppen = "", [Picture& picture = current_picture ]]]]])
|
const function |
void filldraw (Picture& picture, [const Color& ddraw_color = *Colors::default_color , [const Color& ffill_color = *Colors::background_color , [string ddashed = "", [string ppen = ""]]]])
|
const function |
Allocates a copy of the Path on the free store, puts a pointer to
the copy onto picture.shapes , sets
its fill_draw_value to FILLDRAW ,
its draw_color and fill_color to
* ddraw_color and * ffill_color , respectively,
its dashed to ddashed, and its pen
to ppen.
The second version is convenient for passing a
The arguments are similar to those of 3DLDF's p.filldraw(black, gray, "", "pencircle scaled 2mm");
It can often be useful to draw the outline of a default_focus.set(3, 0, -10, 3, 10, 10, 10); Point p[8]; p[0] = p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7].set(-1,-1, 5); p[1] *= p[2] *= p[3] *= p[4] *= p[5] *= p[6] *= p[7].rotate(0, 0, 45); p[2] *= p[3] *= p[4] *= p[5] *= p[6] *= p[7].rotate(0, 0, 45); p[3] *= p[4] *= p[5] *= p[6] *= p[7].rotate(0, 0, 45); p[4] *= p[5] *= p[6] *= p[7].rotate(0, 0, 45); p[5] *= p[6] *= p[7].rotate(0, 0, 45); p[6] *= p[7].rotate(0, 0, 45); p[7].rotate(0, 0, 45); Path r0("..", true, &p[0], &p[1], &p[2], &p[3], &p[4], &p[5], &p[6], &p[7], 0); r0.filldraw(black, light_gray); r0.scale(2, .5); r0.shift(0, 0, -2.5); r0.filldraw(black, gray); r0.scale(.25, 3); r0.shift(0, 0, -2.5); r0.filldraw();
|
void undraw ([string ddashed = "", [string ppen = "", [Picture& picture = current_picture ]]])
|
Function |
void undraw (Picture& picture, [string ddashed = "", [string ppen = ""]]) | Function |
Allocates a copy of the Path on the free store, puts a pointer to
it on picture.shapes , sets
its fill_draw_value to UNDRAW , and
the values of its
dashed and pen according to the
arguments.
The second version is convenient for passing a
This function "undraws" a Undrawing is useful for removing a portion of a Point P0(1, 1); Point P1(2, 1); Point P2(2, 3); Point P3(-1, 1); Path p("--", false, &origin, &P0, &P1, &P2, &P3, 0); p.draw(black, "", "pencircle scaled 3mm"); p.undraw("", "pencircle scaled 1mm");
|
void unfill ([Picture& picture = current_picture ])
|
Function |
Allocates a copy of the Path on the free store, puts a pointer to
it on picture.shapes and sets
its fill_draw_value to UNFILL
This function is useful for removing a portion of a filled region. Point pt[4]; pt[0].set(-2, -2); pt[1].set(2, -2); pt[2].set(2, 2); pt[3].set(-2, 2); Path p("--", true, &pt[0], &pt[1], &pt[2], &pt[3], 0); p.draw(); p.dotlabel(); p.filldraw(black, gray); p.scale(.5, .5); p.unfill();
|
void unfilldraw ([const Color& ddraw_color = *Colors::background_color , [string ddashed = "", [string ppen = "", [Picture& picture = current_picture]]]])
|
Function |
void unfilldraw (Picture& picture, [const Color& ddraw_color = *Colors::background_color , [string ddashed = "", [string ppen = ""]]])
|
Function |
Allocates a copy of the Path on the free store, puts a pointer to
it on picture.shapes , sets
its fill_draw_value to UNFILLDRAW , and
the values of its
draw_color , dashed , and pen according to the
arguments. While the default for ddraw_color is
*Colors::background_color , any other Color can be used,
so that unfilldraw() can unfill a Path and draw an outline
around it.
The second version is convenient for passing a
This function is similar to Point pt[6]; pt[0].set(-2, -2); pt[1].set(0, -3); pt[2].set(2, -2); pt[3].set(2, 2); pt[4].set(0, 3); pt[5].set(-2, 2); Path p("--", true, &pt[0], &pt[1], &pt[2], &pt[3], &pt[4], &pt[5], 0); p.fill(gray); p.scale(.5, .5); p.unfilldraw(black, "", "pensquare xscaled 3mm");
|
Hobby, A User's Manual for MetaPost, p. 32.
Knuth, The METAFONTbook, Chapter 4, p. 21ff. Hobby, A User's Manual for MetaPost, p. 32.
The usual interpretation of ""
as a
position argument to a
labelling command would be to put it directly onto *(Label.pt)
,
which in this case would put it onto the arrowhead. Since this
will probably never be desirable, I've decided to use ""
to
suppress drawing axes. Formerly, draw_axes()
used three
additional arguments for this purpose.