Multiplies
transform
by t. By multiplying aPoint
successively by one or moreTransforms
, the effect of the transformations is “saved up” intransform
. Only when an operation that needs updated values for theworld_coordinates
is called on aPoint
, or thePoint
is passed as an argument to such an operation, is the transformation stored intransform
applied toworld_coordinates
byapply_transform()
, which subsequently, resetstransform
to the identityTransform
. See Point Reference; Applying Transformations.
const
operator: Point operator+ (Point p)Returns a
Point
withworld_coordinates
that are the sums of the correspondingworld_coordinates
of*this
and p, after they've been updated.*this
remains unchanged; as in many other functions withPoint
arguments, 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-const
operation.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_coordinates
of 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
Point
withworld_coordinates
representing the difference between the updated values ofthis->world_coordinates
and p.world_coordinates
.
Subtracts the updated values of p
.world_coordinates
from those ofthis->world_coordinates
.
Multiplies the updated x, y, and z coordinates (
world_coordinates
) of thePoint
by r and returns r. This makes it possible to chain invocations of this function.If
P
is aPoint
thenP *=
r is equivalent in its effect toP.scale(
r,
r,
r)
, except thatP.world_coordinates
is modified directly and immediately, without changingP.transform
. This is possible, because this function callsapply_transform()
to update theworld_coordinates
before multiplying themr
, sotransform
is 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
Point
with x, y, and z coordinates (world_coordinates
) equal to the updated x, y, and z coordinates of*this
multiplied by r.
Equivalent to
Point::operator*(const real
r)
(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
Point
with x, y, and z coordinates (world_coordinates
) equal to the the x, y, and z-coordinates (world_coordinates
) of*this
multiplied by -1.
Divides the updated x, y, and z coordinates (
world_coordinates
) of thePoint
by r.
const
operator: Point operator/ (const real r)Returns a
Point
with x, y, and z coordinates (world_coordinates
) equal to the updated x, y, and z coordinates of*this
divided by r.
const
operator: bool operator== (const Point& p)Equality comparison for
Points
. These functions returntrue
if the updated values of theworld_coordinates
of the twoPoints
differ by less than the value returned byPoint::epsilon()
, otherwisefalse
. See Point Reference; Returning Information.