Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::Vector3 Class Reference
[Math]

Represents a spatial position vector. More...

#include <Vector3.h>

Inheritance diagram for OSCAR::Vector3:

Inheritance graph
[legend]
List of all members.

Public Methods

 Vector3 ()
 Vector3 (double x, double y, double z)
 Vector3 (double *array)
 Vector3 (const Vector &arg)
virtual ~Vector3 ()
double & X ()
const double & X () const
double & Y ()
const double & Y () const
double & Z ()
const double & Z () const
double GetX () const
double GetY () const
double GetZ () const
double Distance (const Vector3 &vec) const
double DistanceSqr (const Vector3 &vec) const
void X (double x)
void Y (double y)
void Z (double z)
bool operator== (const Vector3 &rhs) const
Vector3 Cross (const Vector3 &v2) const
void Null ()
double Dot (const Vector3 &rhs) const
Matrix Cross ()
Vector3 & operator= (const Vector3 &rhs)
Vector3 & operator= (const Vector &rhs)
Vector3 & operator= (double rhs)
Vector3 & operator+= (const Vector3 &rhs)
Vector3 & operator-= (const Vector3 &rhs)
Vector3 & operator *= (const Vector3 &rhs)
Vector3 & operator+= (double rhs)
Vector3 & operator-= (double rhs)
Vector3 & operator *= (double rhs)
Vector3 & operator/= (double rhs)
Vector3 operator+ (const Vector3 &rhs) const
void Add (const Vector3 &rhs, Vector3 &result) const
Vector3 operator- (const Vector3 &rhs) const
void Subtract (const Vector3 &rhs, Vector3 &result) const
Vector3 operator * (const Vector3 &rhs) const
void Multiply (const Vector3 &rhs, Vector3 &result) const
Vector3 operator * (double rhs) const
void Multiply (double rhs, Vector3 &result) const
Vector3 operator+ (double rhs) const
void Add (double rhs, Vector3 &result) const
Vector3 operator- (double rhs) const
void Subtract (double rhs, Vector3 &result) const
Vector3 operator/ (double rhs) const
bool Divide (double rhs, Vector3 &result) const

Protected Methods

void init (const double *array=0)

Detailed Description

Author:
Chetan Kapoor
Represents a spatial position vector. It contains added functionality for cross products, normals, etc. This class should be used to represent a translation or axis in space.


Constructor & Destructor Documentation

OSCAR::Vector3::Vector3  
 

Contructor.

Constructs an Vector3 with all elements initalized to to 0.0.

OSCAR::Vector3::Vector3 double    x,
double    y,
double    z
 

Constructor.

Constructs an Vector3 with certain X,Y,Z values.

Parameters:
x Value of element x.
y Value of element y.
z Value of element z.

OSCAR::Vector3::Vector3 double *    array [explicit]
 

Constructor.

Constructs an Vector3 with elements initialized from an array of type double.

Parameters:
array Pointer to an array of size 3 that will be used to initialize the Vector3.

OSCAR::Vector3::Vector3 const Vector   arg
 

Constructor.

Constructs an Vector3 with initialized with the first 3 values from the argument, an VectorNumeric<double>. Behavior is not defined for arguments with less than 3 elements.

Parameters:
arg Pointer to an array of size 3 that will be used to initialize the Vector3.

virtual OSCAR::Vector3::~Vector3   [virtual]
 

Destructor.

This is the Destructor for an object of type Vector3.


Member Function Documentation

void OSCAR::Vector3::Add double    rhs,
Vector3 &    result
const [inline]
 

Add a number to this vector. This is a more efficient version of the operator+.

Parameters:
rhs The number to be added to this vector.
result The result of the addition.

void OSCAR::Vector3::Add const Vector3 &    rhs,
Vector3 &    result
const [inline]
 

Add two vectors. This is a more efficient version of the operator+.

Parameters:
rhs The vector to be added to this vector.
result The result of the addition.

Matrix OSCAR::Vector3::Cross  
 

Get a 3x3 cross product matrix for a Vector3.

This method is used to get a 3x3 cross product matrix for a Vector3.

Returns:
A 3x3 Matrix object.

Vector3 OSCAR::Vector3::Cross const Vector3 &    v2 const
 

Get the cross product of two Vector3s.

This method is used to get the cross product of two Vector3s.

Parameters:
v2 An Vector3 to use in the cross product.
Returns:
The resulting Vector3.

double OSCAR::Vector3::Distance const Vector3 &    vec const [inline]
 

Get the Euclidian distance between two spatial vectors.

Parameters:
vec An Vector3 to find the distance from
Returns:
The resulting distance

double OSCAR::Vector3::DistanceSqr const Vector3 &    vec const [inline]
 

Get the square of the Euclidian distance between two spatial vectors.

Parameters:
vec An Vector3 to find the distance from
Returns:
The resulting squared distance

bool OSCAR::Vector3::Divide double    rhs,
Vector3 &    result
const [inline]
 

Divide this vector by a number. The number should not be zero. This is a more efficient version of the operator/.

Parameters:
rhs The number by which this vector is divided.
result The result of the division.
Returns:
true or false. false is rhs is 0.0 divideByZero

double OSCAR::Vector3::Dot const Vector3 &    rhs const [inline]
 

Return the dot (inner) product between a Vector3 object and the calling object.

This method returns performs the dot product between vectors. Return value is sum over all 3 of this.at(i)*rhs.at(i)

Returns:
Double containing the dot product

double OSCAR::Vector3::GetX   const [inline]
 

Get a copy of the first element of an Vector3.

This method is used to get a copy of the first element of an Vector3.

