DD::Image::Vector3 Class Reference

List of all members.

Public Member Functions

float & operator[] (int i)
const float & operator[] (int i) const
const float * array () const
 Vector3 (const float v[3])
 Vector3 (const double v[3])
 Vector3 (float a, float b, float c)
void set (float a, float b, float c)
Vector3 operator* (float d) const
Vector3operator*= (float d)
Vector3 operator* (double d) const
Vector3operator*= (double d)
Vector3 operator/ (float d) const
Vector3operator/= (float d)
Vector3 operator* (const Vector3 &v) const
Vector3operator*= (const Vector3 &v)
Vector3 operator/ (const Vector3 &v) const
Vector3operator/= (const Vector3 &v)
Vector3 operator+ (const Vector3 &v) const
Vector3operator+= (const Vector3 &v)
Vector3 operator- (const Vector3 &v) const
Vector3operator-= (const Vector3 &v)
Vector3 operator- () const
bool operator== (const Vector3 &v) const
bool operator!= (const Vector3 &v) const
bool operator== (float d) const
bool operator!= (float d) const
bool operator< (const Vector3 &v) const
 Fairly arbitrary operator so you can store these in ordered arrays.
float length () const
float lengthSquared () const
 Same as this dot this, length() squared.
float distanceBetween (const Vector3 &v) const
float distanceSquared (const Vector3 &v) const
float dot (const Vector3 &v) const
Vector3 cross (const Vector3 &v) const
float normalize ()
float fast_normalize ()
void negate ()
float distanceFromPlane (float A, float B, float C, float D) const
Vector3 reflect (const Vector3 &N)
Vector3 minimum (const Vector3 &a) const
Vector3 maximum (const Vector3 &a) const
void append (Hash &) const

Public Attributes

float x
float y
float z

Friends

std::ostream & operator<< (std::ostream &o, const Vector3 &)

Detailed Description

3-component vector, used to represent a point or distance in 3D space.

This object is in general compatible with the SbVec3 template in the Inventor library. However it allows direct access to the x,y,z members, which imho makes math using this much easier to read.


Constructor & Destructor Documentation

DD::Image::Vector3::Vector3 ( const float  v[3]) [inline]

Constructor from an array of numbers.

DD::Image::Vector3::Vector3 ( const double  v[3]) [inline]

Constructor from an array of numbers.

DD::Image::Vector3::Vector3 ( float  a,
float  b,
float  c 
) [inline]

Constructor that sets all 4 numbers


Member Function Documentation

float& DD::Image::Vector3::operator[] ( int  i) [inline]

vector[0] is x, vector[1] is y, vector[2] is z.

const float& DD::Image::Vector3::operator[] ( int  i) const [inline]

vector[0] is x, vector[1] is y, vector[2] is z.

const float* DD::Image::Vector3::array ( ) const [inline]
void DD::Image::Vector3::set ( float  a,
float  b,
float  c 
) [inline]
Vector3 DD::Image::Vector3::operator* ( float  d) const [inline]

Multiplies all 3 numbers. This will scale the length().

Vector3 DD::Image::Vector3::operator/ ( float  d) const [inline]

Divides all 3 numbers. This will scale the length().

Vector3 DD::Image::Vector3::operator* ( const Vector3 v) const [inline]

Component-wise multiplication, useful for colors.

Vector3 DD::Image::Vector3::operator/ ( const Vector3 v) const [inline]

Component-wise division, useful for colors.

Vector3 DD::Image::Vector3::operator+ ( const Vector3 v) const [inline]

Addition

Vector3 DD::Image::Vector3::operator- ( const Vector3 v) const [inline]

Subtraction

float DD::Image::Vector3::length ( ) const [inline]
float DD::Image::Vector3::distanceBetween ( const Vector3 v) const [inline]

Same as (this-v).length()

float DD::Image::Vector3::distanceSquared ( const Vector3 v) const [inline]

Same as (this-v).lengthSquared()

float DD::Image::Vector3::dot ( const Vector3 v) const [inline]
Vector3 DD::Image::Vector3::cross ( const Vector3 v) const [inline]

Cross product. This is a vector at right angles to the vectors with a length equal to the product of the lengths.

Referenced by DD::Image::Plane::Plane(), and DD::Image::Quaternion::Quaternion().

float DD::Image::Vector3::fast_normalize ( ) [inline]

Uwe Behrens' fast-normalize method. Approximate normalization, returns approximate length.

Referenced by DD::Image::Primitive::draw_normal(), DD::Image::LightOp::get_L_vector(), DD::Image::ComplexLightOp::get_L_vector(), and DD::Image::Mesh::validate().

void DD::Image::Vector3::negate ( ) [inline]

Modifies it in-place, does not return the new value.

void Vector3::append ( Hash hash) const

Add this to the Hash object.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const Vector3  
) [friend]

Writes it in nuke/tcl notation, with nested curly braces