vector Reference Manual 0.9 Generated by Doxygen 1.2.11.1 Fri Mar 8 10:00:18 2002 Contents 1 vector Module Index 1.1 vector Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 vector Compound Index 2.1 vector Compound List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 vector Page Index 3.1 vector Related Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 vector Module Documentation 1 1 3 3 5 5 7 4.1 Geometric transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.2 Vector functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5 vector Class Documentation 9 5.1 matrix3 Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 5.2 matrix4 Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.3 quaternion Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5.4 vector3 Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 6 vector Page Documentation 21 6.1 Todo List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.2 Bug List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Chapter 1 vector Module Index 1.1 vector Modules Here is a list of all modules: Geometric • transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Vector•functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8 2 vector Module Index c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° Chapter 2 vector Compound Index 2.1 vector Compound List Here are the classes, structs, unions and interfaces with brief descriptions: matrix3 (Square matrix class with nine components (3 by 3)) matrix4 (Square matrix class with 16 components (4 by 4)) . quaternion (Quaternion class) . . . . . . . . . . . . . . . . . . vector3 (Vector class with three components (x, y, z)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 12 14 17 4 vector Compound Index c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° Chapter 3 vector Page Index 3.1 vector Related Pages Here is a list of all related documentation pages: Todo List • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bug List • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 22 6 vector Page Index c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° Chapter 4 vector Module Documentation 4.1 Geometric transforms Functions • double deg2rad (double deg) Convert degrees to radians. • double rad2deg (double rad) Convert radians to degrees. • matrix4 createRotMat (double angle, const vector3 &axis) Create a 4 by 4 rotation matrix. • quaternion createRotQuat (double angle, const vector3 &axis) Create a rotation quaternion. 8 vector Module Documentation 4.2 Vector functions Functions • const vector3 operator ∗ (double lhs, const vector3 &rhs) scalar-vector multiplication. • const vector3 operator ∗ (const vector3 &lhs, double rhs) • const vector3 operator/ (const vector3 &lhs, double rhs) scalar-vector division. • const vector3 operator+ (const vector3 &lhs, const vector3 &rhs) binary vector addition. • const vector3 operator- (const vector3 &lhs, const vector3 &rhs) binary vector subtraction. • const vector3 operator ∗ (const vector3 &lhs, const vector3 &rhs) binary vector multiplication (element-wise). • const vector3 operator/ (const vector3 &lhs, const vector3 &rhs) binary vector division (element-wise). • double dot (const vector3 &lhs, const vector3 &rhs) Vector dot product. • vector3 cross (const vector3 &lhs, const vector3 &rhs) Vector cross product. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° Chapter 5 vector Class Documentation 5.1 matrix3 Class Reference Square matrix class with nine components (3 by 3). #include <matrix3.h> Public Methods • double & operator() (unsigned int i, unsigned int j) Indexing operator. • const double & operator() (unsigned int i, unsigned int j) const Indexing operator, const version. • const matrix3 operator ∗= (double rhs) Unary matrix-scalar multiplication. • void zeros (void) Sets all entries to zero. • void identity (void) Set matrix to the identity matrix. • void transponse (void) Transponse the matrix. • double trace (void) const Compute the trace (diagonal sum). • matrix3 adjoint (void) const Compute the adjoint. • double determinant (void) const Compute the determinant of the matrix. 10 vector Class Documentation • bool invert (void) Invert matrix. • void print (void) const Simple printout for debugging purposes. 5.1.1 Detailed Description Square matrix class with nine components (3 by 3). 5.1.2 Member Function Documentation 5.1.2.1 matrix3 matrix3::adjoint (void) const Compute the adjoint. Computes and returns the adjoint of the matrix. The adjoint is defined as the transposed matrix of cofactors. 5.1.2.2 double matrix3::determinant (void) const Compute the determinant of the matrix. Compute determinant using row-reduction. Warning: This operation is sensitive to the condition of the matrix. please refer to a numrical linear algebra for more info on this. 5.1.2.3 bool matrix3::invert (void) Invert matrix. Compute the determinant and use Cramer’s rule to compute the inverse of this matrix. (in-place) 5.1.2.4 const matrix3 matrix3::operator ∗= (double rhs) [inline] Unary matrix-scalar multiplication. In-place matrix-scalar multiplication. 5.1.2.5 void matrix3::print (void) const Simple printout for debugging purposes. This function writes the matrix in textual form to cerr (STDERR). The documentation for this class was generated from the following files: c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 5.1 matrix3 Class Reference • matrix3.h • matrix3.cpp c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 11 12 vector Class Documentation 5.2 matrix4 Class Reference Square matrix class with 16 components (4 by 4). #include <matrix4.h> Public Methods • double & operator() (unsigned int i, unsigned int j) Indexing operator. • const double & operator() (unsigned int i, unsigned int j) const Indexing operator, const version. • const double ∗ getOpenGLMatrix (void) const • void zeros (void) Sets all entries to zero. • void identity (void) Set matrix to the identity matrix. • void transponse (void) transponse the matrix. • double trace (void) const compute the trace (diagonal sum). • double determinant (void) const Compute the determinant of the matrix. • bool invert (void) Invert matrix. • void print (void) const Simple printout for debugging purposes. • matrix3 getSubmatrix3 (void) const Get 3x3 submatrix. 5.2.1 Detailed Description Square matrix class with 16 components (4 by 4). 5.2.2 Member Function Documentation 5.2.2.1 double matrix4::determinant (void) const Compute the determinant of the matrix. Compute determinant using row-reduction. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 5.2 matrix4 Class Reference Warning: This operation is sensitive to the condition of the matrix. please refer to a numrical linear algebra for more info on this. 5.2.2.2 matrix3 matrix4::getSubmatrix3 (void) const Get 3x3 submatrix. Returns the first 3 rows and columns of the matrix. 5.2.2.3 bool matrix4::invert (void) Invert matrix. Compute the determinant and use Cramer’s rule to compute the inverse of this matrix. (in-place) 5.2.2.4 void matrix4::print (void) const Simple printout for debugging purposes. This function writes the matrix in textual form to cerr (STDERR). The documentation for this class was generated from the following files: • matrix4.h • matrix4.cpp c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 13 14 vector Class Documentation 5.3 quaternion Class Reference quaternion class. #include <quaternion.h> Public Methods • quaternion (void) Non-initializing constructor. • quaternion (double w, double x, double y, double z) Initialize with scalar part w and vector part [x, y, z]. • quaternion (double w, const vector3 &v) Initialize with scalar part w and vector v. • quaternion (const vector3 &v) Initialize pure quaternion with w = 0. • double getScalar (void) const Get the scalar part of the quaternion. • vector3 getVector (void) const Get the vector part of the quaternion. • void setScalar (double w) Set the scalar part of the quaternion. • void setVector (vector3 v) Set the vector part of the quaternion. • • • • • • • const quaternion operator+= (const quaternion &rhs) const quaternion operator-= (const quaternion &rhs) const quaternion operator ∗= (const quaternion &rhs) const quaternion operator ∗= (double rhs) const quaternion operator/= (const quaternion &rhs) const quaternion operator/= (double rhs) double getNorm (void) const Quaternion norm. • double getMagnitude (void) const Get magnitude. • void normalize (void) Normalize the quaternion. • void conjugate (void) Conjugate the quaternion. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 5.3 quaternion Class Reference • void inverse (void) Set the quaternion to its multiplicative inverse. • matrix4 toMatrix (void) const Create a 4 by 4 matrix from this quaternion. • void print (void) const Simple printout for debugging. 5.3.1 Detailed Description quaternion class. Models the quaternion mathematical entity. A quaternion is a extension of complex numbers on the form q = w + xi + yj + bk 5.3.2 Constructor & Destructor Documentation 5.3.2.1 quaternion::quaternion (const vector3 & v) [inline, explicit] Initialize pure quaternion with w = 0. This constructor is explicit and cannot be used to implicitly convert a vector3 (p. 17) to a quaternion. 5.3.3 Member Function Documentation 5.3.3.1 void quaternion::conjugate (void) [inline] Conjugate the quaternion. Equivelant to q.setVector(-q.getVector()) 5.3.3.2 double quaternion::getMagnitude (void) const [inline] Get magnitude. Defined to be sqrt(norm) 5.3.3.3 double quaternion::getNorm (void) const [inline] Quaternion norm. Defined to be x2 + y 2 + z 2 + w2 . 5.3.3.4 void quaternion::print (void) const Simple printout for debugging. This function writes the quaternion in textual form to cerr (STDERR). The documentation for this class was generated from the following files: c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 15 16 vector Class Documentation • quaternion.h • quaternion.cpp c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 5.4 vector3 Class Reference 5.4 vector3 Class Reference Vector class with three components (x, y, z). #include <vector3.h> Public Methods • vector3 (void) Default empty constructor. • vector3 (double x, double y, double z) Construct vector with components x, y and z. • const double & operator[ ] (int i) const Indexing operator, const version. • double & operator[ ] (int i) indexing operator. • bool operator== (const vector3 &rhs) Equality operator. • bool operator!= (const vector3 &rhs) inequality operator. • const vector3 operator+= (const vector3 &rhs) Unary vector summation. • const vector3 operator-= (const vector3 &rhs) Unary negative vector summation. • const vector3 operator ∗= (const vector3 &rhs) Unary vector component-wise multiplication. • const vector3 operator ∗= (double rhs) Unary vector-scalar multiplication. • const vector3 operator/= (const vector3 &rhs) Unary vector component-wise division. • const vector3 operator/= (double rhs) Unary vector-scalar multiplication. • const vector3 operator- (void) const unary vector negation. • double getMagnitude (void) const Get vector norm. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 17 18 vector Class Documentation • void setSpherical (double r, double theta, double phi) Set from polar coords. • void normalize (void) Normalize vector. • matrix3 star (void) const • void print (void) const Simple printout for debugging. • void rotate (double angle, const vector3 &axis) Rotate vector angle degrees around axis. 5.4.1 Detailed Description Vector class with three components (x, y, z). 5.4.2 Constructor & Destructor Documentation 5.4.2.1 vector3::vector3 (void) [inline] Default empty constructor. Constructs new vector3 object with uninitialized values. 5.4.2.2 vector3::vector3 (double x, double y, double z) [inline] Construct vector with components x, y and z. Constructs new vector3 with components (x, y, z) 5.4.3 Member Function Documentation 5.4.3.1 double vector3::getMagnitude (void) const Get vector norm. Returns the vector norm |v| = 5.4.3.2 p x2 + y 2 + z 2 . void vector3::normalize (void) Normalize vector. Equal to v /= v.getMagnitude(). Warning: This function does not test for the (almost) null vector before division. Therefor it is the users responsibility to ensure that the vector is not near-null. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 5.4 vector3 Class Reference 5.4.3.3 const vector3 vector3::operator ∗= (double rhs) [inline] Unary vector-scalar multiplication. In-place vector-scalar multiplication. 5.4.3.4 const vector3 vector3::operator ∗= (const vector3 & rhs) [inline] Unary vector component-wise multiplication. In-place vector component-wise multiplication. 5.4.3.5 bool vector3::operator!= (const vector3 & rhs) [inline] inequality operator. Tests for inequality between to vector3 objects. To vectors are diffrent if they are component-wise diffrent. Note that since the components and hence, the vector, are floating point values, testing for inequality is not always a good idea. 5.4.3.6 const vector3 vector3::operator+= (const vector3 & rhs) [inline] Unary vector summation. In-place summation of vectors. 5.4.3.7 const vector3 vector3::operator- (void) const [inline] unary vector negation. Negates the vector. 5.4.3.8 const vector3 vector3::operator-= (const vector3 & rhs) [inline] Unary negative vector summation. In-place negative summation of vectors 5.4.3.9 const vector3 vector3::operator/= (double rhs) [inline] Unary vector-scalar multiplication. In-place vector-scalar multiplication. Equal to @fv ∗= 1/s@f. 5.4.3.10 const vector3 vector3::operator/= (const vector3 & rhs) [inline] Unary vector component-wise division. In-place vector component-wise division. 5.4.3.11 bool vector3::operator== (const vector3 & rhs) [inline] Equality operator. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° 19 20 vector Class Documentation Tests for equality between to vector3 objects. To vectors are equal if they are component-wise equal. Note that since the components and hence, the vector, are floating point values, testing for equality is not always a good idea. 5.4.3.12 double& vector3::operator[ ] (int i) [inline] indexing operator. Access the individual components of a vector3 objects. 5.4.3.13 const double& vector3::operator[ ] (int i) const [inline] Indexing operator, const version. Access the individual components of a vector3 objects. 5.4.3.14 void vector3::print (void) const Simple printout for debugging. This function writes the vector in textual form to cerr (STDERR). Useful for debugging. 5.4.3.15 void vector3::setSpherical (double rho, double theta, double phi) Set from polar coords. Todo: Test me! 5.4.3.16 matrix3 vector3::star (void) const The following method computes the matrix w∗ so that w × r = w∗ R where w and r are 3-vectors and R is a 3x3 rotation matrix. The documentation for this class was generated from the following files: • vector3.h • vector3.cpp c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° Chapter 6 vector Page Documentation 6.1 Todo List Member matrix3::adjoint(void) const Test me Member matrix3::determinant(void) const Test me Member matrix3::invert(void) Make it work. Member matrix4::determinant(void) const Bother to write this out Member matrix4::invert(void) Not yet implemented Member vector3::setSpherical(double r, double theta, double phi) Test me! 22 vector Page Documentation 6.2 Bug List Member matrix3::invert(void) Doesn’t work yet. c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch ° Index adjoint matrix3, 10 conjugate quaternion, 15 createRotMat transform, 7 createRotQuat transform, 7 cross vectorfunc, 8 deg2rad transform, 7 determinant matrix3, 10 matrix4, 12 dot vectorfunc, 8 Geometric transforms, 7 getMagnitude quaternion, 15 vector3, 18 getNorm quaternion, 15 getOpenGLMatrix matrix4, 12 getScalar quaternion, 14 getSubmatrix3 matrix4, 13 getVector quaternion, 14 identity matrix3, 9 matrix4, 12 inverse quaternion, 15 invert matrix3, 10 matrix4, 13 matrix3, 9 adjoint, 10 determinant, 10 identity, 9 invert, 10 operator ∗=, 10 operator(), 9 print, 10 trace, 9 transponse, 9 zeros, 9 matrix4, 12 determinant, 12 getOpenGLMatrix, 12 getSubmatrix3, 13 identity, 12 invert, 13 operator(), 12 print, 13 trace, 12 transponse, 12 zeros, 12 normalize quaternion, 14 vector3, 18 operator ∗ vectorfunc, 8 operator ∗= matrix3, 10 quaternion, 14 vector3, 18, 19 operator!= vector3, 19 operator() matrix3, 9 matrix4, 12 operator+ vectorfunc, 8 operator+= quaternion, 14 vector3, 19 operatorvector3, 19 vectorfunc, 8 operator-= 24 INDEX quaternion, 14 vector3, 19 operator/ vectorfunc, 8 operator/= quaternion, 14 vector3, 19 operator== vector3, 19 operator[] vector3, 20 print matrix3, 10 matrix4, 13 quaternion, 15 vector3, 20 quaternion, 14 conjugate, 15 getMagnitude, 15 getNorm, 15 getScalar, 14 getVector, 14 inverse, 15 normalize, 14 operator ∗=, 14 operator+=, 14 operator-=, 14 operator/=, 14 print, 15 quaternion, 14, 15 setScalar, 14 setVector, 14 toMatrix, 15 rad2deg transform, 7 rotate vector3, 18 transform createRotMat, 7 createRotQuat, 7 deg2rad, 7 rad2deg, 7 transponse matrix3, 9 matrix4, 12 Vector functions, 8 vector3, 17 getMagnitude, 18 normalize, 18 operator ∗=, 18, 19 operator!=, 19 operator+=, 19 operator-, 19 operator-=, 19 operator/=, 19 operator==, 19 operator[], 20 print, 20 rotate, 18 setSpherical, 20 star, 20 vector3, 18 vectorfunc cross, 8 dot, 8 operator ∗, 8 operator+, 8 operator-, 8 operator/, 8 zeros matrix3, 9 matrix4, 12 setScalar quaternion, 14 setSpherical vector3, 20 setVector quaternion, 14 star vector3, 20 toMatrix quaternion, 15 trace matrix3, 9 matrix4, 12 c 1997-2001 Generated on Fri Mar 8 10:00:19 2002 for vector by Doxygen written by Dimitri van Heesch °