- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes

# DblVector Class Reference

Search for all occurrences

## Detailed Description

Represents a 3D vector or point with S56E11 floating point elements.

Definition at line 336 of file math.h.

`#include <math.h>`

List of all members.

## Public Member Functions
| DblVector (void) throw ()
| Constructs the vector with zero values.
Vector | Vec () const
| DblVector (double fX, double fY, double fZ=0.0) throw ()
| Constructs the vector with specified values.
| DblVector (const DblVector &vVector) throw ()
| Copy constructor.
| DblVector (const Vector &vVector) throw ()
| constructor from single precision vector.
| DblVector (const char *pVector) throw ()
| Construct the vector from a pointer to 8bit signed data.
| DblVector (const short *pVector) throw ()
| Construct the vector from a pointer to 16bit signed data.
DblVector & | Set (double fX, double fY, double fZ) throw ()
| Sets the values of the vector elements and returns the vector.
DblVector & | Clear (void) throw ()
| Zeros all the components of the Vector, then returns it.
DblVector & | Normalize (void) throw ()
| Normalizes the vector and returns it.
DblVector | Normalized (void) const throw ()
| Returns a normalized version of the vector, without changing this vector.
DblVector & | MakeOrthogonal (const DblVector &vBase)
| Makes this vector orthogonal to the given vBase vector and normalizes it.
DblVector & | SetLength (double fLength)
| Sets the vector to the given length, without changing its direction.
double | LengthSquare (void) const
| Returns the square of the length of the DblVector.
double | Length () const throw ()
| Returns the length of the DblVector.
double | Length2D () const throw ()
| Returns the 2D length of the DblVector, ignoring the z element.
double | DistanceFrom (const DblVector &v) const
| Returns the distance between two points (this and another, represented as DblVector objects).
double | DistanceFromLine (const DblVector &v0, const DblVector &v1) const
| Returns the shortest distance between this point and a line defined by two other points (all points represented by DblVector objects).
double | DistanceFromSegment (const DblVector &v0, const DblVector &v1) const
| Returns the distance between this point and a line segment defined by the two ending points.
double | AngleCos (const DblVector &v1) const throw ()
| Returns the cosine of the angle between this vector and the one passed in.
DblVector | Minimum (const DblVector &o)
| Returns the minimum of this and the argument vector.
DblVector | Maximum (const DblVector &o)
| Returns the maximum of this and the argument vector.
DblVector | operator- (void) const throw ()
| Returns the inverse of the vector.
DblVector | operator+ (double f) const throw ()
| Returns the sum of a vector and a scalar.
DblVector | operator+ (const DblVector &v) const throw ()
| Returns the sum of two vectors.
DblVector | operator- (const DblVector &v) const throw ()
| Returns the difference between two DblVectors/points.
DblVector | operator* (const DblVector &v) const throw ()
| Returns the product of two DblVectors by components.
DblVector | operator* (double f) const throw ()
| Returns the product of the DblVector and a scalar.
DblVector | operator/ (const DblVector &v) const throw ()
| Returns the quotient of two DblVectors by components.
DblVector | operator/ (double f) const throw ()
| Returns the quotient of a DblVector and a scalar.
DblVector | operator* (int i) const throw ()
| Returns the product of a DblVector and an integer.
DblVector | operator/ (int i) const throw ()
| Returns the quotient of a DblVector and an integer.
DblVector | operator/ (unsigned int i) const throw ()
| Returns the quotient of a DblVector and an unsigned integer.
double | operator| (const DblVector &v) const throw ()
| Returns the dot product of two DblVectors.
DblVector | operator& (const DblVector &v) const
| Returns the cross product of two DblVectors.
bool | operator== (const DblVector &v) const throw ()
| Returns true if the two DblVectors are identical, false otherwise.
bool | operator!= (const DblVector &v) const throw ()
| Returns true if the two DblVectors are different, false otherwise.
| operator bool (void) const throw ()
| Returns true if the DblVector is not a zero DblVector, false otherwise.
bool | operator! (void) const throw ()
| Returns true if the DblVector is a zero DblVector, false otherwise.
DblVector & | operator= (const DblVector &v)
| Sets this DblVector to equal another one and returns it.
DblVector & | operator<< (const DblVector &v)
| Sets this DblVector to equal another one and returns it.
DblVector & | operator-= (const DblVector &v) throw ()
| Subtracts the component values of another DblVector from this one's, and returns the result.
DblVector & | operator+= (const DblVector &v) throw ()
| Adds another DblVector to this one and returns the result.
DblVector & | operator*= (double f)
| Multiplies the components of the DblVector with a scalar value and returns the result.
DblVector & | operator*= (const DblVector &v)
| Multiplies the DblVector with another DblVector by components and returns the result.
DblVector & | operator/= (double f)
| Divides the DblVector by a scalar and returns the result.
double & | operator[] (int i) throw ()
| Returns a individual components of the DblVector.
double & | operator[] (unsigned int i) throw ()
| Returns a component of the DblVector.
| operator const double * (void) const
| Returns a pointer to the data of the DblVector. Do not delete this pointer.
## Public Attributes
union {
struct {
double m_fX
double m_fY
double m_fZ
} |
struct {
double x
double y
double z
} |
double m_aCoors [3]
}; |

## Constructor & Destructor Documentation

DblVector | ( | void |  | ) | throw () `[inline]`

Constructs the vector with zero values.

Definition at line 340 of file math.h.

    { x = y = z = 0.0; };

DblVector | ( | double | fX,
|  | double | fY,
|  | double | fZ = `0.0`
| ) |  | throw () `[inline]`

Constructs the vector with specified values.

Definition at line 348 of file math.h.

        { x = fX; y = fY; z = fZ; };

DblVector | ( | const DblVector & | vVector | ) | throw () `[inline]`

Copy constructor.

Definition at line 352 of file math.h.

        { x = vVector.x; y = vVector.y; z = vVector.z; };

DblVector | ( | const Vector & | vVector | ) | throw () `[inline]`

constructor from single precision vector.

Definition at line 356 of file math.h.

        { x = vVector.x; y = vVector.y; z = vVector.z; };

DblVector | ( | const char * | pVector | ) | throw () `[inline]`

Construct the vector from a pointer to 8bit signed data.

The array must have at least 3 elements, with values in the range -127 to +127.

Definition at line 362 of file math.h.

        { x = pVector[0]*(1.0/127.0); y = pVector[1]*(1.0/127.0); z = pVector[2]*(1.0/127.0); };

DblVector | ( | const short * | pVector | ) | throw () `[inline]`

Construct the vector from a pointer to 16bit signed data.

The array must have at least 3 elements in the range -32767 to +32767.

Definition at line 367 of file math.h.

        { x = pVector[0]*(1.0/32767.0); y = pVector[1]*(1.0/32767.0); z = pVector[2]*(1.0/32767.0); };

## Member Function Documentation

Vector Vec | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 343 of file math.h.

                           {
            return Vector((float)x, (float)y, (float)z);
        }

DblVector& Set | ( | double | fX,
|  | double | fY,
|  | double | fZ
| ) |  | throw () `[inline]`

Search for all occurrences

Sets the values of the vector elements and returns the vector.

Definition at line 371 of file math.h.

        { x = fX; y = fY; z = fZ; return *this; };

DblVector& Clear | ( | void |  | ) | throw () `[inline]`

Search for all occurrences

Zeros all the components of the Vector, then returns it.

Definition at line 375 of file math.h.

        { return Set( 0.0, 0.0, 0.0 ); };

DblVector& Normalize | ( | void |  | ) | throw ()

Search for all occurrences

Normalizes the vector and returns it.

If the vector is zero length, it is set to (0,1,0)

DblVector Normalized | ( | void |  | ) | const throw ()

Search for all occurrences

Returns a normalized version of the vector, without changing this vector.

DblVector& MakeOrthogonal | ( | const DblVector & | vBase | ) |

Search for all occurrences

Makes this vector orthogonal to the given vBase vector and normalizes it.

Returns the vector.

The resulting vector will lie on the plane defined by the original value of this vector, and vBase.

DblVector& SetLength | ( | double | fLength | ) | `[inline]`

Search for all occurrences

Sets the vector to the given length, without changing its direction.

If the vector is of zero length, then it is arbitrarily made parallel to the Y axis.

Definition at line 398 of file math.h.

        { Normalize(); operator *=( fLength ); return *this; };

double LengthSquare | ( | void |  | ) | const `[inline]`

Search for all occurrences

Returns the square of the length of the DblVector.

