Facebook Twitter YouTube

class Point3D

Defined in:  TSVector3D.h
The Point3D class encapsulates a 3D point.
Definition

class Point3D : public Vector3D

Constructor

Point3D();

Point3D(float a, float b, float c);

Parameters
a The value of the x coordinate.
b The value of the y coordinate.
c The value of the z coordinate.
Description
The Point3D class is used to store a three-dimensional point having floating-point coordinates x, y, and z. The difference between a point and a vector is that a point is assumed to have a w coordinate of 1 whenever it needs to be converted to a four-dimensional representation, whereas a vector is assumed to have a w coordinate of 0. Such a conversion occurs when a vector or point is assigned to a Vector4D object or is multiplied by a Transform4D object.

The default constructor leaves the components of the vector undefined. If the values a, b, and c are supplied, then they are assigned to the x, y, and z coordinates of the base vector object, respectively.

The difference between two points produces a direction vector. A three-dimensional direction vector is converted to a point by adding it to the identifier Zero3D.
Overloaded Operators
Point3D& operator *=(float s); Multiplies by the scalar s.
Point3D& operator /=(float s); Divides by the scalar s.
Nonmember Operations
Point3D operator -(const Point3D& p); Returns the negation of the point p.
Point3D operator +(const Point3D& p1, const Point3D& p2); Returns the sum of the points p1 and p2.
Point3D operator +(const Point3D& p, const Vector3D& v); Returns the sum of the point p and the vector v.
Vector3D operator -(const Point3D& p1, const Point3D& p2); Returns the difference of the points p1 and p2.
Point3D operator -(const Point3D& p, const Vector3D& v); Returns the difference of the point p and the vector v.
Point3D operator -(const Vector3D& v, const Point3D& p); Returns the difference of the vector v and the point p.
Point3D operator *(const Point3D& p, float t); Returns the product of the point p and the scalar t.
Point3D operator *(float t, const Point3D& p); Returns the product of the point p and the scalar t.
Point3D operator /(const Point3D& p, float t); Returns the product of the point p and the inverse of the scalar t.
Point3D operator *(const Point3D& p1, const Point3D& p2); Returns the componentwise product of the points p1 and p2.
Point3D operator *(const Point3D& p, const Vector3D& v); Returns the componentwise product of the point p and the vector v.
Point3D operator *(const Vector3D& v, const Point3D& p); Returns the componentwise product of the vector v and the point p.
Base Classes
Vector3D A Point3D object behaves much like a Vector3D object, but some properties are altered.
See Also

Vector3D

Vector4D