Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

ml7::Vector4 Class Reference

#include <Vector4.h>

List of all members.

Public Member Functions

 Vector4 (void)
 Vector4 (const Vector4 &v)
Vector4operator= (const Vector4 &v)
void swap (Vector4 &v)
 ~Vector4 (void)
 Vector4 (const float x, const float y, const float z)
 Vector4 (const float x, const float y, const float z, const float w)
 Vector4 (const float c)
const float length () const
const float lensqr () const
const Vector4 normalized () const
const Vector4 homogenized () const
const Vector4 abs () const
const float operator[] (unsigned index) const
float & operator[] (unsigned index)
const Vector4 operator- () const
const Vector4 operator+ (const Vector4 &v) const
const Vector4 operator- (const Vector4 &v) const
const Vector4 operator* (const float s) const
const Vector4 operator* (const Vector4 &v) const
const float dot (const Vector4 &v) const
const float dotsqr (const Vector4 &v) const
const float comp (const Vector4 &v) const
const Vector4 proj (const Vector4 &v) const
const Vector4 x__ () const
const Vector4 _y_ () const
const Vector4 __z () const
const Vector4 xy_ () const
const Vector4 x_z () const
const Vector4 _yz () const
const Vector4 xxx () const
const Vector4 yyy () const
const Vector4 zzz () const
Vector4operator+= (const Vector4 &v)
Vector4operator-= (const Vector4 &v)
Vector4operator*= (const float s)
Vector4operator*= (const Vector4 &v)
Vector4clear ()
Vector4invert ()
Vector4normalize ()
Vector4homogenize ()
Vector4add (const Vector4 &v, const float s)
Vector4mad (const float s, const Vector4 &v)
Vector4mul (const Vector4 &v)
const bool operator== (const Vector4 &v) const
const bool operator!= (const Vector4 &v) const
const bool operator< (const Vector4 &v) const
const bool operator> (const Vector4 &v) const
const bool operator<= (const Vector4 &v) const
const bool operator>= (const Vector4 &v) const
 operator const float *const () const
 operator float *const ()

Static Public Member Functions

static Vector4 abs1 (const Vector4 &v)
static Vector4 min2 (const Vector4 &a, const Vector4 &b)
static Vector4 max2 (const Vector4 &a, const Vector4 &b)

Public Attributes

union {
   struct {
      float   x
      float   y
      float   z
      float   w
   } 
   float   data [4]
}; 

Static Public Attributes

static const Vector4 X = Vector4( 1, 0, 0 )
static const Vector4 Y = Vector4( 0, 1, 0 )
static const Vector4 Z = Vector4( 0, 0, 1 )

Detailed Description

Represents a homogeneous vector with four dimensions x, y, z and w. Used for 3d-graphics.


Constructor & Destructor Documentation

ml7::Vector4::Vector4 ( void   )  [inline]

Default constructor. Creates a new vector with x = y = z = 0 and w = 1.

ml7::Vector4::Vector4 ( const Vector4 v  )  [inline]

Copy constructor. Creates a new vector with x = v.x, ... , w = v.w.

ml7::Vector4::~Vector4 ( void   )  [inline]

Destructor.

ml7::Vector4::Vector4 ( const float  x,
const float  y,
const float  z 
) [inline]

Explicit constructor with parameters for x, y and z.

ml7::Vector4::Vector4 ( const float  x,
const float  y,
const float  z,
const float  w 
) [inline]

Explicit constructor with parameters for x, y, z and w.

ml7::Vector4::Vector4 ( const float  c  )  [inline, explicit]

Explicit constructor with one parameter for the components x, y and z. Sets w = 1.


Member Function Documentation

const Vector4 ml7::Vector4::__z (  )  const [inline]

Returns a new vector with the z component of this (x = y = 0, w = 1).

const Vector4 ml7::Vector4::_y_ (  )  const [inline]

Returns a new vector with the y component of this (x = z = 0, w = 1).

const Vector4 ml7::Vector4::_yz (  )  const [inline]

Returns a new vector with the z component of this (x = y = 0, w = 1).

const Vector4 ml7::Vector4::abs (  )  const [inline]

Returns this vector having positive components.

static Vector4 ml7::Vector4::abs1 ( const Vector4 v  )  [inline, static]

Returns a copy of a given vector having positive components.

Vector4& ml7::Vector4::add ( const Vector4 v,
const float  s 
) [inline]

Adds a given vector v scaled by a given scalar s to this.

Vector4& ml7::Vector4::clear (  )  [inline]

Sets x = y = z = 0 and w = 1.

const float ml7::Vector4::comp ( const Vector4 v  )  const [inline]

Returns the scalar projection of a given vector v onto this.

const float ml7::Vector4::dot ( const Vector4 v  )  const [inline]

Returns the dot product of this and a given vector v.

const float ml7::Vector4::dotsqr ( const Vector4 v  )  const [inline]

Returns the squared dot product of this and a given vector v.

Vector4& ml7::Vector4::homogenize (  )  [inline]

Homogenizes this vector that its w component has a value of 1.

const Vector4 ml7::Vector4::homogenized (  )  const [inline]

