SilverLining: SilverLining::Vector3 Class Reference

# SilverLining::Vector3 Class Reference

A 3D double-precision Vector class and its operations. More...

`#include <Vector3.h>`

Inherits SilverLining::MemObject.

Collaboration diagram for SilverLining::Vector3:
[legend]

List of all members.

## Public Member Functions
| Vector3 ()
| Default constructor, initializes to (0,0,0).
| Vector3 (double px, double py, double pz)
| Constructs a Vector3 with the given x,y,z coordinates.
| Vector3 (const Vector3 &v)
| Copy constructor.
double SILVERLINING_API | Length () const
| Returns the length of the vector.
double SILVERLINING_API | SquaredLength () const
| Returns the squared length of the vector, which is faster than computing the length.
void SILVERLINING_API | Normalize ()
| Scales the vector to be of length 1.0.
double SILVERLINING_API | Dot (const Vector3 &v) const
| Determines the dot product between this vector and another, and returns the result.
Vector3 SILVERLINING_API | Cross (const Vector3 &v) const
| Determines the cross product between this vector and another, and returns the result.
Vector3 SILVERLINING_API | operator* (double n) const
| Scales each x,y,z value of the vector by a constant n, and returns the result.
Vector3 SILVERLINING_API | operator+ (double n) const
| Adds a constant n to each component of the vector, and returns the result.
Vector3 SILVERLINING_API | operator- (const Vector3 &v) const
| Subtracts the specified vector from this vector, and returns the result.
Vector3 SILVERLINING_API | operator+ (const Vector3 &v) const
| Adds this vector to the specified vector, and returns the result.
bool SILVERLINING_API | operator== (const Vector3 &v) const
| Tests if two vectors are exactly equal.
bool SILVERLINING_API | operator!= (const Vector3 &v) const
| Test if two vectors are not exactly equal.
void SILVERLINING_API | Serialize (std::ostream &s) const
| Write this vector's data to a file.
void SILVERLINING_API | Unserialize (std::istream &s)
| Restore this vector from a file.
## Public Attributes
double | x
| Data members x,y,z public for convenience.

## Detailed Description

A 3D double-precision Vector class and its operations.

## Constructor & Destructor Documentation

SilverLining::Vector3::Vector3 | ( |  | ) | `[inline]`

Default constructor, initializes to (0,0,0).

SilverLining::Vector3::Vector3 | ( | double | px,
|  | double | py,
|  | double | pz |
| ) |  |  | `[inline]`

Constructs a Vector3 with the given x,y,z coordinates.

## Member Function Documentation

Vector3 SILVERLINING_API SilverLining::Vector3::Cross | ( | const Vector3 & | v | ) | const`[inline]`

Determines the cross product between this vector and another, and returns the result.

double SILVERLINING_API SilverLining::Vector3::Dot | ( | const Vector3 & | v | ) | const`[inline]`

Determines the dot product between this vector and another, and returns the result.

double SILVERLINING_API SilverLining::Vector3::Length | ( |  | ) | const`[inline]`

Returns the length of the vector.

void SILVERLINING_API SilverLining::Vector3::Normalize | ( |  | ) | `[inline]`

Scales the vector to be of length 1.0.

bool SILVERLINING_API SilverLining::Vector3::operator!= | ( | const Vector3 & | v | ) | const`[inline]`

Test if two vectors are not exactly equal.

Vector3 SILVERLINING_API SilverLining::Vector3::operator* | ( | double | n | ) | const`[inline]`

Scales each x,y,z value of the vector by a constant n, and returns the result.

Vector3 SILVERLINING_API SilverLining::Vector3::operator+ | ( | const Vector3 & | v | ) | const`[inline]`

Adds this vector to the specified vector, and returns the result.

Vector3 SILVERLINING_API SilverLining::Vector3::operator+ | ( | double | n | ) | const`[inline]`

Adds a constant n to each component of the vector, and returns the result.

Vector3 SILVERLINING_API SilverLining::Vector3::operator- | ( | const Vector3 & | v | ) | const`[inline]`

Subtracts the specified vector from this vector, and returns the result.

bool SILVERLINING_API SilverLining::Vector3::operator== | ( | const Vector3 & | v | ) | const`[inline]`

Tests if two vectors are exactly equal.

void SILVERLINING_API SilverLining::Vector3::Serialize | ( | std::ostream & | s | ) | const`[inline]`

Write this vector's data to a file.

double SILVERLINING_API SilverLining::Vector3::SquaredLength | ( |  | ) | const`[inline]`

Returns the squared length of the vector, which is faster than computing the length.

void SILVERLINING_API SilverLining::Vector3::Unserialize | ( | std::istream & | s | ) | `[inline]`

Restore this vector from a file.

## Member Data Documentation

double SilverLining::Vector3::x

Data members x,y,z public for convenience.

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

- /home/fkane/sl/trunk/Public Headers/Vector3.h