Class Point4

3DS Max Plug-In SDK

Class Point4

See Also: Class Point3.

class Point4

Description:

This class describes a point using float x, y, z and w coordinates. Methods are provided to add and subtract points, multiply and divide by scalars, and element by element multiply and divide two points. All methods are implemented by the system.

This class is available in release 2.0 and later only.

Data Members:

public:

float x, y, z, w;

The x, y, z and w components of the point.

static const Point4 Origin;

This is equivalent to Point4(0.0f, 0.0f, 0.0f, 0.0f);

static const Point4 XAxis;

This is equivalent to Point4(1.0f, 0.0f, 0.0f, 0.0f);

static const Point4 YAxis;

This is equivalent to Point4(0.0f,1.0f, 0.0f, 0.0f);

static const Point4 ZAxis;

This is equivalent to Point4(0.0f, 0.0f,1.0f, 0.0f);

static const Point4 WAxis;

This is equivalent to Point4(0.0f, 0.0f, 0.0f,1.0f);

Methods:

Prototype:

Point4 ()

Remarks:

Constructor. No initialization is performed.

Prototype:

Point4(float X, float Y, float Z, float W)

Remarks:

Constructor. x, y, z and w are initialized to the values specified.

Prototype:

Point4(double X, double Y, double Z, double W)

Remarks:

Constructor. x, y, z and w are initialized to the specified values (cast as floats).

Prototype:

Point4(int X, int Y, int Z, int W)

Remarks:

Constructor. x, y, z and w are initialized to the specified values (cast as floats).

Prototype:

Point4(const Point3& a, float W=0)

Remarks:

Constructor. x, y, z and w are initialized to the specified Point3 and W.

Prototype:

Point4(float af[4])

Remarks:

Constructor. x, y, z and w are initialized to af[0], af[1], af[2] and af[3] respectively.

Prototype:

inline Point4& Set(float X, float Y, float Z, float W);

Remarks:

This method is available in release 3.0 and later only.

Sets the x, y, z and w coordinate to the values passed and returns a reference to this Point4.

Parameters:

float X

The new x value.

float Y

The new y value.

float Z

The new z value.

float W

The new w value.

Return Value:

A reference to this Point4.

Prototype:

int Equals(const Point4& p, float epsilon = 1E-6f);

Remarks:

This method is available in release 3.0 and later only.

Compares this Point4 and the specified one to see if the x, y, z and w values are within plus or minus the specified tolerance.

Parameters:

const Point4& p

The point to compare.

float epsilon = 1E-6f

The tolerance to use in the comparison.

Return Value:

Nonzero if the points are 'equal'; otherwise zero.

Operators:

Prototype:

float& operator[](int i)

const float& operator[](int i) const

Remarks:

Allows access to x, y, z and w using the subscript operator.

Return Value:

An value for i of 0 will return x, 1 will return y, 2 will return z and 3 will return w.

Prototype:

operator float*()

Remarks:

Conversion function. Returns the address of the Point4.x

Prototype:

Point4 operator-() const

Remarks:

Unary - operator. Negates x, y, z and w.

Prototype:

Point4 operator+() const

Remarks:

Unary +. Returns the Point4.

Prototype:

inline Point4& operator-=(const Point4&);

Remarks:

Subtracts a Point4 from this Point4.

Return Value:

A Point4 that is the difference between two Point4s.

Prototype:

inline Point4& operator+=(const Point4&);

Remarks:

Adds a Point4 to this Point4.

Return Value:

A Point4 that is the sum of two Point4s.

Prototype:

inline Point4& operator*=(float);

Remarks:

Multiplies this Point4 by a floating point value.

Return Value:

A Point4 multiplied by a float.

Prototype:

inline Point4& operator/=(float);

Remarks:

Divides this Point4 by a floating point value.

Return Value:

A Point4 divided by a float.

Prototype:

inline Point4& operator*=(const Point4&);

Remarks:

Element-by-element multiplication of two Point4s:

(x*x, y*y, z*z, w*w).

Return Value:

A Point4 element-by-element multiplied by another Point4.

Prototype:

int operator==(const Point4& p) const

Remarks:

Equality operator. Test for equality between two Point4's.

Return Value:

Nonzero if the Point4's are equal; otherwise 0.

Prototype:

inline Point4 operator-(const Point4&) const;

Remarks:

Subtracts a Point4 from a Point4.

Return Value:

A Point4 that is the difference between two Point4s.

Prototype:

inline Point4 operator+(const Point4&) const;

Remarks:

Adds a Point4 to a Point4.

Return Value:

A Point4 that is the sum of two Point4s.

Prototype:

inline Point4 operator/(const Point4&) const;

Remarks:

Divides a Point4 by a Point4 element by element.

Return Value:

A Point4 resulting from dividing a Point4 by a Point4 element by element.

Prototype:

inline Point4 operator*(const Point4&) const;

Remarks:

Multiplies a Point4 by a Point4 element by element.

(x*x, y*y, z*z, w*w).

Return Value:

A Point4 resulting from the multiplication of a Point4 and a Point4.

Prototype:

inline Point4 operator*(float f, const Point4& a)

Remarks:

Returns a Point4 that is the specified Point4 multiplied by the specified float.

Prototype:

inline Point4 operator*(const Point4& a, float f)

Remarks:

Returns a Point4 that is the specified Point4 multiplied by the specified float.

Prototype:

inline Point4 operator/(const Point4& a, float f)

Remarks:

Returns a Point4 that is the specified Point4 divided by the specified float.

Prototype:

inline Point4 operator+(const Point4& a, float f)

Remarks:

Returns a Point4 that is the specified Point4 with the specified floating point valued added to each component x, y, z and w.