Returns a copy of this vector homogenized.

Vector4& ml7::Vector4::invert (  )  [inline]

Inverts the sign of the components of this vector.

const float ml7::Vector4::length (  )  const [inline]

Returns the magnitude of the vector.

const float ml7::Vector4::lensqr (  )  const [inline]

Returns the squared magnitude of the vector.

Vector4& ml7::Vector4::mad ( const float  s,
const Vector4 v 
) [inline]

Scales this vector by a given scalar s and then adds a given vector v to this.

static Vector4 ml7::Vector4::max2 ( const Vector4 a,
const Vector4 b 
) [inline, static]

Returns a vector having the maximum components of two given vectors.

static Vector4 ml7::Vector4::min2 ( const Vector4 a,
const Vector4 b 
) [inline, static]

Returns a vector having the minimum components of two given vectors.

Vector4& ml7::Vector4::mul ( const Vector4 v  )  [inline]

Scales this vector component-wise by a given vector v.

Vector4& ml7::Vector4::normalize (  )  [inline]

Normalizes this vector that it has a magnitude of 1.

const Vector4 ml7::Vector4::normalized (  )  const [inline]

Returns a copy of this vector normalized.

ml7::Vector4::operator const float *const (  )  const [inline]
ml7::Vector4::operator float *const (  )  [inline]
const bool ml7::Vector4::operator!= ( const Vector4 v  )  const [inline]

Checks if a given vector v and this have non-identical components.

const Vector4 ml7::Vector4::operator* ( const Vector4 v  )  const [inline]

Returns a given vector scaled component-wise by this.

const Vector4 ml7::Vector4::operator* ( const float  s  )  const [inline]

Returns a copy of this vector scaled by a given scalar s.

Vector4& ml7::Vector4::operator*= ( const float  s  )  [inline]

Scales this vector by a given scalar s.

Vector4& ml7::Vector4::operator*= ( const Vector4 v  )  [inline]

Scales this vector component-wise by a given vector v.

const Vector4 ml7::Vector4::operator+ ( const Vector4 v  )  const [inline]

Returns a given vector v added to this.

Vector4& ml7::Vector4::operator+= ( const Vector4 v  )  [inline]

Adds a given vector v to this.

const Vector4 ml7::Vector4::operator- ( const Vector4 v  )  const [inline]

Returns a given vector v subtracted from this.

const Vector4 ml7::Vector4::operator- (  )  const [inline]

Returns a copy of this vector with the components having signs flipped.

Vector4& ml7::Vector4::operator-= ( const Vector4 v  )  [inline]

Subtracts a given vector v from this.

const bool ml7::Vector4::operator< ( const Vector4 v  )  const [inline]

Checks if this vector is component-by-component less than a given vector v.

const bool ml7::Vector4::operator<= ( const Vector4 v  )  const [inline]

Checks if this vector is component-by-component less than or equal to a given vector v.

Vector4& ml7::Vector4::operator= ( const Vector4 v  )  [inline]

Copy assignment operator. Sets x = v.x, ... , w = v.w.

const bool ml7::Vector4::operator== ( const Vector4 v  )  const [inline]

Checks if a given vector v and this have identical components.

const bool ml7::Vector4::operator> ( const Vector4 v  )  const [inline]

Checks if this vector is component-by-component greater than a given vector v.

const bool ml7::Vector4::operator>= ( const Vector4 v  )  const [inline]

Checks if this vector is component-by-component greater than or equal to a given vector v.

float& ml7::Vector4::operator[] ( unsigned  index  )  [inline]

Indexed component access.

const float ml7::Vector4::operator[] ( unsigned  index  )  const [inline]

Indexed component access.

const Vector4 ml7::Vector4::proj ( const Vector4 v  )  const [inline]

Returns the vector projection of a given vector v onto this.

void ml7::Vector4::swap ( Vector4 v  )  [inline]

Swap operation. Swaps the elements of a vector v with this.

const Vector4 ml7::Vector4::x__ (  )  const [inline]

Returns a new vector with the x component of this (y = z = 0, w = 1).

const Vector4 ml7::Vector4::x_z (  )  const [inline]

Returns a new vector with the y component of this (x = z = 0, w = 1).

const Vector4 ml7::Vector4::xxx (  )  const [inline]

Returns a new vector with x, y and z components set to the x value of this.

const Vector4 ml7::Vector4::xy_ (  )  const [inline]

Returns a new vector with the x component of this (y = z = 0, w = 1).

const Vector4 ml7::Vector4::yyy (  )  const [inline]

Returns a new vector with x, y and z components set to the y value of this.

const Vector4 ml7::Vector4::zzz (  )  const [inline]

Returns a new vector with x, y and z components set to the y value of this.


Member Data Documentation

union { ... }

Array of all four componets.

The vector's w value.

The vector's x value.

const Vector4 ml7::Vector4::X = Vector4( 1, 0, 0 ) [static]

The vector's y value.

const Vector4 ml7::Vector4::Y = Vector4( 0, 1, 0 ) [static]

The vector's z value.

const Vector4 ml7::Vector4::Z = Vector4( 0, 0, 1 ) [static]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines