Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

VPPoint4D Class Reference

Points and vectors using homogeneous coordinates. More...

#include <vppoint4d.h>

Inheritance diagram for VPPoint4D:

VPPoint List of all members.

Public Member Functions

 VPPoint4D ()
 Creates the (0,0,0,1) point.
 VPPoint4D (const VPPoint4D &point)
 VPPoint4D (const VPVertex3D &v)
 VPPoint4D (const VPVector3D &v)
 VPPoint4D (const VPPoint3D &p)
 VPPoint4D (double x, double y, double z, double w=1.0)
VPPoint4D operator- () const
bool operator== (const VPPoint4D &point) const
bool operator!= (const VPPoint4D &point) const
void operator= (const VPPoint4D &point)
void operator= (const VPVertex3D &v)
void operator= (const VPVector3D &v)
void operator= (const VPPoint3D &p)
bool operator< (const VPPoint4D &p) const
 Checks whether a point is "less then" other.
bool LexicographicalLess (const VPPoint4D &p) const
 Verifies whether a point is less than other by looking at coordinates in lexicographical (x, y, z then w) order.
bool XThenZLess (const VPPoint4D &p) const
 Verifies whether a point is less then other by looking at coordinates X, then Z only.
VPPoint4D operator+ (const VPPoint4D &vector) const
 Addition for point and vector (or vice versa).
void operator+= (const VPPoint4D &vector)
VPPoint4D operator- (const VPPoint4D &point) const
 Subtraction of two points.
VPPoint4D operator * (double escalar) const
void operator *= (double escalar)
double GetX () const
double GetY () const
double GetZ () const
double GetW () const
const double * VetXYZW () const
 This method is usefull to pass to glVertex4dv().
double DotProduct (const VPPoint4D &p) const
 Computes the dot product between "this" and "p".
double AngleTo (const VPPoint4D &p) const
 Computes the angle up to p.
VPPoint4D CrossProduct (const VPPoint4D &p) const
 Computes the cross product between "this" and "p".
void SetX (double x)
void SetY (double y)
void SetZ (double z)
void SetW (double w)
void SetXYZW (double x, double y, double z, double w)
void Normalize ()
 Normalizes the point/vector.
double Length () const

Static Public Member Functions

static const VPPoint4DDOWN ()
 The (0,-1,0,0) vector.
static const VPPoint4DORIGIN ()
 The (0,0,0,1) point.
static const VPPoint4DX ()
 The X vector (1,0,0,0).
static const VPPoint4DY ()
 The Y vector (0,1,0,0).
static const VPPoint4DZ ()
 The Z vector (0,0,1,0).

Static Public Attributes

static tCompareOper operatorLess = &VPPoint4D::LexicographicalLess
 Points to the operator to use within operator<.

Friends

std::ostream & operator<< (std::ostream &output, const VPPoint4D &p)
 Output operator.

Detailed Description

Points and vectors using homogeneous coordinates.

The VPPoint4D class provides a unified way of representing point and vectors objects, easing operations between these "two" kinds of entities along with integration with the VPTransform class. A 4D is homogeneous point represented by a vector (x,y,z,w). W coordinate is 0 for vectors and 1 for normalized points. This class has been created long after the VPPoint3D and VPVector3D classes, wich are used by (at this point) all other classes. It is recommended that this class slowly substitutes the other two.

Definition at line 26 of file vppoint4d.h.


Constructor & Destructor Documentation

VPPoint4D::VPPoint4D  ) 
 

Creates the (0,0,0,1) point.

Definition at line 28 of file vppoint4d.cpp.

Referenced by CrossProduct(), operator *(), and operator-().

VPPoint4D::VPPoint4D const VPPoint4D point  ) 
 

Definition at line 34 of file vppoint4d.cpp.

References vetCoord.

VPPoint4D::VPPoint4D const VPVertex3D v  ) 
 

Definition at line 42 of file vppoint4d.cpp.

References VPPoint3D::vpGetX(), VPPoint3D::vpGetY(), and VPPoint3D::vpGetZ().

VPPoint4D::VPPoint4D const VPVector3D v  ) 
 

Definition at line 58 of file vppoint4d.cpp.

References VPPoint3D::vpGetX(), VPPoint3D::vpGetY(), and VPPoint3D::vpGetZ().

VPPoint4D::VPPoint4D const VPPoint3D p  ) 
 

Definition at line 50 of file vppoint4d.cpp.

References VPPoint3D::vpGetX(), VPPoint3D::vpGetY(), and VPPoint3D::vpGetZ().

VPPoint4D::VPPoint4D double  x,
double  y,
double  z,
double  w = 1.0
 

Definition at line 66 of file vppoint4d.cpp.

References SetXYZW().


Member Function Documentation

double VPPoint4D::AngleTo const VPPoint4D p  )  const
 

Computes the angle up to p.