Definition at line 403 of file math.h.

    { return x*x+y*y+z*z; };

double Length | ( |  | ) | const throw ()

Search for all occurrences

Returns the length of the DblVector.

double Length2D | ( |  | ) | const throw ()

Search for all occurrences

Returns the 2D length of the DblVector, ignoring the z element.

double DistanceFrom | ( | const DblVector & | v | ) | const `[inline]`

Search for all occurrences

Returns the distance between two points (this and another, represented as DblVector objects).

Definition at line 413 of file math.h.

    { return operator -(v).Length(); };

double DistanceFromLine | ( | const DblVector & | v0,
|  | const DblVector & | v1
| ) |  | const

Search for all occurrences

Returns the shortest distance between this point and a line defined by two other points (all points represented by DblVector objects).

double DistanceFromSegment | ( | const DblVector & | v0,
|  | const DblVector & | v1
| ) |  | const

Search for all occurrences

Returns the distance between this point and a line segment defined by the two ending points.

double AngleCos | ( | const DblVector & | v1 | ) | const throw () `[inline]`

Search for all occurrences

Returns the cosine of the angle between this vector and the one passed in.

Definition at line 425 of file math.h.

        { return DblVector(*this).Normalize()|DblVector(v1).Normalize(); };

DblVector Minimum | ( | const DblVector & | o | ) | `[inline]`

Search for all occurrences

Returns the minimum of this and the argument vector.

Minimums are calculated individually for z, y, and z.

Definition at line 430 of file math.h.

        { return DblVector( Min(x, o.x), Min(y, o.y), Min(z, o.z) ); };

DblVector Maximum | ( | const DblVector & | o | ) | `[inline]`

Search for all occurrences

Returns the maximum of this and the argument vector.

Maximums are calculated individually for z, y, and z.

Definition at line 435 of file math.h.

        { return DblVector( Max(x, o.x), Max(y, o.y), Max(z, o.z) ); };

DblVector operator- | ( | void |  | ) | const throw () `[inline]`

Returns the inverse of the vector.

Definition at line 439 of file math.h.

        { return DblVector( -x, -y, -z ); };

DblVector operator+ | ( | double | f | ) | const throw () `[inline]`

Returns the sum of a vector and a scalar.

(The scalar is added to each component individually).

Definition at line 444 of file math.h.

        { return DblVector( x+f, y+f, z+f ); };

DblVector operator+ | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns the sum of two vectors.

Definition at line 448 of file math.h.

        { return DblVector( x+v.x, y+v.y, z+v.z ); };

DblVector operator- | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns the difference between two DblVectors/points.

Definition at line 452 of file math.h.

        { return DblVector( x-v.x, y-v.y, z-v.z ); };

DblVector operator* | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns the product of two DblVectors by components.

Definition at line 456 of file math.h.

        { return DblVector( x*v.x, y*v.y, z*v.z ); };

DblVector operator* | ( | double | f | ) | const throw () `[inline]`

Returns the product of the DblVector and a scalar.

Definition at line 460 of file math.h.

        { return DblVector( x*f, y*f, z*f ); };

DblVector operator/ | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns the quotient of two DblVectors by components.

Definition at line 464 of file math.h.

        { return DblVector( x/v.x, y/v.y, z/v.z ); };

DblVector operator/ | ( | double | f | ) | const throw () `[inline]`

Returns the quotient of a DblVector and a scalar.

Definition at line 468 of file math.h.

        { return operator *( 1.0/f ); };

DblVector operator* | ( | int | i | ) | const throw () `[inline]`

Returns the product of a DblVector and an integer.

Definition at line 472 of file math.h.

        { return operator *( double(i) ); };

DblVector operator/ | ( | int | i | ) | const throw () `[inline]`

Returns the quotient of a DblVector and an integer.

Definition at line 476 of file math.h.

        { return operator /( double(i) ); };

DblVector operator/ | ( | unsigned int | i | ) | const throw () `[inline]`

Returns the quotient of a DblVector and an unsigned integer.

Definition at line 480 of file math.h.

        { return operator /( double(i) ); };

double operator| | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns the dot product of two DblVectors.

Definition at line 484 of file math.h.

        { return x*v.x+y*v.y+z*v.z; };

DblVector operator& | ( | const DblVector & | v | ) | const `[inline]`

Returns the cross product of two DblVectors.

