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

nvmath::Vecnf< n > Class Template Reference

Template for n-dimensional vector. More...

#include <Vecnf.h>

Inheritance diagram for nvmath::Vecnf< n >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Vecnf (void)
 Default constructor.
 Vecnf (const Vecnf< n > &v)
 Copy constructor.
float & operator[] (size_t i)
 Non-constant subscript operator.
const float & operator[] (size_t i) const
 Constant subscript operator.
Vecnf< n > operator- (void) const
 Negation operator.
Vecnf< n > operator * (float f) const
 Vector multiplication with a scalar operator.
float operator * (const Vecnf< n > &v) const
 Vector multiplication with a vector (i.e. dot product) operator.
Vecnf< n > operator/ (float f) const
 Vector division by a scalar operator.
Vecnf< n > operator+ (const Vecnf< n > &v) const
 Vector addition operator.
Vecnf< n > operator- (const Vecnf< n > &v) const
 Vector subtraction operator.
bool operator== (const Vecnf< n > &v) const
 Equality operator.
bool operator!= (const Vecnf< n > &v) const
 Inequality operator.
Vecnf< n > & operator= (const Vecnf< n > &v)
 Assignment operator.
Vecnf< n > & operator *= (float f)
 Vector multiplication with a scalar and assignment operator.
Vecnf< n > & operator/= (float f)
 Vector division by a scalar and assignment operator.
Vecnf< n > & operator+= (const Vecnf< n > &v)
 Vector addition and assignment operator.
Vecnf< n > & operator-= (const Vecnf< n > &v)
 Vector subtraction and assignment operator.
const float * getPtr (void) const
 Get a constant pointer to the floats of the vector.
float normalize (void)
 Normalize the vector and return the previous length.
void orthogonalize (const Vecnf< n > &v)
 Orthogonolize the vector with respect to a vector.
void orthonormalize (const Vecnf< n > &v)
 Orthonormalize the vector with respect to an other.

Protected Attributes

float m_vec [n]

Related Functions

(Note that these are not member functions.)

bool areOrthogonal (const Vecnf< n > &v0, const Vecnf< n > &v1)
bool areOrthonormal (const Vecnf< n > &v0, const Vecnf< n > &v1)
bool areSimilar (const Vecnf< n > &v0, const Vecnf< n > &v1, float tol=FLT_EPSILON)
float distance (const Vecnf< n > &p0, const Vecnf< n > &p1)
bool isNormalized (const Vecnf< n > &v)
bool isNull (const Vecnf< n > &v)
float length (const Vecnf< n > &v)
float lengthSquared (const Vecnf< n > &v)
float maxElement (const Vecnf< n > &v)
float minElement (const Vecnf< n > &v)
Vecnf< n > operator * (float f, const Vecnf< n > &v)

Detailed Description

template<unsigned char n>
class nvmath::Vecnf< n >

Template for n-dimensional vector.


Constructor & Destructor Documentation

template<unsigned char n>
nvmath::Vecnf< n >::Vecnf void   ) 
 

Default constructor.

For performance reasons no initialization is performed.

template<unsigned char n>
nvmath::Vecnf< n >::Vecnf const Vecnf< n > &  v  ) 
 

Copy constructor.

Parameters:
v  vector to copy


Member Function Documentation

template<unsigned char n>
float & nvmath::Vecnf< n >::operator[] size_t  i  ) 
 

Non-constant subscript operator.

Returns:
reference to i th element of the vector
Parameters:
i  index to vector to use (i=0,..,n-1)

template<unsigned char n>
const float & nvmath::Vecnf< n >::operator[] size_t  i  )  const
 

Constant subscript operator.

Returns:
constant reference to i th element of the vector
Parameters:
i  index to vector to use (i=0,..,n-1)

template<unsigned char n>
Vecnf< n > nvmath::Vecnf< n >::operator- void   )  const
 

Negation operator.

Returns:
negated vector

Reimplemented in nvmath::Vec3f.

template<unsigned char n>
Vecnf< n > nvmath::Vecnf< n >::operator * float  f  )  const
 

Vector multiplication with a scalar operator.

Returns:
multiplied vector
Parameters:
f  scalar to multiply with

template<unsigned char n>
float nvmath::Vecnf< n >::operator * const Vecnf< n > &  v  )  const
 

Vector multiplication with a vector (i.e. dot product) operator.

Returns:
dot product of this with v
Parameters:
v  vector to multiply with

template<unsigned char n>
Vecnf< n > nvmath::Vecnf< n >::operator/ float  f  )  const
 

Vector division by a scalar operator.

Returns:
divided vector
Parameters:
f  scalar to divide through

template<unsigned char n>
Vecnf< n > nvmath::Vecnf< n >::operator+ const Vecnf< n > &  v  )  const
 

Vector addition operator.

Returns:
sum of the two vectors
Parameters:
v  vector to add

template<unsigned char n>
Vecnf< n > nvmath::Vecnf< n >::operator- const Vecnf< n > &  v  )  const
 

Vector subtraction operator.

Returns:
difference of the two vectors
Parameters:
v  vector to subtract

template<unsigned char n>
bool nvmath::Vecnf< n >::operator== const Vecnf< n > &  v  )  const
 

Equality operator.

Returns:
true if the vector is equal to v, otherwise false
Parameters:
v  vector to compare with

