Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SbVec3d Class Reference

The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates. More...

#include <Inventor/SbVec3d.h>

Public Member Functions

 SbVec3d (void)
 
 SbVec3d (const double v[3])
 
 SbVec3d (double x, double y, double z)
 
 SbVec3d (const SbVec3f &v)
 
 SbVec3d (const SbVec3b &v)
 
 SbVec3d (const SbVec3s &v)
 
 SbVec3d (const SbVec3i32 &v)
 
 SbVec3d (const SbDPPlane &p0, const SbDPPlane &p1, const SbDPPlane &p2)
 
SbVec3dsetValue (const double v[3])
 
SbVec3dsetValue (double x, double y, double z)
 
SbVec3dsetValue (const SbVec3d &barycentric, const SbVec3d &v0, const SbVec3d &v1, const SbVec3d &v2)
 
SbVec3dsetValue (const SbVec3f &v)
 
SbVec3dsetValue (const SbVec3b &v)
 
SbVec3dsetValue (const SbVec3s &v)
 
SbVec3dsetValue (const SbVec3i32 &v)
 
const double * getValue (void) const
 
void getValue (double &x, double &y, double &z) const
 
double & operator[] (const int i)
 
const double & operator[] (const int i) const
 
SbVec3d cross (const SbVec3d &v) const
 
double dot (const SbVec3d &v) const
 
SbBool equals (const SbVec3d &v, double tolerance) const
 
SbVec3d getClosestAxis (void) const
 
double length (void) const
 
double sqrLength (void) const
 
void negate (void)
 
double normalize (void)
 
SbVec3doperator*= (double d)
 
SbVec3doperator/= (double d)
 
SbVec3doperator+= (const SbVec3d &v)
 
SbVec3doperator-= (const SbVec3d &v)
 
SbVec3d operator- (void) const
 
SbString toString () const
 
SbBool fromString (const SbString &str)
 
void print (FILE *fp) const
 

Related Functions

(Note that these are not member functions.)

SbVec3d operator* (const SbVec3d &v, double d)
 
SbVec3d operator* (double d, const SbVec3d &v)
 
SbVec3d operator/ (const SbVec3d &v, double d)
 
SbVec3d operator+ (const SbVec3d &v1, const SbVec3d &v2)
 
SbVec3d operator- (const SbVec3d &v1, const SbVec3d &v2)
 
int operator== (const SbVec3d &v1, const SbVec3d &v2)
 
int operator!= (const SbVec3d &v1, const SbVec3d &v2)
 

Detailed Description

The SbVec3d class is a 3 dimensional vector with double precision floating point coordinates.

This vector class provides storage for a 3 dimensional double precision floating point vector as well as simple floating point arithmetic operations.

See also
SbVec2s, SbVec2f, SbVec2d, SbVec3s, SbVec3f, SbVec4f, SbVec4d.
Since
Coin 2.0
TGS Inventor 2.6

Constructor & Destructor Documentation

◆ SbVec3d() [1/8]

SbVec3d::SbVec3d ( void  )
inline

The default constructor does nothing. The vector coordinates will be uninitialized until you do a setValue() call.

◆ SbVec3d() [2/8]

SbVec3d::SbVec3d ( const double  v[3])
inline

Constructs an SbVec3d instance with initial values from v.

◆ SbVec3d() [3/8]

SbVec3d::SbVec3d ( double  x,
double  y,
double  z 
)
inline

Constructs an SbVec3d instance with the initial vector endpoint set to <x,y,z>.

◆ SbVec3d() [4/8]

SbVec3d::SbVec3d ( const SbVec3f v)
inlineexplicit

Constructs an SbVec3d instance from an SbVec3f instance.

◆ SbVec3d() [5/8]

SbVec3d::SbVec3d ( const SbVec3b v)
inlineexplicit

Constructs an SbVec3d instance from an SbVec3b instance.

Since
Coin 2.5

◆ SbVec3d() [6/8]

SbVec3d::SbVec3d ( const SbVec3s v)
inlineexplicit

Constructs an SbVec3d instance from an SbVec3s instance.

Since
Coin 2.5

◆ SbVec3d() [7/8]

SbVec3d::SbVec3d ( const SbVec3i32 v)
inlineexplicit

Constructs an SbVec3d instance from an SbVec3i32 instance.

Since
Coin 2.5

◆ SbVec3d() [8/8]

SbVec3d::SbVec3d ( const SbDPPlane p0,
const SbDPPlane p1,
const SbDPPlane p2 
)

Constructs an SbVec3d instance by combining the three given planes. None of the planes should be parallel to any of the other two, otherwise a divide by zero error will occur.

Member Function Documentation

◆ setValue() [1/7]

SbVec3d & SbVec3d::setValue ( const double  v[3])
inline

Set new coordinates for the vector from v. Returns reference to self.

See also
getValue().

◆ setValue() [2/7]

SbVec3d & SbVec3d::setValue ( double  x,
double  y,
double  z 
)
inline

Set new coordinates for the vector. Returns reference to self.

See also
getValue().

◆ setValue() [3/7]

SbVec3d & SbVec3d::setValue ( const SbVec3d barycentric,
const SbVec3d v0,
const SbVec3d v1,
const SbVec3d v2 
)