Definition at line 488 of file math.h.

        {
            DblVector vR;
            vR.m_fX = m_fY*v.m_fZ-m_fZ*v.m_fY;
            vR.m_fY = m_fZ*v.m_fX-m_fX*v.m_fZ;
            vR.m_fZ = m_fX*v.m_fY-m_fY*v.m_fX;
            return vR;
        };

bool operator== | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns true if the two DblVectors are identical, false otherwise.

Definition at line 499 of file math.h.

        { return x == v.x && y == v.y && z == v.z; };

bool operator!= | ( | const DblVector & | v | ) | const throw () `[inline]`

Returns true if the two DblVectors are different, false otherwise.

Definition at line 503 of file math.h.

        { return !operator ==( v ); };

operator bool | ( | void |  | ) | const throw () `[inline]`

Returns true if the DblVector is not a zero DblVector, false otherwise.

Definition at line 507 of file math.h.

    { return x || y || z; };

bool operator! | ( | void |  | ) | const throw () `[inline]`

Returns true if the DblVector is a zero DblVector, false otherwise.

Definition at line 510 of file math.h.

    { return !operator bool(); };

DblVector& operator= | ( | const DblVector & | v | ) | `[inline]`

Sets this DblVector to equal another one and returns it.

Definition at line 513 of file math.h.

        { x = v.x; y = v.y; z = v.z; return *this; };

DblVector& operator<< | ( | const DblVector & | v | ) | `[inline]`

Sets this DblVector to equal another one and returns it.

Definition at line 517 of file math.h.

        { x = v.x; y = v.y; z = v.z; return *this; };

DblVector& operator-= | ( | const DblVector & | v | ) | throw () `[inline]`

Subtracts the component values of another DblVector from this one's, and returns the result.

Definition at line 522 of file math.h.

        { x-=v.x; y-=v.y; z-=v.z; return *this; };

DblVector& operator+= | ( | const DblVector & | v | ) | throw () `[inline]`

Adds another DblVector to this one and returns the result.

Definition at line 526 of file math.h.

            { x+=v.x; y+=v.y; z+=v.z; return *this; };

DblVector& operator*= | ( | double | f | ) | `[inline]`

Multiplies the components of the DblVector with a scalar value and returns the result.

Definition at line 531 of file math.h.

    { x *= f; y *= f; z *= f; return *this; };

DblVector& operator*= | ( | const DblVector & | v | ) | `[inline]`

Multiplies the DblVector with another DblVector by components and returns the result.

Definition at line 535 of file math.h.

            { x *= v.x; y *= v.y; z *= v.z; return *this; };

DblVector& operator/= | ( | double | f | ) | `[inline]`

Divides the DblVector by a scalar and returns the result.

Definition at line 539 of file math.h.

    { return operator *=( 1.0/f ); };

double& operator[] | ( | int | i | ) | throw () `[inline]`

Returns a individual components of the DblVector.

Parameters:

  [in] | i | Allowed range: 0 to 2.

Definition at line 542 of file math.h.

                      { return m_aCoors[i]; };

double& operator[] | ( | unsigned int | i | ) | throw () `[inline]`

Returns a component of the DblVector.

Parameters:

  [in] | i | Allowed range: 0 to 2.

Definition at line 547 of file math.h.

                      { return m_aCoors[i]; };

operator const double * | ( | void |  | ) | const `[inline]`

Returns a pointer to the data of the DblVector. Do not delete this pointer.

Definition at line 552 of file math.h.

    { return &x; };

## Member Data Documentation

double m_fX

Search for all occurrences

Definition at line 555 of file math.h.

double m_fY

Search for all occurrences

Definition at line 555 of file math.h.

double m_fZ

Search for all occurrences

Definition at line 555 of file math.h.

double x

Search for all occurrences

Definition at line 556 of file math.h.

double y

Search for all occurrences

Definition at line 556 of file math.h.

double z

Search for all occurrences

Definition at line 556 of file math.h.

double m_aCoors[3]

Search for all occurrences

Definition at line 557 of file math.h.

union { ... }

Search for all occurrences

The documentation for this class was generated from the following file:

- Mudbox/math.h

DblVector DblVector DblVector DblVector DblVector DblVector DblVector DblVector DblVector DblVector
DblVector DblVector DblVector DblVector DblVector DblVector DblVector DblVector DblVector DblVector