C++ / OpenCL Raytracer
Vector3D Class Reference

#include <vector.h>

Public Member Functions

 Vector3D ()
 
 Vector3D (double e0)
 
 Vector3D (double e0, double e1, double e2)
 
double x () const
 Returns first (X) location parameter in Vector3D.
 
double y () const
 Returns second (Y) location parameter in Vector3D.
 
double z () const
 Returns third (Z) location parameter in Vector3D.
 
double r () const
 Returns first (R) color parameter in Vector3D.
 
double g () const
 Returns second (G) color parameter in Vector3D.
 
double b () const
 Returns third (B) color parameter in Vector3D.
 
const Vector3Doperator+ () const
 Add Vector3D Operator.
 
Vector3D operator- () const
 Subtract Vector3D Operator.
 
double operator[] (int i) const
 Constant Vector3D Array Operator.
 
double & operator[] (int i)
 Vector3D Array Operator.
 
Vector3Doperator+= (const Vector3D &v2)
 Add Assign Vector3D Operator.
 
Vector3Doperator-= (const Vector3D &v2)
 Subtract Assign Assign Operator.
 
Vector3Doperator *= (const Vector3D &v2)
 Multiply Assign Vector3D Operator.
 
Vector3Doperator/= (const Vector3D &v2)
 Divide Assign Vector3D Operator.
 
Vector3Doperator *= (const double t)
 Multiply Double Operator.
 
Vector3Doperator/= (const double t)
 Divide Double Operator.
 
double Length () const
 Return length (double) of Vector3D.
 
double SquaredLength () const
 Return squared length (double) of Vector3D.
 
double Dot (const Vector3D &v2)
 Return dot product (double) of two Vector3D.
 
Vector3D Cross (const Vector3D &v2)
 
void MakeUnitVector ()
 Convert Vector3D into unit vector.
 

Public Attributes

double m_dE [3]
 Value array (double) for color or location parameters.
 

Detailed Description

3 Paramater Vector3D object, operators and functions

object can be initialized with 0, 1, or 3 values.

Constructor & Destructor Documentation

◆ Vector3D() [1/3]

Vector3D::Vector3D ( )
inline

Three value object for location or color

Example:

Vector3D zero;

◆ Vector3D() [2/3]

Vector3D::Vector3D ( double  e0)
inline

Three value object for location or color

Example:

Vector3D one(1) // Vector3D one(1, 1, 1);

◆ Vector3D() [3/3]

Vector3D::Vector3D ( double  e0,
double  e1,
double  e2 
)
inline

Three value object for location or color

Example:

Vector3D three(1, 2, 3);

Member Function Documentation

◆ Cross()

Vector3D Vector3D::Cross ( const Vector3D v2)
inline

Return cross product (Vector3D) of two Vector3D


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