template<unsigned char n>
bool nvmath::Vecnf< n >::operator!= const Vecnf< n > &  v  )  const
 

Inequality operator.

Returns:
true if the vector is not equal to v, otherwise false
Parameters:
v  vector to compare with

template<unsigned char n>
Vecnf< n > & nvmath::Vecnf< n >::operator= const Vecnf< n > &  v  ) 
 

Assignment operator.

Returns:
reference to the assigned vector
Parameters:
v  vector to copy

template<unsigned char n>
Vecnf< n > & nvmath::Vecnf< n >::operator *= float  f  ) 
 

Vector multiplication with a scalar and assignment operator.

Returns:
reference to the assigned vector after multiplication
Parameters:
f  scalar to multiply with

template<unsigned char n>
Vecnf< n > & nvmath::Vecnf< n >::operator/= float  f  ) 
 

Vector division by a scalar and assignment operator.

Returns:
reference to the assigned vector after division
Parameters:
f  scalar to divide by

template<unsigned char n>
Vecnf< n > & nvmath::Vecnf< n >::operator+= const Vecnf< n > &  v  ) 
 

Vector addition and assignment operator.

Returns:
reference to the assigned vector after addition
Parameters:
v  vector to add

template<unsigned char n>
Vecnf< n > & nvmath::Vecnf< n >::operator-= const Vecnf< n > &  v  ) 
 

Vector subtraction and assignment operator.

Returns:
reference to the assigned vector after subtraction
Parameters:
v  vector to subtract

template<unsigned char n>
const float * nvmath::Vecnf< n >::getPtr void   )  const
 

Get a constant pointer to the floats of the vector.

Returns:
constant pointer to vector elements

template<unsigned char n>
float nvmath::Vecnf< n >::normalize void   ) 
 

Normalize the vector and return the previous length.

Returns:
length of the vector before normalization

template<unsigned char n>
void nvmath::Vecnf< n >::orthogonalize const Vecnf< n > &  v  ) 
 

Orthogonolize the vector with respect to a vector.

Sets the vector to be orthogonal to v.

Parameters:
v  vector to orthogonalize to

template<unsigned char n>
void nvmath::Vecnf< n >::orthonormalize const Vecnf< n > &  v  ) 
 

Orthonormalize the vector with respect to an other.

Sets the vector to be orthonormal to v.

Parameters:
v  vector to orthonormalize to


Friends And Related Function Documentation

template<unsigned char n>
bool areOrthogonal const Vecnf< n > &  v0,
const Vecnf< n > &  v1
[related]
 

Test if two vectors are orthogonal to each other.

Returns:
true if the vectors are orthogonal, otherwise false
Parameters:
v0  first vector
v1  second vector

template<unsigned char n>
bool areOrthonormal const Vecnf< n > &  v0,
const Vecnf< n > &  v1
[related]
 

Test if two vectors are orthonormal to each other. Two vectors are orthonormal if they are normalized and orthogonal to each other.

Returns:
true if the vector is orthonormal to v, otherwise false
Parameters:
v0  first vector
v1  second vector

template<unsigned char n>
bool areSimilar const Vecnf< n > &  v0,
const Vecnf< n > &  v1,
float  tol = FLT_EPSILON
[related]
 

Test if two vectors are similar to each other. Two vectors are considered to be similar if they differ within a given tolerance in each component.

Returns:
true if the vector and v differ less than tol in each component.
Parameters:
v0  first vector
v1  second vector
tol  maximal allowed tolerance for similarity

template<unsigned char n>
float distance const Vecnf< n > &  p0,
const Vecnf< n > &  p1
[related]
 

Determine the distance between two points.

Returns:
The distance between p0 and p1
Parameters:
p0  first point
p1  second point

template<unsigned char n>
bool isNormalized const Vecnf< n > &  v  )  [related]
 

Test if a vector is normalized. A vector is normalized if its length is one.

Returns:
true if the vector is normalized, otherwise false
Parameters:
v  vector to test

template<unsigned char n>
bool isNull const Vecnf< n > &  v  )  [related]
 

Test if a vector is a null vector. A vector is a null vector if its length is zero.

Returns:
true if the vector is a null vector, otherwise false
Parameters:
v  vector to test

template<unsigned char n>
float length const Vecnf< n > &  v  )  [related]
 

Calculate the length of a vector.

Returns:
length of v
Parameters:
v  vector to get length of

template<unsigned char n>
float lengthSquared const Vecnf< n > &  v  )  [related]
 

Calculate the squared length of a vector.

Returns:
squared length of v
Parameters:
v  vector to get squared length of

template<unsigned char n>
float maxElement const Vecnf< n > &  v  )  [related]
 

Get the maximal absolute value of a vector.

Returns:
maximal element of v
Parameters:
v  vector to get maximal element of

template<unsigned char n>
float minElement const Vecnf< n > &  v  )  [related]
 

Get the minimal element of a vector.

Returns:
minimal element of v
Parameters:
v  vector to get maximal element of

template<unsigned char n>
Vecnf< n > operator * float  f,
const Vecnf< n > &  v
[related]
 

Multiplication of a scalar with a vector.

Returns:
product of f with v
Parameters:
f  scalar to multiply with
v  vector to multiply


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:20:40 2005 for NVSGSDK by NVIDIA