Path Tracer
Public Member Functions | Protected Attributes | List of all members
DoubleVec3D Class Reference

A three-dimensional vector using double values. More...

#include <DoubleVec3D.h>

Inheritance diagram for DoubleVec3D:
[legend]

Public Member Functions

 DoubleVec3D (double val=0)
 Default constructor. Gives all coordinates the same value. More...
 
 DoubleVec3D (double x, double y, double z)
 Main constructor. More...
 
 DoubleVec3D (const DoubleVec3D &vec)
 Copy constructor. More...
 
 DoubleVec3D (const FbxDouble3 &vec)
 Converting constructor for FbxDouble3. More...
 
 DoubleVec3D (const FbxDouble4 &vec)
 Converting constructor for FbxDouble4. More...
 
double getX () const
 Getter for the first coordinate. More...
 
double getY () const
 Getter for the second coordinate. More...
 
double getZ () const
 Getter for the third coordinate. More...
 
virtual void setVals (double x, double y, double z)
 Setter for all coordinates. More...
 
void operator+= (const DoubleVec3D &vec)
 Sum operator. More...
 
void operator-= (const DoubleVec3D &vec)
 Difference operator. More...
 
void operator*= (const double &val)
 Multiplication by a scalar operator. More...
 
void operator/= (const double &val)
 Division by a scalar operator. More...
 
void normalise ()
 Normalises the vector. More...
 
bool isNormalised () const
 Returns whether the vector is normalised. More...
 
bool isZero () const
 Returns whether the vector has a length of zero. More...
 

Protected Attributes

bool normalised
 Stores whether the vector was normalised. More...
 

Detailed Description

A three-dimensional vector using double values.

Constructor & Destructor Documentation

◆ DoubleVec3D() [1/5]

DoubleVec3D::DoubleVec3D ( double  val = 0)

Default constructor. Gives all coordinates the same value.

Parameters
valThe value of all the coordinates.
See also
DoubleVec3D::DoubleVec3D(double x, double y, double z)

◆ DoubleVec3D() [2/5]

DoubleVec3D::DoubleVec3D ( double  x,
double  y,
double  z 
)

Main constructor.

Parameters
xThe value of the first coordinate.
yThe value of the second coordinate.
zThe value of the third coordinate.
See also
DoubleVec3D::DoubleVec3D(double val)

◆ DoubleVec3D() [3/5]

DoubleVec3D::DoubleVec3D ( const DoubleVec3D vec)

Copy constructor.

Parameters
vecThe vector that will be copied.

◆ DoubleVec3D() [4/5]

DoubleVec3D::DoubleVec3D ( const FbxDouble3 &  vec)

Converting constructor for FbxDouble3.

Parameters
vecThe FbxDouble3 vector (from the FBX SDK library) that will be converted.
See also
DoubleVec3D::DoubleVec3D(const FbxDouble4& vec)

◆ DoubleVec3D() [5/5]

DoubleVec3D::DoubleVec3D ( const FbxDouble4 &  vec)

Converting constructor for FbxDouble4.

Parameters
vecThe FbxDouble4 vector (from the FBX SDK library) that will be converted.
See also
DoubleVec3D::DoubleVec3D(const FbxDouble3& vec)

Member Function Documentation

◆ getX()

double DoubleVec3D::getX ( ) const

Getter for the first coordinate.

Returns
The first coordinate of this vector.
See also
DoubleVec3D::getY(), DoubleVec3D::getZ(), DoubleVec3D::setVals()

◆ getY()

double DoubleVec3D::getY ( ) const

Getter for the second coordinate.

Returns
The second coordinate of this vector.
See also
DoubleVec3D::getX(), DoubleVec3D::getZ(), DoubleVec3D::setVals()

◆ getZ()

double DoubleVec3D::getZ ( ) const

Getter for the third coordinate.

Returns
The third coordinate of this vector.
See also
DoubleVec3D::getX(), DoubleVec3D::getY(), DoubleVec3D::setVals()

◆ isNormalised()

bool DoubleVec3D::isNormalised ( ) const

Returns whether the vector is normalised.

Returns
DoubleVec3D::normalised.
See also
DoubleVec3D::normalised

◆ isZero()

bool DoubleVec3D::isZero ( ) const

Returns whether the vector has a length of zero.

Returns
False if the three coordinates are 0, true else.

◆ normalise()

void DoubleVec3D::normalise ( )

Normalises the vector.

Automatically verifies if normalised attribute is true or not. If the vector length is zero, sets it to (1, 0, 0).

◆ operator*=()

void DoubleVec3D::operator*= ( const double &  val)

Multiplication by a scalar operator.

Parameters
valThe scalar that will be used for the multiplication.
See also
operator*(const DoubleVec3D& vec, const double& val), operator*(const double& val, const DoubleVec3D& vec)

◆ operator+=()

void DoubleVec3D::operator+= ( const DoubleVec3D vec)

Sum operator.

Parameters
vecThe second vector that will be used for the sum.
See also
operator+(const DoubleVec3D& vec1, const DoubleVec3D& vec2)

◆ operator-=()

void DoubleVec3D::operator-= ( const DoubleVec3D vec)

Difference operator.

Uses the sum and unary minus operators.

Parameters
vecThe second vector that will be used for the difference.
See also
DoubleVec3D::operator+=(), operator-(const DoubleVec3D& vec)

◆ operator/=()

void DoubleVec3D::operator/= ( const double &  val)

Division by a scalar operator.

Uses the multiplication by a scalar operator.

Parameters
valThe scalar that will be used for the division.
See also
DoubleVec3D::operator*=(), operator/(const DoubleVec3D& vec, const double& val)

◆ setVals()

void DoubleVec3D::setVals ( double  x,
double  y,
double  z 
)
virtual

Setter for all coordinates.

There is not one setter by coordinate, because of the way the DoubleUnitVect3D class is defined.

Parameters
xThe first coordinate.
yThe second coordinate.
zThe third coordinate.
See also
DoubleVec3D::getX(), DoubleVec3D::getY(), DoubleVec3D::getZ()

Reimplemented in DoubleUnitVec3D.

Member Data Documentation

◆ normalised

DoubleVec3D::normalised
protected

Stores whether the vector was normalised.

This value is set to false when we change any value of the vector (even if it gives it a magnitude of 1), and is set to true when the DoubleVec3D::normalise() method is called.

See also
DoubleVec3D::normalise(), DoubleVec3D::isNormalised()

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