Multiplies
transformby t. By multiplying aPointsuccessively by one or moreTransforms, the effect of the transformations is “saved up” intransform. Only when an operation that needs updated values for theworld_coordinatesis called on aPoint, or thePointis passed as an argument to such an operation, is the transformation stored intransformapplied toworld_coordinatesbyapply_transform(), which subsequently, resetstransformto the identityTransform. See Point Reference; Applying Transformations.
const operator: Point operator+ (Point p)Returns a
Pointwithworld_coordinatesthat are the sums of the correspondingworld_coordinatesof*thisand p, after they've been updated.*thisremains unchanged; as in many other functions withPointarguments, p is passed by value, becauseapply_transform()must be called on it, in order to update itsworld_coordinates. If p were aconst Point&, it would have to copied within the function anyway, becauseapply_transform()is a non-constoperation.Point p0(-2, -6, -28); Point p1(3, 14, 92); Point p2(p0 + p1); p2.show("p2:"); -| p2: (1, 8, 64)
Adds the updated
world_coordinatesof p to those of*this. Equivalent in effect toshift(p)In fact, this function merely callsp.apply_transform()andPoint::shift(real, real, real)with p's x, y, and z coordinates (fromworld_coordinates) as its arguments. See Point Reference; Affine Transformations.
const operator: Point operator- (Point p)Returns a
Pointwithworld_coordinatesrepresenting the difference between the updated values ofthis->world_coordinatesand p.world_coordinates.
Subtracts the updated values of p
.world_coordinatesfrom those ofthis->world_coordinates.
Multiplies the updated x, y, and z coordinates (
world_coordinates) of thePointby r and returns r. This makes it possible to chain invocations of this function.If
Pis aPointthenP *=r is equivalent in its effect toP.scale(r,r,r), except thatP.world_coordinatesis modified directly and immediately, without changingP.transform. This is possible, because this function callsapply_transform()to update theworld_coordinatesbefore multiplying themr, sotransformis the identityTransform.Point P(1, 2, 3); P *= 7; P.show("P:"); -| P: (7, 14, 21); Point Q(1.5, 2.7, 13.82); Q *= P *= -1.28; P.show("P:"); -| P: (-8.96, -17.92, -26.88) Q.show("Q:"); -| Q: (-1.92, -3.456, -17.6896)
const operator: Point operator* (const real r)Returns a
Pointwith x, y, and z coordinates (world_coordinates) equal to the updated x, y, and z coordinates of*thismultiplied by r.
Equivalent to
Point::operator*(const realr)(see above), but with r placed first.Point p0(10, 11, 12); real r = 2.5; Point p1 = r * p0; p1.show(); -|Point: -|(25, 27.5, 30)
const operator: Point operator- (void)Unary minus (prefix). Returns a
Pointwith x, y, and z coordinates (world_coordinates) equal to the the x, y, and z-coordinates (world_coordinates) of*thismultiplied by -1.
Divides the updated x, y, and z coordinates (
world_coordinates) of thePointby r.
const operator: Point operator/ (const real r)Returns a
Pointwith x, y, and z coordinates (world_coordinates) equal to the updated x, y, and z coordinates of*thisdivided by r.
const operator: bool operator== (const Point& p)Equality comparison for
Points. These functions returntrueif the updated values of theworld_coordinatesof the twoPointsdiffer by less than the value returned byPoint::epsilon(), otherwisefalse. See Point Reference; Returning Information.