Vec3f Class Reference

#include <Vec3f.h>

List of all members.

Public Member Functions

 Vec3f ()
 Vec3f (float x, float y, float z)
 Vec3f (float f)
void setX (float newx)
float x () const
void setY (float newy)
float y () const
void z (float newz)
float z () const
float operator[] (int i) const
Vec3foperator= (const Vec3f &b)
int maxDim () const
void setMin (const Vec3f &other)
void setMax (const Vec3f &other)
float dot (const Vec3f &b) const
Vec3f cross (const Vec3f &b) const
Vec3f fabs () const
float length () const
Vec3f normal () const
void normalize ()
Vec3f operator- () const
void operator *= (float f)
void scale (const Vec3f &w)
Vec3f scaled (const Vec3f &w) const
void operator/= (float f)
Vec3f operator+ (const Vec3f &b) const
Vec3foperator+= (const Vec3f &b)
Vec3f operator- (const Vec3f &b) const
Vec3foperator-= (const Vec3f &b)
Vec3f reciprocal ()
bool operator== (const Vec3f &v) const
bool operator!= (const Vec3f &v) const

Private Attributes

float mValues [3]

Friends

Vec3f min (const Vec3f &a, const Vec3f &b)
Vec3f max (const Vec3f &a, const Vec3f &b)
Vec3f operator * (const Vec3f &w, float f)
Vec3f operator * (float f, const Vec3f &w)
Vec3f operator/ (const Vec3f &w, float f)
std::ostream & operator<< (std::ostream &o, const Vec3f &w)
std::istream & operator>> (std::istream &i, Vec3f &w)


Detailed Description

A 3D vector

Author:
Alex Busenius

Christian Engels

Definition at line 18 of file Vec3f.h.


Constructor & Destructor Documentation

Vec3f::Vec3f (  )  [inline]

Definition at line 30 of file Vec3f.h.

References mValues.

Referenced by cross(), fabs(), operator+(), operator-(), reciprocal(), and scaled().

Vec3f::Vec3f ( float  x,
float  y,
float  z 
) [inline]

Definition at line 35 of file Vec3f.h.

References mValues.

Vec3f::Vec3f ( float  f  )  [inline]

Definition at line 42 of file Vec3f.h.

References mValues.


Member Function Documentation

void Vec3f::setX ( float  newx  )  [inline]

set the x coordinate

Definition at line 50 of file Vec3f.h.

References mValues.

Referenced by Sphere::axes().

float Vec3f::x (  )  const [inline]

get the x coordinate

Definition at line 56 of file Vec3f.h.

References mValues.

Referenced by Sphere::axes(), BilliardPhysics::BilliardPhysics(), BorderCollision::collide(), Sphere::intersect(), Box::intersect(), lerp(), Matrix::Matrix(), RGBAColor::RGBAColor(), WoodShader::shade(), Box::split(), and BilliardPhysics::willHitBorder().

void Vec3f::setY ( float  newy  )  [inline]

set the y coordinate

Definition at line 62 of file Vec3f.h.

References mValues.

float Vec3f::y (  )  const [inline]

get the y coordinate

Definition at line 68 of file Vec3f.h.

References mValues.

Referenced by Sphere::axes(), Sphere::intersect(), Box::intersect(), lerp(), Matrix::Matrix(), RGBAColor::RGBAColor(), WoodShader::shade(), and Box::split().

void Vec3f::z ( float  newz  )  [inline]

set the z coordinate

Definition at line 74 of file Vec3f.h.

References mValues.

Referenced by Sphere::axes(), BilliardPhysics::BilliardPhysics(), BorderCollision::collide(), Sphere::intersect(), Box::intersect(), lerp(), Matrix::Matrix(), RGBAColor::RGBAColor(), WoodShader::shade(), Box::split(), and BilliardPhysics::willHitBorder().

float Vec3f::z (  )  const [inline]

get the z coordinate

Definition at line 80 of file Vec3f.h.

References mValues.

float Vec3f::operator[] ( int  i  )  const [inline]

