Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::Vector3D Class Reference

#include <Vector3D.h>

Public Member Functions

 Vector3D ()
 
 Vector3D (float x, float y, float z)
 
 Vector3D (const Vector3D &v)
 
void Add (const Vector3D &v1, const Vector3D &v2)
 
void Subtract (const Vector3D &v1, const Vector3D &v2)
 
void Multiply (const Vector3D &v1, const Vector3D &v2)
 
void Divide (const Vector3D &v1, const Vector3D &v2)
 
void Add (const Vector3D &v1, const float f)
 
void Subtract (const Vector3D &v1, const float f)
 
void Multiply (const Vector3D &v1, const float f)
 
void Divide (const Vector3D &v1, const float f)
 
void operator= (const Vector3D &v)
 
void operator+= (const Vector3D &v)
 
void operator-= (const Vector3D &v)
 
void operator/= (const Vector3D &v)
 
void operator*= (const Vector3D &v)
 
Vector3D operator+ (const Vector3D &v) const
 
Vector3D operator- (const Vector3D &v) const
 
Vector3D operator/ (const Vector3D &v) const
 
Vector3D operator* (const Vector3D &v) const
 
Vector3D operator+ (const float &f) const
 
Vector3D operator- (const float &f) const
 
Vector3D operator/ (const float &f) const
 
Vector3D operator* (const float &f) const
 
void Negate ()
 
float Dot3 (const Vector3D &v) const
 
float Magnitude () const
 
void Normalize ()
 
void Normalize (const Vector3D &p1, const Vector3D &p2, const Vector3D &p3)
 
Vector3D CrossProduct (const Vector3D &v) const
 

Public Attributes

float x
 
float y
 
float z
 

Detailed Description

Vector with 3 components (x,y,z).

Constructor & Destructor Documentation

◆ Vector3D() [1/3]

Ult::Vector3D::Vector3D ( )

Vector3D constructor. Sets x=y=z=0.

◆ Vector3D() [2/3]

Ult::Vector3D::Vector3D ( float x,
float y,
float z )

Vector3D constructor from input values.

◆ Vector3D() [3/3]

Ult::Vector3D::Vector3D ( const Vector3D & v)

Vector3D copy constructor.

Member Function Documentation

◆ Add() [1/2]

void Ult::Vector3D::Add ( const Vector3D & v1,
const float f )

Sets this vector to the scalar addition of v1 and f.

◆ Add() [2/2]

void Ult::Vector3D::Add ( const Vector3D & v1,
const Vector3D & v2 )

Sets this vector to the addition of v1 and v2.

◆ CrossProduct()

Vector3D Ult::Vector3D::CrossProduct ( const Vector3D & v) const

Returns the cross product of this vector and v.

◆ Divide() [1/2]

void Ult::Vector3D::Divide ( const Vector3D & v1,
const float f )

Sets this vector to the scalar division of v1 and f.

◆ Divide() [2/2]

void Ult::Vector3D::Divide ( const Vector3D & v1,
const Vector3D & v2 )

Sets this vector to the element-wise division of v1 and v2.

◆ Dot3()

float Ult::Vector3D::Dot3 ( const Vector3D & v) const

Returns the dot product of this vector and v.

◆ Magnitude()

float Ult::Vector3D::Magnitude ( ) const

Returns the magnitude of this vector.

◆ Multiply() [1/2]

void Ult::Vector3D::Multiply ( const Vector3D & v1,
const float f )

Sets this vector to the scalar multiplication of v1 and f.

◆ Multiply() [2/2]

void Ult::Vector3D::Multiply ( const Vector3D & v1,
const Vector3D & v2 )

Sets this vector to the element-wise multiplication of v1 and v2.

◆ Negate()

void Ult::Vector3D::Negate ( )

Sets this vector to -x,-y,-z.

◆ Normalize() [1/2]

void Ult::Vector3D::Normalize ( )

Normalizes this vector.

◆ Normalize() [2/2]

void Ult::Vector3D::Normalize ( const Vector3D & p1,
const Vector3D & p2,
const Vector3D & p3 )

Sets this vector to the normal of the triangle made up of p1,p2,p3.

◆ operator*() [1/2]

Vector3D Ult::Vector3D::operator* ( const float & f) const

Returns the scalar multiplication of this vector and f.

◆ operator*() [2/2]

Vector3D Ult::Vector3D::operator* ( const Vector3D & v) const

Returns the element-wise multiplication of this vector and v.

◆ operator*=()

void Ult::Vector3D::operator*= ( const Vector3D & v)

Multiplies this vector element-wise by v.

◆ operator+() [1/2]

Vector3D Ult::Vector3D::operator+ ( const float & f) const

Returns the scalar addition of this vector and f.

◆ operator+() [2/2]

Vector3D Ult::Vector3D::operator+ ( const Vector3D & v) const

Returns the sum of this vector and v.

◆ operator+=()

void Ult::Vector3D::operator+= ( const Vector3D & v)

Adds v to this vector.

◆ operator-() [1/2]

Vector3D Ult::Vector3D::operator- ( const float & f) const

Returns the scalar subtraction of this vector and f.

◆ operator-() [2/2]

Vector3D Ult::Vector3D::operator- ( const Vector3D & v) const

Returns the difference of this vector and v.

◆ operator-=()

void Ult::Vector3D::operator-= ( const Vector3D & v)

Subtracts v from this vector.

◆ operator/() [1/2]

Vector3D Ult::Vector3D::operator/ ( const float & f) const

Returns the scalar division of this vector and f.

◆ operator/() [2/2]

Vector3D Ult::Vector3D::operator/ ( const Vector3D & v) const

Returns the element-wise division of this vector and v.

◆ operator/=()

void Ult::Vector3D::operator/= ( const Vector3D & v)

Divides this vector element-wise by v.

◆ operator=()

void Ult::Vector3D::operator= ( const Vector3D & v)

Sets this vector equal to v.

◆ Subtract() [1/2]

void Ult::Vector3D::Subtract ( const Vector3D & v1,
const float f )

Sets this vector to the scalar subtraction of v1 and f.

◆ Subtract() [2/2]

void Ult::Vector3D::Subtract ( const Vector3D & v1,
const Vector3D & v2 )

Sets this vector to the subtraction of v1 and v2.

Member Data Documentation

◆ x

float Ult::Vector3D::x

The 3 components of this vector.

◆ y

float Ult::Vector3D::y

◆ z

float Ult::Vector3D::z

The documentation for this class was generated from the following files: