Node:Point Constructors and Setting Functions, Next:, Previous:Point Global Constants and Variables, Up:Point Reference



Constructors and Setting Functions

void Point (void) Default constructor
Creates a Point and initializes its x, y, and z-coordinates to 0.

void Point (const real x, [const real y = CURR_Y, [const real z = CURR_Z]]) Constructor
Creates a Point and initializes its x, y, and z-coordinates to the values of the arguments x, y, and z. The arguments y and z are optional. If they are not specified, the values of CURR_Y and CURR_Z are used. They are 0 by default, but can be changed by the user. This can be convenient, if all of the Points being drawn in a particular section of a program have the same z or y and z values.

void set (const real x, [const real y = CURR_Y, [const real z = CURR_Z]]) Setting function
Corresponds to the constructor above, but is used for resetting the coordinates of an existing Point.

void Point (const Point& p) Copy constructor
Creates a Point and copies the values for its x, y, and z-coordinates from p.

void set (const Point& p) Setting function
Corresponds to the copy constructor above, but is used for resetting the coordinates of an existing Point. This function exists purely as a convenience; the operator operator=() (see Point Reference; Operators) performs exactly the same function.

Point* create_new<Point> (const Point* p) Template specializations
Point* create_new<Point> (const Point& p)
Pseudo-constructors for dynamic allocation of Points. They create a Point on the free store and allocate memory for it using new(Point). They return a pointer to the new Point.

If p is a non-zero pointer or a reference, the new Point will be a copy of p. If the new object is not meant to be a copy of an existing one, 0 must be passed to create_new<Point>() as its argument. See Dynamic Allocation of Shapes, for more information.

One use for create_new<Point> is in the constructors for classes of objects that can contain a variable number of Points, such as Path and Polygon. Another use is in the drawing and filling functions, where objects are copied and the copies put onto a Picture.

Programmers who dynamically allocate Points must ensure that they are deallocated properly using delete!