Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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:

Inheritance graph
[legend]
List of all members.

Public Methods

 Vecnf (void)
 Default constructor. More...

 Vecnf (const Vecnf< n > &v)
 Copy constructor. More...

float & operator[] (size_t i)
 Non-constant subscript operator. More...

const float & operator[] (size_t i) const
 Constant subscript operator. More...

Vecnf< n > operator- (void) const
 Negation operator. More...

Vecnf< n > operator * (float f) const
 Vector multiplication with a scalar operator. More...

float operator * (const Vecnf< n > &v) const
 Vector multiplication with a vector (i.e. dot product) operator. More...

Vecnf< n > operator/ (float f) const
 Vector division by a scalar operator. More...

Vecnf< n > operator+ (const Vecnf< n > &v) const
 Vector addition operator. More...

Vecnf< n > operator- (const Vecnf< n > &v) const
 Vector subtraction operator. More...

bool operator== (const Vecnf< n > &v) const
 Equality operator. More...

bool operator!= (const Vecnf< n > &v) const
 Inequality operator. More...

Vecnf< n > & operator= (const Vecnf< n > &v)
 Assignment operator. More...

Vecnf< n > & operator *= (float f)
 Vector multiplication with a scalar and assignment operator. More...

Vecnf< n > & operator/= (float f)
 Vector division by a scalar and assignment operator. More...

Vecnf< n > & operator+= (const Vecnf< n > &v)
 Vector addition and assignment operator. More...

Vecnf< n > & operator-= (const Vecnf< n > &v)
 Vector subtraction and assignment operator. More...

const float * getPtr (void) const
 Get a constant pointer to the floats of the vector. More...

float normalize (void)
 Normalize the vector and return the previous length. More...

void orthogonalize (const Vecnf< n > &v)
 Orthogonolize the vector with respect to a vector. More...

void orthonormalize (const Vecnf< n > &v)
 Orthonormalize the vector with respect to an other. More...


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:23 2005 for NVSGSDK by NVIDIA