get a the apropiate coordinate (0=x, 1=y, 2=z)

Definition at line 86 of file Vec3f.h.

References mValues.

Vec3f& Vec3f::operator= ( const Vec3f b  )  [inline]

Definition at line 91 of file Vec3f.h.

References mValues.

int Vec3f::maxDim (  )  const [inline]

get the maximum dimension the vector has (how many of the values are not 0

Definition at line 103 of file Vec3f.h.

References mValues.

void Vec3f::setMin ( const Vec3f other  )  [inline]

set every coordinate to the minimum of the coordinate of this vector and the other

Definition at line 109 of file Vec3f.h.

References min(), and mValues.

void Vec3f::setMax ( const Vec3f other  )  [inline]

set every coordinate to the maximum of the coordinate of this vector and the other

Definition at line 117 of file Vec3f.h.

References max(), and mValues.

float Vec3f::dot ( const Vec3f b  )  const [inline]

dot product

Definition at line 125 of file Vec3f.h.

References mValues.

Referenced by BorderCollision::collide(), BallCollision::collide(), CookTorranceShader::distribution(), CameraInstructionMove::execute(), CookTorranceShader::fresnel(), CookTorranceShader::geometry(), QuadAreaLight::illuminate(), Triangle::intersect(), Sphere::intersect(), InfinitePlane::intersect(), RefractiveShader::shade(), PhongShader::shade(), MirrorShader::shade(), CookTorranceShader::shade(), PhysicalObject::updateProperties(), and BilliardPhysics::willCollide().

Vec3f Vec3f::cross ( const Vec3f b  )  const [inline]

vector product

Definition at line 131 of file Vec3f.h.

References mValues, and Vec3f().

Referenced by Sphere::axes(), BallCollision::collide(), DepthOfFieldCamera::DepthOfFieldCamera(), CameraInstructionMove::execute(), Triangle::intersect(), Triangle::normal(), PerspectiveCamera::PerspectiveCamera(), QuadAreaLight::QuadAreaLight(), PerspectiveCamera::setDir(), DepthOfFieldCamera::setDir(), PerspectiveCamera::setUp(), DepthOfFieldCamera::setUp(), and PhysicalObject::updateProperties().

Vec3f Vec3f::fabs (  )  const [inline]

absolute value of the vector

Definition at line 139 of file Vec3f.h.

References mValues, and Vec3f().

Referenced by operator==(), DebugShader::shade(), and TableBorder::TableBorder().

float Vec3f::length (  )  const [inline]

the length of the vector

Definition at line 145 of file Vec3f.h.

Referenced by BorderCollision::collide(), BallCollision::collide(), QuadAreaLight::illuminate(), PointLight::illuminate(), normal(), normalize(), operator *(), QuadAreaLight::QuadAreaLight(), PhysicalObject::rotate(), PhysicalObject::updateProperties(), and BilliardPhysics::willCollide().

Vec3f Vec3f::normal (  )  const [inline]

Returns:
a normalized version of this vector

Definition at line 151 of file Vec3f.h.

References EPSILON, and length().

Referenced by Triangle::axes(), Sphere::axes(), BallCollision::collide(), DepthOfFieldCamera::DepthOfFieldCamera(), CameraInstructionMove::execute(), Ray::init(), Matrix::Matrix(), Triangle::normal(), Sphere::normal(), Shader::normal(), PerspectiveCamera::PerspectiveCamera(), PhysicalObject::rotate(), PerspectiveCamera::setDir(), DepthOfFieldCamera::setDir(), PerspectiveCamera::setUp(), DepthOfFieldCamera::setUp(), and PhysicalObject::updateProperties().

void Vec3f::normalize (  )  [inline]

normalize this vector

Definition at line 158 of file Vec3f.h.

References EPSILON, and length().

Referenced by BallCollision::collide(), DepthOfFieldCamera::DepthOfFieldCamera(), QuadAreaLight::illuminate(), PointLight::illuminate(), DepthOfFieldCamera::initRay(), PerspectiveCamera::PerspectiveCamera(), QuadAreaLight::QuadAreaLight(), PerspectiveCamera::setDir(), DepthOfFieldCamera::setDir(), TexturedSmoothTriangle::setNormals(), PerspectiveCamera::setUp(), DepthOfFieldCamera::setUp(), and TexturedSmoothTriangle::TexturedSmoothTriangle().

Vec3f Vec3f::operator- (  )  const [inline]

unary -

Definition at line 165 of file Vec3f.h.

References mValues, and Vec3f().

void Vec3f::operator *= ( float  f  )  [inline]

scale and assign

Definition at line 171 of file Vec3f.h.

References mValues.

void Vec3f::scale ( const Vec3f w  )  [inline]

scale this vector component-wise with the other vector

Definition at line 179 of file Vec3f.h.

References mValues.

Vec3f Vec3f::scaled ( const Vec3f w  )  const [inline]

Returns:
a component-wise scale of this vector

Definition at line 187 of file Vec3f.h.

References mValues, and Vec3f().

Referenced by CookTorranceShader::shade(), and PhysicalObject::updateProperties().

void Vec3f::operator/= ( float  f  )  [inline]

scale by reciprocal and assign

Definition at line 195 of file Vec3f.h.

Vec3f Vec3f::operator+ ( const Vec3f b  )  const [inline]

add vectors

Definition at line 201 of file Vec3f.h.

References mValues, and Vec3f().

Vec3f& Vec3f::operator+= ( const Vec3f b  )  [inline]

add and assign

Definition at line 207 of file Vec3f.h.

References mValues.

Vec3f Vec3f::operator- ( const Vec3f b  )  const [inline]

substract vektors

Definition at line 216 of file Vec3f.h.

References mValues, and Vec3f().

Vec3f& Vec3f::operator-= ( const Vec3f b  )  [inline]

substract and assign

Definition at line 222 of file Vec3f.h.

References mValues.

Vec3f Vec3f::reciprocal (  )  [inline]

Returns:
a component-wise reciprocaled version of this vector (1.0f/vector)

Definition at line 231 of file Vec3f.h.

References mValues, and Vec3f().

bool Vec3f::operator== ( const Vec3f v  )  const [inline]

Comparision operator

Definition at line 238 of file Vec3f.h.

References EPSILON, fabs(), and mValues.

bool Vec3f::operator!= ( const Vec3f v  )  const [inline]

Inequality comparision

Definition at line 248 of file Vec3f.h.


Friends And Related Function Documentation

Vec3f min ( const Vec3f a,
const Vec3f b 
) [friend]

component wise minimum of the vectors

Definition at line 259 of file Vec3f.h.

Vec3f max ( const Vec3f a,
const Vec3f b 
) [friend]

component wise maximum of the vectors

Definition at line 267 of file Vec3f.h.

Vec3f operator * ( const Vec3f w,
float  f 
) [friend]

scale vector

Definition at line 275 of file Vec3f.h.

Vec3f operator * ( float  f,
const Vec3f w 
) [friend]

scale vector

Definition at line 281 of file Vec3f.h.

Vec3f operator/ ( const Vec3f w,
float  f 
) [friend]

scale by reciprocal

Definition at line 287 of file Vec3f.h.

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

write to output stream

Definition at line 11 of file Vec3f.cpp.

std::istream& operator>> ( std::istream &  i,
Vec3f w 
) [friend]

read from input stream

Definition at line 22 of file Vec3f.cpp.


Member Data Documentation

float Vec3f::mValues[3] [private]

Definition at line 254 of file Vec3f.h.

Referenced by cross(), dot(), fabs(), max(), maxDim(), min(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator<<(), operator=(), operator==(), operator[](), reciprocal(), scale(), scaled(), setMax(), setMin(), setX(), setY(), Vec3f(), x(), y(), and z().


The documentation for this class was generated from the following file:
Generated on Fri Feb 1 00:02:34 2008 for Grayfall by  doxygen 1.5.1