Returns:
A copy of the first element.

double OSCAR::Vector3::GetY   const [inline]
 

Get a copy of the second element of an Vector3.

This method is used to get a copy of the second element of an Vector3.

Returns:
A copy of the second element.

double OSCAR::Vector3::GetZ   const [inline]
 

Get a copy of the third element of an Vector3.

This method is used to get a copy of the third element of an Vector3.

Returns:
A copy of the third element.

void OSCAR::Vector3::init const double *    array = 0 [protected]
 

Initialize a Vector3.

This method is used to initialize a Vector3. The pointer to the array is optional, and by default is null.

Parameters:
array Pointer to an array.

void OSCAR::Vector3::Multiply double    rhs,
Vector3 &    result
const [inline]
 

Multiply a number with this vector. This is a more efficient version of the operator*.

Parameters:
rhs The number to be multiplied with this vector.
result The result of the multiplication.

void OSCAR::Vector3::Multiply const Vector3 &    rhs,
Vector3 &    result
const [inline]
 

Multiply two vectors. This is a more efficient version of the operator*.

Parameters:
rhs The vector to be multiplied with this vector.
result The result of the multiplication.

void OSCAR::Vector3::Null   [inline]
 

Sets this vector to the null vector Sets all elements of the vector to zero.

Vector3 OSCAR::Vector3::operator * double    rhs const [inline]
 

Vector3 OSCAR::Vector3::operator * const Vector3 &    rhs const [inline]
 

Vector3& OSCAR::Vector3::operator *= double    rhs [inline]
 

Vector3& OSCAR::Vector3::operator *= const Vector3 &    rhs [inline]
 

Vector3 OSCAR::Vector3::operator+ double    rhs const [inline]
 

Vector3 OSCAR::Vector3::operator+ const Vector3 &    rhs const [inline]
 

Vector3& OSCAR::Vector3::operator+= double    rhs [inline]
 

Vector3& OSCAR::Vector3::operator+= const Vector3 &    rhs [inline]
 

Vector3 OSCAR::Vector3::operator- double    rhs const [inline]
 

Vector3 OSCAR::Vector3::operator- const Vector3 &    rhs const [inline]
 

Vector3& OSCAR::Vector3::operator-= double    rhs [inline]
 

Vector3& OSCAR::Vector3::operator-= const Vector3 &    rhs [inline]
 

Vector3 OSCAR::Vector3::operator/ double    rhs const [inline]
 

Divides the calling vector by a number. The number should not be zero.

Parameters:
rhs The number with which the calling vector has to be divided
Returns:
A new vector that holds the result of the divisiion. If rhs is 0.0, then an error is set and a Vector3(0,0,0) is returned divideByZero

Vector3& OSCAR::Vector3::operator/= double    rhs [inline]
 

Vector3& OSCAR::Vector3::operator= double    rhs [inline]
 

Vector3& OSCAR::Vector3::operator= const Vector   rhs [inline]
 

Vector3& OSCAR::Vector3::operator= const Vector3 &    rhs [inline]
 

bool OSCAR::Vector3::operator== const Vector3 &    rhs const [inline]
 

Overloaded == operator.

Overloaded == operator. This operator checks to see if two Vector3 are equal or not.

Parameters:
rhs A VectorNumeric object.
Returns:
true if both Vector3 are equal. Otherwise, a false is returned.

void OSCAR::Vector3::Subtract double    rhs,
Vector3 &    result
const [inline]
 

Substract a number from this vector. This is a more efficient version of the operator-.

Parameters:
rhs The number to be subtracted from this vector.
result The result of the subtraction.

void OSCAR::Vector3::Subtract const Vector3 &    rhs,
Vector3 &    result
const [inline]
 

Substract two vectors. This is a more efficient version of the operator-.

Parameters:
rhs The vector to be subtracted from this vector.
result The result of the subtraction.

void OSCAR::Vector3::X double    x [inline]
 

Set the value of the first element of an Vector3.

This method is used to set the value of the first element of an Vector3.

Parameters:
x The value to assign to the first element.

const double& OSCAR::Vector3::X   const [inline]
 

Get a const reference to the first element of an Vector3.

This method is used to get a const reference to the first element of an Vector3.

Returns:
A const reference to the first element.

double& OSCAR::Vector3::X   [inline]
 

Get a reference to the first element of an Vector3.

This method is used to get a reference to the first element of an Vector3.

Returns:
A reference to the first element.

void OSCAR::Vector3::Y double    y [inline]
 

Set the value of the second element of an Vector3.

This method is used to set the value of the second element of an Vector3.

Parameters:
y The value to assign to the second element.

const double& OSCAR::Vector3::Y   const [inline]
 

Get a const reference to the second element of an Vector3.

This method is used to get a const reference to the second element of an Vector3.

Returns:
A const reference to the second element.

double& OSCAR::Vector3::Y   [inline]
 

Get a reference to the second element of an Vector3.

This method is used to get a reference to the second element of an Vector3.

Returns:
A reference to the second element.

void OSCAR::Vector3::Z double    z [inline]
 

Set the value of the third element of an Vector3.

This method is used to set the value of the third element of an Vector3.

Parameters:
z The value to assign to the third element.

const double& OSCAR::Vector3::Z   const [inline]
 

Get a const reference to the third element of an Vector3.

This method is used to get a const reference to the third element of an Vector3.

Returns:
A const reference to the third element.

double& OSCAR::Vector3::Z   [inline]
 

Get a reference to the third element of an Vector3.

This method is used to get a reference to the third element of an Vector3.

Returns:
A reference to the third element.


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations