This reference page is linked to from the following overview
topics: Parameter
Types.
#include <point4.h>
Class Description
- See also:
- Class Point3.
- 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.
- Data Members:
- 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);
Public Member Functions
|
|
Point4
() |
|
Point4
(float X, float Y, float Z, float W) |
|
Point4
(double X, double Y, double Z, double W) |
|
Point4
(int X, int Y, int Z, int W) |
|
Point4
(const Point3 &a,
float W=0.0f) |
|
Point4
(const Point4
&a) |
|
Point4
(float af[4]) |
float
& |
operator[]
(int i) |
const float
& |
operator[]
(int i) const |
|
operator
float * () |
Point4 |
operator-
() const |
Point4 |
operator+
() const |
float |
Length ()
const |
float |
FLength
() const |
float |
LengthSquared
() const |
int |
MaxComponent
() const |
int |
MinComponent
() const |
Point4 |
Normalize
() const |
Point4 |
FNormalize
() const |
Point4 & |
operator-=
(const Point4
&) |
Point4 & |
operator+=
(const Point4
&) |
Point4 & |
operator*=
(float) |
Point4 & |
operator/=
(float) |
Point4 & |
operator*=
(const Point4
&) |
Point4 & |
Set
(float X, float Y, float Z, float W) |
int |
operator==
(const Point4 &p)
const |
int |
operator!=
(const Point4 &p)
const |
int |
Equals
(const Point4 &p,
float epsilon=1E-6f) |
Point4 & |
Unify
() |
float |
LengthUnify
() |
Point4 |
operator-
(const Point4 &)
const |
Point4 |
operator+
(const Point4 &)
const |
Point4 |
operator/
(const Point4 &)
const |
Point4 |
operator*
(const Point4 &)
const |
float |
operator%
(const Point4 &)
const |
Public Attributes
|
float |
x |
float |
y |
float |
z |
float |
w |
Static Public Attributes
|
static const
Point4 |
Origin |
static const
Point4 |
XAxis |
static const
Point4 |
YAxis |
static const
Point4 |
ZAxis |
static const
Point4 |
WAxis |
Constructor & Destructor Documentation
Point4 |
( |
float |
X, |
|
|
float |
Y, |
|
|
float |
Z, |
|
|
float |
W |
|
) |
|
[inline] |
{
x = X; y = Y; z = Z; w = W;
}
Point4 |
( |
double |
X, |
|
|
double |
Y, |
|
|
double |
Z, |
|
|
double |
W |
|
) |
|
[inline] |
{
x = (float)X; y = (float)Y; z = (float)Z; w = (float)W;
}
Point4 |
( |
int |
X, |
|
|
int |
Y, |
|
|
int |
Z, |
|
|
int |
W |
|
) |
|
[inline] |
{
x = (float)X; y = (float)Y; z = (float)Z; w = (float)W;
}
{
x = a.x; y = a.y; z = a.z; w = W;
}
Point4 |
( |
float |
af[4] |
) |
[inline] |
{
x = af[0]; y = af[1]; z = af[2]; w = af[3];
}
Member Function Documentation
float& operator[] |
( |
int |
i |
) |
[inline] |
- Returns:
- An value for i of 0 will return x, 1 will return y, 2
will return z and 3 will return w.
const float& operator[] |
( |
int |
i |
) |
const [inline] |
- Returns:
- An value for i of 0 will return x, 1 will return y, 2
will return z and 3 will return w.
operator float * |
( |
|
) |
[inline] |
Point4 operator- |
( |
|
) |
const [inline] |
Point4 operator+ |
( |
|
) |
const [inline] |
float Length |
( |
|
) |
const [inline] |
{
return (float)sqrt(x*x+y*y+z*z+w*w);
}
float FLength |
( |
|
) |
const [inline] |
float LengthSquared |
( |
|
) |
const [inline] |
int MaxComponent |
( |
|
) |
const |
int MinComponent |
( |
|
) |
const |
- Returns:
- A Point4 that is the
difference between two Point4s.
{
x -= a.x; y -= a.y; z -= a.z; w -= a.w;
return *this;
}
- Returns:
- A Point4 that is the
sum of two Point4s.
{
x += a.x; y += a.y; z += a.z; w += a.w;
return *this;
}
Point4 & operator*= |
( |
float |
f |
) |
[inline] |
- Returns:
- A Point4 multiplied
by a float.
{
x *= f; y *= f; z *= f; w *= f;
return *this;
}
Point4 & operator/= |
( |
float |
f |
) |
[inline] |
- Returns:
- A Point4 divided by
a float.
{
if (f==0.0f) f = .000001f;
x /= f; y /= f; z /= f; w /= f;
return *this;
}
- Returns:
- A Point4
element-by-element multiplied by another Point4.
{
x *= a.x; y *= a.y; z *= a.z; w *= a.w;
return *this;
}
Point4 & Set |
( |
float |
X, |
|
|
float |
Y, |
|
|
float |
Z, |
|
|
float |
W |
|
) |
|
[inline] |
- 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.
- Returns:
- A reference to this Point4.
{
x = X;
y = Y;
z = Z;
w = W;
return *this;
}
int operator== |
( |
const Point4 & |
p |
) |
const [inline] |
- Returns:
- Nonzero if the Point4's are equal; otherwise 0.
{
return ((p.x==x)&&(p.y==y)&&(p.z==z)&&(p.w==w));
}
int operator!= |
( |
const Point4 & |
p |
) |
const [inline] |
{
return ((p.x!=x)||(p.y!=y)||(p.z!=z)||(p.w!=w));
}
int Equals |
( |
const Point4 & |
p, |
|
|
float |
epsilon =
1E-6f |
|
) |
|
[inline] |
- Parameters:
- const Point4&
p
The point to compare.
float epsilon = 1E-6f
The tolerance to use in the comparison.
- Returns:
- Nonzero if the points are 'equal'; otherwise zero.
- Operators:
{
return (fabs(p.x - x) <= epsilon && fabs(p.y - y) <= epsilon
&& fabs(p.z - z) <= epsilon && fabs(p.w - w) <= epsilon);
}
- Returns:
- A Point4 that is the
difference between two Point4s.
- Returns:
- A Point4 that is the
sum of two Point4s.
float operator% |
( |
const Point4 & |
b |
) |
const [inline] |
{
return (x*b.x + y*b.y + z*b.z + w*b.w);
}
Member Data Documentation