Nuke binary plugins 15.1.4
 
Loading...
Searching...
No Matches
DD::Image::Vector2 Class Reference

#include <Vector2.h>

Public Member Functions

float & operator[] (int i)
 
const float & operator[] (int i) const
 
const float * array () const
 
 Vector2 (const Vector2 &i)
 
 Vector2 (const float v[2])
 
 Vector2 (const double v[2])
 
 Vector2 (float a, float b)
 
Vector2operator= (const Vector2 &v)
 
void set (float i)
 
void set (float a, float b)
 
void clear ()
 
Vector2 operator* (float d) const
 
Vector2operator*= (float d)
 
Vector2 operator* (const Vector2 &v) const
 
Vector2operator*= (const Vector2 &v)
 
Vector2 operator/ (float d) const
 
Vector2operator/= (float d)
 
Vector2 operator/ (const Vector2 &v) const
 
Vector2operator/= (const Vector2 &v)
 
Vector2 operator+ (const Vector2 &v) const
 
Vector2operator+= (const Vector2 &v)
 
Vector2 operator- () const
 
Vector2 operator- (const Vector2 &v) const
 
Vector2operator-= (const Vector2 &v)
 
bool operator== (const Vector2 &v) const
 
bool operator!= (const Vector2 &v) const
 
bool operator== (float d) const
 
bool operator!= (float d) const
 
bool operator< (const Vector2 &v) const
 Fairly arbitrary operator so you can store these in ordered arrays.
 
float length () const
 
float lengthSquared () const
 
float distanceBetween (const Vector2 &v) const
 
float distanceSquared (const Vector2 &v) const
 
float dot (const Vector2 &v) const
 
float cross (const Vector2 &v) const
 Returns the Z component of the cross product, Ux*Vy-Uy*Vx.
 
float normalize ()
 Change the vector to be unit length. Returns the original length.
 
void negate ()
 
void append (Hash &) const
 

Public Attributes

float x
 
float y
 

Friends

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

Detailed Description

2-component vector, used to represent a point/vector in the plane.

This object is in general compatible with the SbVec2 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.

See DD::Image::Vector3 for more details on the member functions.

Member Function Documentation

◆ operator*()

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

This is component multiplication! Use dot() or cross() for vector multiply

◆ operator/()

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

Component-wise division.

◆ distanceBetween()

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

Same as (this-v).length()

◆ distanceSquared()

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

Same as (this-v).lengthSquared()

Referenced by DD::Image::Quadtree< T >::_add(), and DD::Image::Quadtree< T >::add().

◆ append()

void Vector2::append ( Hash hash) const

Add this to the Hash object.



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