Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::Vector3 Class Reference

#include <Vector3.h>

Public Member Functions

float & operator[] (int i)
 
const float & operator[] (int i) const
 
const float * array () const
 
 Vector3 (const float v[3])
 
 Vector3 (const double v[3])
 
 Vector3 (float a, float b, float c)
 
void set (float a, float b, float c)
 
Vector3 operator* (float d) const
 
Vector3operator*= (float d)
 
Vector3 operator* (double d) const
 
Vector3operator*= (double d)
 
Vector3 operator/ (float d) const
 
Vector3operator/= (float d)
 
Vector3 operator* (const Vector3 &v) const
 
Vector3operator*= (const Vector3 &v)
 
Vector3 operator/ (const Vector3 &v) const
 
Vector3operator/= (const Vector3 &v)
 
Vector3 operator+ (const Vector3 &v) const
 
Vector3operator+= (const Vector3 &v)
 
Vector3 operator- (const Vector3 &v) const
 
Vector3operator-= (const Vector3 &v)
 
Vector3 operator- () const
 
bool operator== (const Vector3 &v) const
 
bool operator!= (const Vector3 &v) const
 
bool operator== (float d) const
 
bool operator!= (float d) const
 
bool operator< (const Vector3 &v) const
 Fairly arbitrary operator so you can store these in ordered arrays.
 
float length () const
 
float lengthSquared () const
 Same as this dot this, length() squared.
 
float distanceBetween (const Vector3 &v) const
 
float distanceSquared (const Vector3 &v) const
 
float dot (const Vector3 &v) const
 
Vector3 cross (const Vector3 &v) const
 
float normalize ()
 
float fast_normalize ()
 
void negate ()
 
float distanceFromPlane (float A, float B, float C, float D) const
 
Vector3 reflect (const Vector3 &N)
 
Vector3 minimum (const Vector3 &a) const
 
Vector3 maximum (const Vector3 &a) const
 
void append (Hash &) const
 

Public Attributes

float x
 
float y
 
float z
 

Friends

std::ostream & operator<< (std::ostream &o, const Vector3 &)
 

Detailed Description

3-component vector, used to represent a point or distance in 3D space.

This object is in general compatible with the SbVec3 template in the Inventor library. However it allows direct access to the x,y,z members, which imho makes math using this much easier to read.

Constructor & Destructor Documentation

◆ Vector3() [1/3]

DD::Image::Vector3::Vector3 ( const float  v[3])
inline

Constructor from an array of numbers.

◆ Vector3() [2/3]

DD::Image::Vector3::Vector3 ( const double  v[3])
inline

Constructor from an array of numbers.

◆ Vector3() [3/3]

DD::Image::Vector3::Vector3 ( float  a,
float  b,
float  c 
)
inline

Constructor that sets all 4 numbers

Member Function Documentation

◆ operator[]() [1/2]

float & DD::Image::Vector3::operator[] ( int  i)
inline

vector[0] is x, vector[1] is y, vector[2] is z.

◆ operator[]() [2/2]

const float & DD::Image::Vector3::operator[] ( int  i) const
inline

vector[0] is x, vector[1] is y, vector[2] is z.

◆ array()

◆ set()

void DD::Image::Vector3::set ( float  a,
float  b,
float  c 
)
inline

Change all of xyz.

Referenced by DD::Image::Scene::Scene(), and DD::Image::Mesh::validate().

◆ operator*() [1/2]

Vector3 DD::Image::Vector3::operator* ( float  d) const
inline

Multiplies all 3 numbers. This will scale the length().

◆ operator/() [1/2]

Vector3 DD::Image::Vector3::operator/ ( float  d) const
inline

Divides all 3 numbers. This will scale the length().

◆ operator*() [2/2]

Vector3 DD::Image::Vector3::operator* ( const Vector3 v) const
inline

Component-wise multiplication, useful for colors.

◆ operator/() [2/2]

Vector3 DD::Image::Vector3::operator/ ( const Vector3 v) const
inline

Component-wise division, useful for colors.

◆ operator+()

Vector3 DD::Image::Vector3::operator+ ( const Vector3 v) const
inline

Addition

◆ operator-()

Vector3 DD::Image::Vector3::operator- ( const Vector3 v) const
inline

Subtraction

◆ length()

◆ distanceBetween()

float DD::Image::Vector3::distanceBetween ( const Vector3 v) const
inline

Same as (this-v).length()

◆ distanceSquared()

float DD::Image::Vector3::distanceSquared ( const Vector3 v) const
inline

Same as (this-v).lengthSquared()

◆ dot()

float DD::Image::Vector3::dot ( const Vector3 v) const
inline

◆ cross()

Vector3 DD::Image::Vector3::cross ( const Vector3 v) const
inline

Cross product. This is a vector at right angles to the vectors with a length equal to the product of the lengths.

Referenced by DD::Image::Plane::Plane(), and DD::Image::TQuaternion< ValueType >::TQuaternion().

◆ normalize()

◆ fast_normalize()

float DD::Image::Vector3::fast_normalize ( )
inline

Uwe Behrens' fast-normalize method. Approximate normalization, returns approximate length.

Referenced by DD::Image::Primitive::draw_normal(), DD::Image::ComplexLightOp::get_L_vector(), and DD::Image::Mesh::validate().

◆ negate()

void DD::Image::Vector3::negate ( )
inline

Modifies it in-place, does not return the new value.

◆ append()

void Vector3::append ( Hash hash) const

Add this to the Hash object.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  o,
const Vector3  
)
friend

Writes it in nuke/tcl notation, with nested curly braces



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com