Requires both vectors to be normalized.

Returns:
the angle in radians of the smaller arc between "this" and "p".

Definition at line 148 of file vppoint4d.cpp.

Referenced by VPTransform::MakeRotation().

VPPoint4D VPPoint4D::CrossProduct const VPPoint4D p  )  const
 

Computes the cross product between "this" and "p".

Definition at line 143 of file vppoint4d.cpp.

References GetX(), GetY(), GetZ(), and VPPoint4D().

Referenced by VPMeshObject::AddFace(), VPMeshObject::ComputeTriangleNormal(), VPCamera::PitchAroundTarget(), and VPCamera::VPCamera().

double VPPoint4D::DotProduct const VPPoint4D p  )  const
 

Computes the dot product between "this" and "p".

Definition at line 138 of file vppoint4d.cpp.

References vetCoord.

const VPPoint4D & VPPoint4D::DOWN  )  [static]
 

The (0,-1,0,0) vector.

Definition at line 90 of file vppoint4d.cpp.

double VPPoint4D::GetW  )  const [inline]
 

Definition at line 83 of file vppoint4d.h.

Referenced by VPTransform::ApplyTo(), VPTransform::operator *(), and operator<<().

double VPPoint4D::GetX  )  const [inline]
 

Definition at line 80 of file vppoint4d.h.

Referenced by VPTransform::ApplyTo(), VPBoundingBox::ConditionalUpdate(), CrossProduct(), VPCamera::DrawOGL(), VPTransform::MakeRotation(), VPTransform::MakeTranslation(), VPTransform::operator *(), operator<<(), and VPMeshObject::Transform().

double VPPoint4D::GetY  )  const [inline]
 

Definition at line 81 of file vppoint4d.h.

Referenced by VPTransform::ApplyTo(), VPBoundingBox::ConditionalUpdate(), CrossProduct(), VPCamera::DrawOGL(), VPModifier::GetMax(), VPModifier::GetMin(), VPTransform::MakeRotation(), VPTransform::MakeTranslation(), VPTransform::operator *(), operator<<(), and VPMeshObject::Transform().

double VPPoint4D::GetZ  )  const [inline]
 

Definition at line 82 of file vppoint4d.h.

Referenced by VPTransform::ApplyTo(), VPBoundingBox::ConditionalUpdate(), CrossProduct(), VPCamera::DrawOGL(), VPTransform::MakeRotation(), VPTransform::MakeTranslation(), VPTransform::operator *(), operator<<(), and VPMeshObject::Transform().

double VPPoint4D::Length  )  const
 

Definition at line 133 of file vppoint4d.cpp.

Referenced by Normalize().

bool VPPoint4D::LexicographicalLess const VPPoint4D p  )  const
 

Verifies whether a point is less than other by looking at coordinates in lexicographical (x, y, z then w) order.

Definition at line 266 of file vppoint4d.cpp.

References vetCoord.

void VPPoint4D::Normalize  ) 
 

Normalizes the point/vector.

Points are normalized by dividing coordinates by W. Vectors are normalized by having their length changed to 1. Warning: The homogeneous point (0,0,0,0) is neither a point nor a vector and will cause a division by zero!

Definition at line 110 of file vppoint4d.cpp.

References Length().

Referenced by VPMeshObject::AddFace(), VPMeshObject::ComputeTriangleNormal(), VPTransform::MakeRotation(), VPCamera::MoveForward(), VPCamera::MoveSideways(), VPCamera::MoveUp(), VPCamera::PitchAroundTarget(), VPDof::Transform(), and VPCamera::VPCamera().

VPPoint4D VPPoint4D::operator * double  escalar  )  const
 

Definition at line 197 of file vppoint4d.cpp.

References VPPoint4D().

void VPPoint4D::operator *= double  escalar  ) 
 

Definition at line 205 of file vppoint4d.cpp.

bool VPPoint4D::operator!= const VPPoint4D point  )  const
 

Definition at line 226 of file vppoint4d.cpp.

References vetCoord.

VPPoint4D VPPoint4D::operator+ const VPPoint4D vector  )  const
 

Addition for point and vector (or vice versa).

Both point and vector should be normalized.

Returns:
a (translated) point.

Definition at line 178 of file vppoint4d.cpp.

void VPPoint4D::operator+= const VPPoint4D vector  ) 
 

Definition at line 189 of file vppoint4d.cpp.

References vetCoord.

VPPoint4D VPPoint4D::operator- const VPPoint4D point  )  const
 

Subtraction of two points.

Both points should be normalized.

Returns:
a vector (from "point" to "this").

Definition at line 170 of file vppoint4d.cpp.

References vetCoord, and VPPoint4D().

VPPoint4D VPPoint4D::operator-  )  const
 

Definition at line 163 of file vppoint4d.cpp.

References VPPoint4D().

