SbVec2f Class Reference
[Basics]

2D vector class. More...

#include <Inventor/SbVec.h>

List of all members.

Public Member Functions

 SbVec2f ()
 SbVec2f (const float v[2])
 SbVec2f (float x, float y)
 SbVec2f (float val)
float dot (const SbVec2f &v) const
const float * getValue () const
void getValue (float &x, float &y) const
float length () const
float lengthSquared () const
void negate ()
float normalize ()
SbVec2fsetValue (const float v[2])
SbVec2fsetValue (float x, float y)
SbVec2fsetValue (const SbVec2d &vec2d)
SbVec2foperator*= (float d)
SbVec2f operator* (const SbVec2f &v) const
SbVec2foperator*= (const SbVec2f &v)
SbVec2foperator/= (float d)
SbVec2foperator+= (const SbVec2f &u)
SbVec2foperator-= (const SbVec2f &u)
SbVec2f operator- () const
SbBool equals (const SbVec2f &v, float tolerance) const
template<typename T >
 SbVec2f (const T &v)

Friends

SbVec2f operator* (const SbVec2f &v, float d)
SbVec2f operator* (float d, const SbVec2f &v)
SbVec2f operator/ (const SbVec2f &v, float d)
SbVec2f operator+ (const SbVec2f &v1, const SbVec2f &v2)
SbVec2f operator- (const SbVec2f &v1, const SbVec2f &v2)
int operator== (const SbVec2f &v1, const SbVec2f &v2)
int operator!= (const SbVec2f &v1, const SbVec2f &v2)
std::ostream & operator<< (std::ostream &os, const SbVec2f &v)



float & operator[] (int i)
const float & operator[] (int i) const

Detailed Description

2D vector class.

2D vector class used to store 2D vectors and points. This class is used throughout Open Inventor for arguments and return values.

SEE ALSO

SbRotation, SbRotationd, SbVec2d, SbVec2i32, SbVec2s, SbVec3d, SbVec3f, SbVec3i32, SbVec3s, SbVec4b, SbVec4d, SbVec4f, SbVec4i32, SbVec4s, SbVec4ub, SbVec4ui32, SbVec4us


Constructor & Destructor Documentation

SbVec2f::SbVec2f (  )  [inline]

Default constructor.

The vector is not initialized.

SbVec2f::SbVec2f ( const float  v[2]  )  [inline]

Constructor given vector components.

SbVec2f::SbVec2f ( float  x,
float  y 
) [inline]

Constructor given vector components.

SbVec2f::SbVec2f ( float  val  )  [inline]

Constructor that sets all components to the same value.

template<typename T >
SbVec2f::SbVec2f ( const T &  v  )  [inline, explicit]

Constructor that converts an arbitrary SbVec2 to an SbVec2f.


Member Function Documentation

float SbVec2f::dot ( const SbVec2f v  )  const [inline]

Returns dot (inner) product of vector and another vector.

SbBool SbVec2f::equals ( const SbVec2f v,
float  tolerance 
) const

Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.

void SbVec2f::getValue ( float &  x,
float &  y 
) const

Returns vector components.

const float* SbVec2f::getValue (  )  const [inline]

Returns vector components.

float SbVec2f::length (  )  const

Returns geometric length of vector.

float SbVec2f::lengthSquared (  )  const [inline]

Returns square length of vector.

Faster than length().

void SbVec2f::negate (  ) 

Negates each component of vector in place.

float SbVec2f::normalize (  ) 

Changes vector to be unit length.

SbVec2f SbVec2f::operator* ( const SbVec2f v  )  const [inline]

Component-wise vector multiplication operator.

SbVec2f& SbVec2f::operator*= ( const SbVec2f v  )  [inline]

Component-wise vector multiplication operator.

SbVec2f& SbVec2f::operator*= ( float  d  ) 

Component-wise scalar multiplication operator.

SbVec2f& SbVec2f::operator+= ( const SbVec2f u  ) 

Component-wise vector addition operator.

SbVec2f SbVec2f::operator- (  )  const

Nondestructive unary negation - returns a new vector.

SbVec2f& SbVec2f::operator-= ( const SbVec2f u  ) 

Component-wise vector subtraction operator.

SbVec2f& SbVec2f::operator/= ( float  d  ) 

Component-wise scalar division operator.

const float& SbVec2f::operator[] ( int  i  )  const [inline]

Accesses indexed component of vector.

float& SbVec2f::operator[] ( int  i  )  [inline]

Accesses indexed component of vector.

SbVec2f& SbVec2f::setValue ( const SbVec2d vec2d  ) 

Sets value of vector from a double precision vector.

If the values stored in the double precision argument(s) are too large to be stored in single precision variables, some loss of data will occur during the data transfer. The loss of data is defined by the standard C type conversion from double to float. It is the application's responsibility to handle this potential loss of data appropriately.

NOTE: Open Inventor fields still store only single precision values, not double precision values.

SbVec2f& SbVec2f::setValue ( float  x,
float  y 
)

Sets the vector components.

SbVec2f& SbVec2f::setValue ( const float  v[2]  ) 

Sets the vector components.


Friends And Related Function Documentation

int operator!= ( const SbVec2f v1,
const SbVec2f v2 
) [friend]

Inequality comparison operator.

SbVec2f operator* ( float  d,
const SbVec2f v 
) [friend]

Component-wise binary scalar multiplication operator.

SbVec2f operator* ( const SbVec2f v,
float  d 
) [friend]

Component-wise binary scalar multiplication operator.

SbVec2f operator+ ( const SbVec2f v1,
const SbVec2f v2 
) [friend]

Component-wise binary vector addition operator.

SbVec2f operator- ( const SbVec2f v1,
const SbVec2f v2 
) [friend]

Component-wise binary vector subtraction operator.

SbVec2f operator/ ( const SbVec2f v,
float  d 
) [friend]

Component-wise binary scalar division operator.

std::ostream& operator<< ( std::ostream &  os,
const SbVec2f v 
) [friend]

Writes the vector to the specified output stream.

int operator== ( const SbVec2f v1,
const SbVec2f v2 
) [friend]

Equality comparison operator.


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

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/