Set this vector to be the average of v0, v1 and v2. The vector components are weighted by the barycentric vector.

See also
getValue().

◆ setValue() [4/7]

SbVec3d & SbVec3d::setValue ( const SbVec3f v)

Sets this vector to the single precision vector v, converting the vector to a double precision vector.

◆ setValue() [5/7]

SbVec3d & SbVec3d::setValue ( const SbVec3b v)

Sets this vector to the vector v.

Since
Coin 2.5

◆ setValue() [6/7]

SbVec3d & SbVec3d::setValue ( const SbVec3s v)

Sets this vector to the vector v.

Since
Coin 2.5

◆ setValue() [7/7]

SbVec3d & SbVec3d::setValue ( const SbVec3i32 v)

Sets this vector to the vector v.

Since
Coin 2.5

◆ getValue() [1/2]

const double * SbVec3d::getValue ( void  ) const
inline

Returns a pointer to an array of three doubles containing the x, y and z coordinates of the vector.

See also
setValue().

◆ getValue() [2/2]

void SbVec3d::getValue ( double &  x,
double &  y,
double &  z 
) const
inline

Returns the x, y and z coordinates of the vector.

See also
setValue().

◆ operator[]() [1/2]

double & SbVec3d::operator[] ( const int  i)
inline

Index operator. Returns modifiable x, y or z coordinate of vector.

See also
getValue() and setValue().

◆ operator[]() [2/2]

double SbVec3d::operator[] ( const int  i) const
inline

Index operator. Returns x, y or z coordinate of vector.

See also
getValue() and setValue().

◆ cross()

SbVec3d SbVec3d::cross ( const SbVec3d v) const

Returns the result of taking the cross product of this vector and v.

◆ dot()

double SbVec3d::dot ( const SbVec3d v) const
inline

Calculates and returns the result of taking the dot product of this vector and v.

◆ equals()

SbBool SbVec3d::equals ( const SbVec3d v,
double  tolerance 
) const

Compares the vector with v and returns TRUE if the distance between the vectors is smaller or equal to the square root of tolerance.

◆ getClosestAxis()

SbVec3d SbVec3d::getClosestAxis ( void  ) const

Return the vector representing the principal axis closest to this vector.

◆ length()

double SbVec3d::length ( void  ) const

Return length of vector.

◆ sqrLength()

double SbVec3d::sqrLength ( void  ) const
inline

Returns the squared length of the vector.

◆ negate()

void SbVec3d::negate ( void  )
inline

Negate the vector (i.e. point it in the opposite direction).

◆ normalize()

double SbVec3d::normalize ( void  )

Normalize the vector to unit length. Return value is the original length of the vector before normalization.

If the vector is the null vector, no attempt at normalization will be done.

◆ operator*=()

SbVec3d & SbVec3d::operator*= ( double  d)
inline

Multiply components of vector with value d. Returns reference to self.

◆ operator/=()

SbVec3d & SbVec3d::operator/= ( double  d)
inline

Divides components of vector with value d. Returns reference to self.

◆ operator+=()

SbVec3d & SbVec3d::operator+= ( const SbVec3d v)
inline

Adds this vector and vector v. Returns reference to self.

◆ operator-=()

SbVec3d & SbVec3d::operator-= ( const SbVec3d v)
inline

Subtracts vector v from this vector. Returns reference to self.

◆ operator-()

SbVec3d SbVec3d::operator- ( void  ) const
inline

Non-destructive negation operator. Returns a new SbVec3d instance which points in the opposite direction of this vector.

See also
negate().

◆ toString()

SbString SbVec3d::toString ( ) const

Return a string representation of this object

◆ fromString()

SbBool SbVec3d::fromString ( const SbString str)

Convert from a string representation, return wether this is a valid conversion

◆ print()

void SbVec3d::print ( FILE *  fp) const

Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile.

Friends And Related Function Documentation

◆ operator*() [1/2]

SbVec3d operator* ( const SbVec3d v,
double  d 
)
related

Returns an SbVec3d instance which is the components of vector v multiplied with d.

◆ operator*() [2/2]

SbVec3d operator* ( double  d,
const SbVec3d v 
)
related

Returns an SbVec3d instance which is the components of vector v multiplied with d.

◆ operator/()

SbVec3d operator/ ( const SbVec3d v,
double  d 
)
related

Returns an SbVec3d instance which is the components of vector v divided on the scalar factor d.

◆ operator+()

SbVec3d operator+ ( const SbVec3d v1,
const SbVec3d v2 
)
related

Returns an SbVec3d instance which is the sum of vectors v1 and v2.

◆ operator-()

SbVec3d operator- ( const SbVec3d v1,
const SbVec3d v2 
)
related

Returns an SbVec3d instance which is vector v2 subtracted from vector v1.

◆ operator==()

int operator== ( const SbVec3d v1,
const SbVec3d v2 
)
related

Returns 1 if v1 and v2 are exactly equal, 0 otherwise.

See also
equals().

◆ operator!=()

int operator!= ( const SbVec3d v1,
const SbVec3d v2 
)
related

Returns 1 if v1 and v2 are not equal, 0 if they are equal.

See also
equals().

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