bool VPPoint4D::operator< const VPPoint4D p  )  const
 

Checks whether a point is "less then" other.

The idea of ordering in 4D point comes from operatorLess public attribute.

Definition at line 221 of file vppoint4d.cpp.

References operatorLess.

void VPPoint4D::operator= const VPPoint3D p  ) 
 

Definition at line 242 of file vppoint4d.cpp.

References VPPoint3D::vpGetX(), VPPoint3D::vpGetY(), and VPPoint3D::vpGetZ().

void VPPoint4D::operator= const VPVector3D v  ) 
 

Definition at line 258 of file vppoint4d.cpp.

References VPPoint3D::vpGetX(), VPPoint3D::vpGetY(), and VPPoint3D::vpGetZ().

void VPPoint4D::operator= const VPVertex3D v  ) 
 

Definition at line 250 of file vppoint4d.cpp.

References VPPoint3D::vpGetX(), VPPoint3D::vpGetY(), and VPPoint3D::vpGetZ().

void VPPoint4D::operator= const VPPoint4D point  ) 
 

Definition at line 234 of file vppoint4d.cpp.

References vetCoord.

bool VPPoint4D::operator== const VPPoint4D point  )  const
 

Definition at line 213 of file vppoint4d.cpp.

References vetCoord.

const VPPoint4D & VPPoint4D::ORIGIN  )  [static]
 

The (0,0,0,1) point.

Definition at line 96 of file vppoint4d.cpp.

Referenced by VPLight::BRIGHT_AMBIENT(), and VPBezier::VPBezier().

void VPPoint4D::SetW double  w  )  [inline]
 

Definition at line 105 of file vppoint4d.h.

Referenced by VPDof::ComputeLIM(), VPTransform::GetTranslation(), VPTransform::GetVectorX(), VPTransform::GetVectorY(), VPTransform::GetVectorZ(), VPDof::MoveTo(), and VPDof::Transform().

void VPPoint4D::SetX double  x  )  [inline]
 

Definition at line 102 of file vppoint4d.h.

Referenced by VPTransform::GetTranslation(), VPTransform::GetVectorX(), VPTransform::GetVectorY(), and VPTransform::GetVectorZ().

void VPPoint4D::SetXYZW double  x,
double  y,
double  z,
double  w
 

Definition at line 102 of file vppoint4d.cpp.

Referenced by VPTransform::ApplyTo(), VPMeshObject::GetYProjection(), VPTransform::MakeRotation(), VPBoundingBox::ProcessCenter(), VPMeshObject::SetVertices(), VPMeshObject::Transform(), VPDof::VPDof(), and VPPoint4D().

void VPPoint4D::SetY double  y  )  [inline]
 

Definition at line 103 of file vppoint4d.h.

Referenced by VPTransform::GetTranslation(), VPTransform::GetVectorX(), VPTransform::GetVectorY(), and VPTransform::GetVectorZ().

void VPPoint4D::SetZ double  z  )  [inline]
 

Definition at line 104 of file vppoint4d.h.

Referenced by VPTransform::GetTranslation(), VPTransform::GetVectorX(), VPTransform::GetVectorY(), and VPTransform::GetVectorZ().

const double* VPPoint4D::VetXYZW  )  const [inline]
 

This method is usefull to pass to glVertex4dv().

Definition at line 88 of file vppoint4d.h.

const VPPoint4D & VPPoint4D::X  )  [static]
 

The X vector (1,0,0,0).

Definition at line 72 of file vppoint4d.cpp.

bool VPPoint4D::XThenZLess const VPPoint4D p  )  const
 

Verifies whether a point is less then other by looking at coordinates X, then Z only.

Definition at line 284 of file vppoint4d.cpp.

References vetCoord.

const VPPoint4D & VPPoint4D::Y  )  [static]
 

The Y vector (0,1,0,0).

Definition at line 78 of file vppoint4d.cpp.

Referenced by VPScene::MakeCameraViewAll().

const VPPoint4D & VPPoint4D::Z  )  [static]
 

The Z vector (0,0,1,0).

Definition at line 84 of file vppoint4d.cpp.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  output,
const VPPoint4D p
[friend]
 

Output operator.


Member Data Documentation

VPPoint4D::tCompareOper VPPoint4D::operatorLess = &VPPoint4D::LexicographicalLess [static]
 

Points to the operator to use within operator<.

The application programmer should change this pointer to the desired comparison function. Default value is LexicographicalLess. To change its value, use something like: VPPoint4D::operatorLess = &VPPoint4D::LexicographicalLess . Currently, possible values are: LexicographicalLess and XThenZLess.

Definition at line 134 of file vppoint4d.h.

Referenced by operator<().


The documentation for this class was generated from the following files:
Generated on Tue Sep 6 10:00:18 2005 for VPAT by  doxygen 1.4.4