28#include <Inventor/STL/iostream>
82 SbVec2f() { memset(vec, 0,
sizeof(vec)); }
103 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1]; }
125 {
return vec[0] * vec[0] + vec[1] * vec[1]; }
179 return SbVec2f(vec[0]*v.vec[0],
243 {
return !(v1 == v2); }
263 vec[0] = float(v[0]);
264 vec[1] = float(v[1]);
336 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1]; }
358 {
return vec[0] * vec[0] + vec[1] * vec[1]; }
384 { vec[0] = vec2f[0] ; vec[1] = vec2f[1] ;
return (*
this) ; }
450 {
return !(v1 == v2); }
470 vec[0] = double(v[0]);
471 vec[1] = double(v[1]);
535 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1]; }
581 {
return *
this *= (1.0 / d); }
620 {
return v * (1.0 / d); }
637 {
return !(v1 == v2); }
651 vec[0] = int32_t(v[0]);
652 vec[1] = int32_t(v[1]);
721#ifndef OIV_DO_NOT_ALLOW_I32_TO_I16_AUTO_CAST
729 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1]; }
781 {
return *
this *= (1.0 / d); }
800#ifndef OIV_DO_NOT_ALLOW_I32_TO_I16_AUTO_CAST
830 {
return v * (1.0 / d); }
850 {
return !(v1 == v2); }
864 vec[0] = short(v[0]);
865 vec[1] = short(v[1]);
943 { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2]; }
949 { vec[0] = x; vec[1] =
y; vec[2] = z; }
962 vec[1] * v.vec[2] - vec[2] * v.vec[1],
963 vec[2] * v.vec[0] - vec[0] * v.vec[2],
964 vec[0] * v.vec[1] - vec[1] * v.vec[0]
972 {
return (vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2]); }
995 {
return vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]; }
1011 { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2];
return *
this; }
1017 { vec[0] = x; vec[1] =
y; vec[2] = z;
return *
this; }
1068 {
return SbVec3f(-vec[0], -vec[1], -vec[2]); }
1074 {
return SbVec3f(vec[0]*v.vec[0], vec[1]*v.vec[1], vec[2]*v.vec[2]); }
1089 {
return SbVec3f(v.vec[0] * d, v.vec[1] * d, v.vec[2] * d); }
1101 {
return SbVec3f(v.vec[0] / d, v.vec[1] / d, v.vec[2] / d); }
1107 {
return SbVec3f(v1.vec[0] + v2.vec[0], v1.vec[1] + v2.vec[1], v1.vec[2] + v2.vec[2]); }
1113 {
return SbVec3f(v1.vec[0] - v2.vec[0], v1.vec[1] - v2.vec[1], v1.vec[2] - v2.vec[2]); }
1119 {
return (v1.vec[0] == v2.vec[0] && v1.vec[1] == v2.vec[1] && v1.vec[2] == v2.vec[2]); }
1125 {
return !(v1 == v2); }
1147 template<
typename T>
1151 vec[0] = float(v[0]);
1152 vec[1] = float(v[1]);
1153 vec[2] = float(v[2]);
1225 { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2]; }
1231 { vec[0] = x; vec[1] =
y; vec[2] = z; }
1244 vec[1] * v.vec[2] - vec[2] * v.vec[1],
1245 vec[2] * v.vec[0] - vec[0] * v.vec[2],
1246 vec[0] * v.vec[1] - vec[1] * v.vec[0]
1254 {
return (vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2]); }
1277 {
return vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]; }
1293 { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2];
return *
this; }
1299 { vec[0] = x; vec[1] =
y; vec[2] = z;
return *
this; }
1313 { vec[0] = vec3f[0] ; vec[1] = vec3f[1] ; vec[2] = vec3f[2] ;
return (*
this) ; }
1376 {
return SbVec3d(-vec[0], -vec[1], -vec[2]); }
1382 {
return SbVec3d(vec[0]*v.vec[0], vec[1]*v.vec[1], vec[2]*v.vec[2]); }
1397 {
return SbVec3d(v.vec[0] * d, v.vec[1] * d, v.vec[2] * d); }
1409 {
return SbVec3d(v.vec[0] / d, v.vec[1] / d, v.vec[2] / d); }
1415 {
return SbVec3d(v1.vec[0] + v2.vec[0], v1.vec[1] + v2.vec[1], v1.vec[2] + v2.vec[2]); }
1421 {
return SbVec3d(v1.vec[0] - v2.vec[0], v1.vec[1] - v2.vec[1], v1.vec[2] - v2.vec[2]); }
1427 {
return (v1.vec[0] == v2.vec[0] && v1.vec[1] == v2.vec[1] && v1.vec[2] == v2.vec[2]); }
1433 {
return !(v1 == v2); }
1455 template<
typename T>
1459 vec[0] = double(v[0]);
1460 vec[1] = double(v[1]);
1461 vec[2] = double(v[2]);
1473 vec[0] =
static_cast<float>(vec3d[0]);
1474 vec[1] =
static_cast<float>(vec3d[1]);
1475 vec[2] =
static_cast<float>(vec3d[2]);
1540 return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2];
1612 {
return *
this *= (1.0 / d); }
1648 return SbVec3i32(vec[0] * d, vec[1] * d, vec[2] * d);
1692 {
return v * (1.0 / d); }
1710 v1.vec[1] - v2.vec[1],
1711 v1.vec[2] - v2.vec[2]);
1722 {
return !(v1 == v2); }
1732 template<
typename T>
1736 vec[0] = int32_t(v[0]);
1737 vec[1] = int32_t(v[1]);
1738 vec[2] = int32_t(v[2]);
1819#ifndef OIV_DO_NOT_ALLOW_I32_TO_I16_AUTO_CAST
1827 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2]; }
1879 {
return *
this *= (1.0 / d); }
1899#ifndef OIV_DO_NOT_ALLOW_I32_TO_I16_AUTO_CAST
1929 {
return v * (1.0 / d); }
1949 {
return !(v1 == v2); }
1959 template<
typename T>
1963 vec[0] = short(v[0]);
1964 vec[1] = short(v[1]);
1965 vec[2] = short(v[2]);
2036 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3]; }
2089 {
return *
this *= (1.0 / d); }
2131 {
return v * (1.0 / d); }
2151 {
return !(v1 == v2); }
2161 template<
typename T>
2165 vec[0] = char(v[0]);
2166 vec[1] = char(v[1]);
2167 vec[2] = char(v[2]);
2168 vec[3] = char(v[3]);
2236 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3] ; }
2251 void getValue(
float &x,
float &
y,
float &z,
float &w)
const;
2263 {
return vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2] + vec[3] * vec[3]; }
2354 {
return !(v1 == v2); }
2370 template<
typename T>
2374 vec[0] = float(v[0]);
2375 vec[1] = float(v[1]);
2376 vec[2] = float(v[2]);
2377 vec[3] = float(v[3]);
2449 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3] ; }
2464 void getValue(
double &x,
double &
y,
double &z,
double &w)
const;
2476 {
return vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2] + vec[3] * vec[3]; }
2502 { vec[0] = vec4f[0] ; vec[1] = vec4f[1] ; vec[2] = vec4f[2] ;
2503 vec[3] = vec4f[3] ;
return (*
this) ;}
2569 {
return !(v1 == v2); }
2585 template<
typename T>
2589 vec[0] = double(v[0]);
2590 vec[1] = double(v[1]);
2591 vec[2] = double(v[2]);
2592 vec[3] = double(v[3]);
2657 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3]; }
2665 void getValue(int32_t &x, int32_t &
y, int32_t &z, int32_t &w)
const;
2703 {
return *
this *= (1.0 / d); }
2742 {
return v * (1.0 / d); }
2760 {
return !(v1 == v2); }
2770 template<
typename T>
2774 vec[0] = int32_t(v[0]);
2775 vec[1] = int32_t(v[1]);
2776 vec[2] = int32_t(v[2]);
2777 vec[3] = int32_t(v[3]);
2846 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3]; }
2856 void getValue(
short &x,
short &
y,
short &z,
short &w)
const;
2898 {
return *
this *= (1.0 / d); }
2940 {
return v * (1.0 / d); }
2960 {
return !(v1 == v2); }
2970 template<
typename T>
2974 vec[0] = short(v[0]);
2975 vec[1] = short(v[1]);
2976 vec[2] = short(v[2]);
2977 vec[3] = short(v[3]);
3050 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3]; }
3061 uint32_t &z, uint32_t &w)
const;
3072 uint32_t z, uint32_t w);
3099 {
return *
this *= (1.0 / d); }
3135 {
return v * (1.0 / d); }
3155 {
return !(v1 == v2); }
3165 template<
typename T>
3169 vec[0] = uint32_t(v[0]);
3170 vec[1] = uint32_t(v[1]);
3171 vec[2] = uint32_t(v[2]);
3172 vec[3] = uint32_t(v[3]);
3235 SbVec4us(
unsigned short x,
unsigned short y,
unsigned short z,
unsigned short w)
3242 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3]; }
3252 void getValue(
unsigned short &x,
unsigned short &
y,
unsigned short &z,
unsigned short &w)
const;
3294 {
return *
this *= (1.0 / d); }
3336 {
return v * (1.0 / d); }
3356 {
return !(v1 == v2); }
3366 template<
typename T>
3370 vec[0] =
static_cast<unsigned short>(v[0]);
3371 vec[1] =
static_cast<unsigned short>(v[1]);
3372 vec[2] =
static_cast<unsigned short>(v[2]);
3373 vec[3] =
static_cast<unsigned short>(v[3]);
3376 unsigned short vec[4];
3437 SbVec4ub(
unsigned char x,
unsigned char y,
unsigned char z,
unsigned char w)
3444 {
return vec[0] * v.vec[0] + vec[1] * v.vec[1] + vec[2] * v.vec[2] + vec[3] * v.vec[3]; }
3454 void getValue(
unsigned char &x,
unsigned char &
y,
unsigned char &z,
unsigned char &w)
const;
3496 {
return *
this *= (1.0 / d); }
3538 {
return v * (1.0 / d); }
3558 {
return !(v1 == v2); }
3568 template<
typename T>
3572 vec[0] =
static_cast<unsigned char>(v[0]);
3573 vec[1] =
static_cast<unsigned char>(v[1]);
3574 vec[2] =
static_cast<unsigned char>(v[2]);
3575 vec[3] =
static_cast<unsigned char>(v[3]);
3581 inline void clamp(
unsigned char a,
unsigned char b)
3589 unsigned char vec[4];
3598 return os <<
"(" << v[0] <<
", " << v[1] <<
")";
3606 return os <<
"(" << v[0] <<
", " << v[1] <<
")";
3614 return os <<
"(" << v[0] <<
", " << v[1] <<
")";
3622 return os <<
"(" << v[0] <<
", " << v[1] <<
")";
3630 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
")";
3638 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
")";
3646 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
")";
3654 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
")";
3663 return os <<
"(" <<
static_cast<int>(v[0]) <<
", " <<
static_cast<int>(v[1]) <<
", " <<
static_cast<int>(v[2]) <<
", " <<
static_cast<int>(v[3]) <<
")";
3671 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
")";
3679 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
")";
3687 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
")";
3695 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
")";
3703 return os <<
"(" <<
static_cast<unsigned int>(v[0]) <<
", " <<
static_cast<unsigned int>(v[1]) <<
", " <<
static_cast<unsigned int>(v[2]) <<
", " <<
static_cast<unsigned int>(v[3]) <<
")";
3711 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
")";
3719 return os <<
"(" << v[0] <<
", " << v[1] <<
", " << v[2] <<
", " << v[3] <<
")";
std::ostream & operator<<(std::ostream &os, const SbVec2s &v)
Writes the vector to the specified output stream.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 2D vector class ...
friend int operator!=(const SbVec2d &v1, const SbVec2d &v2)
Inequality comparison operator.
friend std::ostream & operator<<(std::ostream &os, const SbVec2d &v)
Writes the vector to the specified output stream.
SbVec2d & setValue(const SbVec2f &vec2f)
Sets value of vector from a single precision vector.
friend SbVec2d operator/(const SbVec2d &v, double d)
Component-wise binary scalar division operator.
double dot(const SbVec2d &v) const
Returns dot (inner) product of vector and another vector.
SbVec2d & operator*=(double d)
Component-wise scalar multiplication operator.
double length() const
Returns geometric length of vector.
double & operator[](int i)
Accesses indexed component of vector.
SbVec2d & setValue(const double v[2])
Sets the vector components.
SbVec2d(double x, double y)
Constructor given vector components.
SbVec2d(const T &v)
Constructor that converts an arbitrary SbVec2 to an SbVec2d.
double normalize()
Changes vector to be unit length.
void negate()
Negates each component of vector in place.
SbVec2d & operator/=(double d)
Component-wise scalar division operator.
SbVec2d operator-() const
Nondestructive unary negation - returns a new vector.
friend SbVec2d operator*(const SbVec2d &v, double d)
Component-wise binary scalar multiplication operator.
SbVec2d(const double v[2])
Constructor given vector components.
const double * getValue() const
Returns vector components.
SbVec2d()
Default constructor.
SbVec2d & setValue(double x, double y)
Sets the vector components.
void getValue(double &x, double &y) const
Returns vector components.
SbVec2d & operator+=(const SbVec2d &u)
Component-wise vector addition operator.
SbVec2d & operator-=(const SbVec2d &u)
Component-wise vector subtraction operator.
friend int operator==(const SbVec2d &v1, const SbVec2d &v2)
Equality comparison operator.
friend SbVec2d operator+(const SbVec2d &v1, const SbVec2d &v2)
Component-wise binary vector addition operator.
SbBool equals(const SbVec2d &v, double tolerance) const
Equality comparison within given tolerance - the square of the length of the maximum distance between...
double lengthSquared() const
Returns square length of vector.
SbVec2f & operator-=(const SbVec2f &u)
Component-wise vector subtraction operator.
float & operator[](int i)
Accesses indexed component of vector.
SbVec2f & setValue(float x, float y)
Sets the vector components.
float normalize()
Changes vector to be unit length.
SbVec2f & setValue(const SbVec2d &vec2d)
Sets value of vector from a double precision vector.
SbVec2f & operator*=(float d)
Component-wise scalar multiplication operator.
SbVec2f & operator+=(const SbVec2f &u)
Component-wise vector addition operator.
SbVec2f & operator/=(float d)
Component-wise scalar division operator.
friend int operator!=(const SbVec2f &v1, const SbVec2f &v2)
Inequality comparison operator.
SbBool equals(const SbVec2f &v, float tolerance) const
Equality comparison within given tolerance - the square of the length of the maximum distance between...
const float * getValue() const
Returns vector components.
SbVec2f()
Default constructor.
SbVec2f(float val)
Constructor that sets all components to the same value.
void negate()
Negates each component of vector in place.
friend SbVec2f operator+(const SbVec2f &v1, const SbVec2f &v2)
Component-wise binary vector addition operator.
void getValue(float &x, float &y) const
Returns vector components.
float lengthSquared() const
Returns square length of vector.
SbVec2f & setValue(const float v[2])
Sets the vector components.
SbVec2f operator-() const
Nondestructive unary negation - returns a new vector.
friend std::ostream & operator<<(std::ostream &os, const SbVec2f &v)
Writes the vector to the specified output stream.
SbVec2f(float x, float y)
Constructor given vector components.
float dot(const SbVec2f &v) const
Returns dot (inner) product of vector and another vector.
SbVec2f(const T &v)
Constructor that converts an arbitrary SbVec2 to an SbVec2f.
float length() const
Returns geometric length of vector.
friend SbVec2f operator/(const SbVec2f &v, float d)
Component-wise binary scalar division operator.
SbVec2f(const float v[2])
Constructor given vector components.
friend SbVec2f operator*(const SbVec2f &v, float d)
Component-wise binary scalar multiplication operator.
friend int operator==(const SbVec2f &v1, const SbVec2f &v2)
Equality comparison operator.
int32_t & operator[](int i)
Accesses indexed component of vector.
friend std::ostream & operator<<(std::ostream &os, const SbVec2i32 &v)
Writes the vector to the specified output stream.
void getValue(int32_t &x, int32_t &y) const
Returns 2 individual components.
SbVec2i32 & operator+=(const SbVec2i32 &u)
Component-wise vector addition operator.
void negate()
Negates each component of vector in place.
SbVec2i32 & operator/=(int d)
Component-wise scalar division operator.
SbVec2i32()
Default constructor.
SbVec2i32(int32_t x, int32_t y)
Constructor given 2 individual components.
SbVec2i32 & operator*=(int d)
Component-wise scalar multiplication operator.
SbVec2i32 operator-() const
Nondestructive unary negation - returns a new vector.
SbVec2i32(const T &v)
Constructor that converts an arbitrary SbVec2 to an SbVec2i32.
int32_t dot(const SbVec2i32 &v) const
Returns dot (inner) product of vector and another vector.
SbVec2i32 & setValue(const int32_t v[2])
Sets value of vector from array of 2 components.
friend int operator!=(const SbVec2i32 &v1, const SbVec2i32 &v2)
Inequality comparison operator.
SbVec2i32 & operator-=(const SbVec2i32 &u)
Component-wise vector subtraction operator.
friend int operator==(const SbVec2i32 &v1, const SbVec2i32 &v2)
Equality comparison operator.
friend SbVec2i32 operator+(const SbVec2i32 &v1, const SbVec2i32 &v2)
Component-wise binary vector addition operator.
friend SbVec2i32 operator/(const SbVec2i32 &v, int d)
Component-wise binary scalar division operator.
SbVec2i32 & setValue(int32_t x, int32_t y)
Sets value of vector from 2 individual components.
SbVec2i32(const int32_t v[2])
Constructor given an array of 2 components.
const int32_t * getValue() const
Returns pointer to array of 2 components.
friend SbVec2i32 operator*(const SbVec2i32 &v, int d)
Component-wise binary scalar multiplication operator.
friend SbVec2s operator/(const SbVec2s &v, int d)
Component-wise binary scalar division operator.
SbVec2s(short x, short y)
Constructor given 2 components.
friend int operator!=(const SbVec2s &v1, const SbVec2s &v2)
Inequality comparison operator.
void getValue(short &x, short &y) const
Returns vector components.
friend SbVec2s operator*(const SbVec2s &v, int d)
Component-wise binary scalar multiplication operator.
SbVec2s(const SbVec2i32 &v)
Constructor given an SbVec2i32.
friend int operator==(const SbVec2s &v1, const SbVec2s &v2)
Equality comparison operator.
SbVec2s()
Default constructor.
SbVec2s & operator-=(const SbVec2s &u)
Component-wise vector subtraction operator.
SbVec2s & setValue(const short v[2])
Sets vector components.
SbVec2s & setValue(short x, short y)
Sets vector components.
SbVec2s(const short v[2])
Constructor given 2 components.
SbVec2s & operator+=(const SbVec2s &u)
Component-wise vector addition operator.
void negate()
Negates each component of vector in place.
SbVec2s(const T &v)
Constructor that converts an arbitrary SbVec2 to an SbVec2s.
friend SbVec2s operator+(const SbVec2s &v1, const SbVec2s &v2)
Component-wise binary vector addition operator.
friend std::ostream & operator<<(std::ostream &os, const SbVec2s &v)
Writes the vector to the specified output stream.
const short * getValue() const
Returns vector components.
int32_t dot(const SbVec2s &v) const
Returns dot (inner) product of vector and another vector.
SbVec2s & operator/=(int d)
Component-wise scalar division operator.
SbVec2s operator=(const SbVec2i32 &v)
Component-wise set operator.
SbVec2s & operator*=(int d)
Component-wise scalar multiplication operator.
short & operator[](int i)
Accesses indexed component of vector.
SbVec2s operator-() const
Nondestructive unary negation - returns a new vector.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class ...
SbBool equals(const SbVec3d &v, double tolerance) const
Equality comparison within given tolerance - the square of the length of the maximum distance between...
SbVec3d(SbPlane &p0, SbPlane &p1, SbPlane &p2)
Constructor given 3 planes.
double dot(const SbVec3d &v) const
Returns dot (inner) product of vector and another vector.
SbVec3d(const T &v)
Constructor that converts an arbitrary SbVec3 to an SbVec3d.
double lengthSquared() const
Returns square length of vector.
SbVec3d & operator+=(const SbVec3d &v)
Component-wise vector addition operator.
friend int operator!=(const SbVec3d &v1, const SbVec3d &v2)
Inequality comparison operator.
SbVec3d & setValue(const double v[3])
Sets the vector components.
SbVec3d(double x, double y, double z)
Constructor given vector components.
SbVec3d & setValue(const SbVec3f &vec3f)
Sets value of vector from a single precision vector.
double length() const
Returns geometric length of vector.
SbVec3d & operator*=(double d)
Component-wise scalar multiplication operator.
friend int operator==(const SbVec3d &v1, const SbVec3d &v2)
Equality comparison operator.
double & operator[](int i)
Accesses indexed component of vector.
SbVec3d(const double v[3])
Constructor given vector components.
SbVec3d cross(const SbVec3d &v) const
Returns right-handed cross product of vector and another vector.
SbVec3d getClosestAxis() const
Returns principal axis that is closest (based on maximum dot product) to this vector.
void negate()
Negates each component of vector in place.
void getValue(double &x, double &y, double &z) const
Returns vector components.
SbVec3d operator-() const
Nondestructive unary negation - returns a new vector.
friend SbVec3d operator*(const SbVec3d &v, double d)
Component-wise binary scalar multiplication operator.
friend std::ostream & operator<<(std::ostream &os, const SbVec3d &v)
Writes the vector to the specified output stream.
const double * getValue() const
Returns vector components.
SbVec3d()
Default constructor.
double normalize()
Changes vector to be unit length, returning the length before normalization.
friend SbVec3d operator+(const SbVec3d &v1, const SbVec3d &v2)
Component-wise binary vector addition operator.
SbVec3d & operator-=(const SbVec3d &v)
Component-wise vector subtraction operator.
SbVec3d & setValue(double x, double y, double z)
Sets the vector components.
friend SbVec3d operator/(const SbVec3d &v, double d)
Component-wise binary scalar division operator.
SbVec3d & operator/=(double d)
Component-wise scalar division operator.
SbVec3d & setValue(const SbVec3d &barycentic, const SbVec3d &v0, const SbVec3d &v1, const SbVec3d &v2)
Sets value of vector as the weighted average of 3 other vectors.
SbVec3f cross(const SbVec3f &v) const
Returns right-handed cross product of vector and another vector.
SbVec3f & operator+=(const SbVec3f &v)
Component-wise vector addition operator.
float length() const
Returns geometric length of vector.
float normalize()
Changes vector to be unit length, returning the length before normalization.
SbVec3f & setValue(const SbVec3f &barycentic, const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2)
Sets value of vector as the weighted average of 3 other vectors.
SbVec3f & operator/=(float d)
Component-wise scalar division operator.
SbVec3f & setValue(const float v[3])
Sets the vector components.
friend SbVec3f operator+(const SbVec3f &v1, const SbVec3f &v2)
Component-wise binary vector addition operator.
void getValue(float &x, float &y, float &z) const
Returns vector components.
SbVec3f(const float v[3])
Constructor given vector components.
SbVec3f(SbPlane &p0, SbPlane &p1, SbPlane &p2)
Constructor given 3 planes.
friend int operator!=(const SbVec3f &v1, const SbVec3f &v2)
Inequality comparison operator.
float lengthSquared() const
Returns square length of vector.
SbVec3f operator-() const
Nondestructive unary negation - returns a new vector.
friend int operator==(const SbVec3f &v1, const SbVec3f &v2)
Equality comparison operator.
float dot(const SbVec3f &v) const
Returns dot (inner) product of vector and another vector.
friend SbVec3f operator*(const SbVec3f &v, float d)
Component-wise binary scalar multiplication operator.
SbBool equals(const SbVec3f &v, float tolerance) const
Equality comparison within given tolerance - the square of the length of the maximum distance between...
SbVec3f & operator-=(const SbVec3f &v)
Component-wise vector subtraction operator.
void negate()
Negates each component of vector in place.
SbVec3f(float x, float y, float z)
Constructor given vector components.
const float * getValue() const
Returns vector components.
friend SbVec3f operator/(const SbVec3f &v, float d)
Component-wise binary scalar division operator.
SbVec3f & setValue(float x, float y, float z)
Sets the vector components.
SbVec3f(const T &v)
Constructor that converts an arbitrary SbVec3 to an SbVec3f.
SbVec3f()
Default constructor.
SbVec3f getClosestAxis() const
Returns principal axis that is closest (based on maximum dot product) to this vector.
friend std::ostream & operator<<(std::ostream &os, const SbVec3f &v)
Writes the vector to the specified output stream.
float & operator[](int i)
Accesses indexed component of vector.
SbVec3f & operator*=(float d)
Component-wise scalar multiplication operator.
const int32_t * getValue() const
Returns pointer to array of 3 components.
int32_t & operator[](int i)
Accesses indexed component of vector.
SbVec3i32 & setValue(const int32_t v[3])
Sets value of vector from array of 3 components.
SbVec3i32 operator+(const SbVec3i32 &v) const
Component-wise binary vector addition operator.
SbVec3i32(const T &v)
Constructor that converts an arbitrary SbVec3 to an SbVec3i32.
SbVec3i32 & setValue(int32_t x, int32_t y, int32_t z)
Sets value of vector from 3 individual components.
SbVec3i32 operator-() const
Nondestructive unary negation - returns a new vector.
SbVec3i32(int32_t x, int32_t y, int32_t z)
Constructor given 3 individual components.
SbVec3i32()
Default constructor.
void getValue(int32_t &x, int32_t &y, int32_t &z) const
Returns 3 individual components.
SbVec3i32(const SbVec3s &vec)
Constructor given an SbVec3s (adapter).
SbVec3i32 & operator/=(int d)
Component-wise scalar division operator.
SbVec3i32 & operator-=(const SbVec3i32 &u)
Component-wise vector subtraction operator.
friend int operator==(const SbVec3i32 &v1, const SbVec3i32 &v2)
Equality comparison operator.
friend SbVec3i32 operator/(const SbVec3i32 &v, int d)
Component-wise binary scalar division operator.
SbVec3i32 & operator+=(const SbVec3i32 &u)
Component-wise vector addition operator.
SbVec3i32 & setValue(const SbVec3s &v)
Sets value of vector from an SbVec3s (adapter).
friend std::ostream & operator<<(std::ostream &os, const SbVec3i32 &v)
Writes the vector to the specified output stream.
friend SbVec3i32 operator*(const SbVec3i32 &v, double d)
Component-wise binary scalar multiplication operator.
void negate()
Negates each component of vector in place.
int32_t dot(const SbVec3i32 &v) const
Returns dot (inner) product of vector and another vector.
SbVec3i32 & operator*=(int d)
Component-wise scalar multiplication operator.
friend int operator!=(const SbVec3i32 &v1, const SbVec3i32 &v2)
Inequality comparison operator.
SbVec3i32 operator=(const SbVec3s &v)
Assignment operator given an SbVec3s (adapter).
SbVec3i32(const int32_t v[3])
Constructor given an array of 3 components.
int32_t getMaxComponent() const
Returns max(x, y, z)
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D vector class.
friend SbVec3s operator/(const SbVec3s &v, int d)
Component-wise binary scalar division operator.
SbVec3s operator=(const SbVec3i32 &v)
Assignment operator given SbVec3i32 (adapter).
friend SbVec3s operator+(const SbVec3s &v1, const SbVec3s &v2)
Component-wise binary vector addition operator.
friend SbVec3s operator*(const SbVec3s &v, int d)
Component-wise binary scalar multiplication operator.
SbVec3s & setValue(const short v[3])
Sets vector components.
friend int operator==(const SbVec3s &v1, const SbVec3s &v2)
Equality comparison operator.
SbVec3s(const short v[3])
Constructor given 3 components.
friend int operator!=(const SbVec3s &v1, const SbVec3s &v2)
Inequality comparison operator.
void getValue(short &x, short &y, short &z) const
Returns vector components.
SbVec3s & operator/=(int d)
Component-wise scalar division operator.
SbVec3s operator-() const
Nondestructive unary negation - returns a new vector.
SbVec3s & operator-=(const SbVec3s &u)
Component-wise vector subtraction operator.
void negate()
Negates each component of vector in place.
SbVec3s & operator*=(int d)
Component-wise scalar multiplication operator.
SbVec3s(const T &v)
Constructor that converts an arbitrary SbVec3 to an SbVec3s.
const short * getValue() const
Returns vector components.
int32_t dot(const SbVec3s &v) const
Returns dot (inner) product of vector and another vector.
SbVec3s()
Default constructor.
short & operator[](int i)
Accesses indexed component of vector.
SbVec3s & operator+=(const SbVec3s &u)
Component-wise vector addition operator.
friend std::ostream & operator<<(std::ostream &os, const SbVec3s &v)
Writes the vector to the specified output stream.
SbVec3s(short x, short y, short z)
Constructor given 3 components.
SbVec3s(const SbVec3i32 &v)
Constructor given an SbVec3i32 (adapter).
SbVec3s & setValue(short x, short y, short z)
Sets vector components.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class.
SbVec4b & setValue(char x, char y, char z, char w)
Sets vector components.
char & operator[](int i)
Accesses indexed component of vector.
friend int operator==(const SbVec4b &v1, const SbVec4b &v2)
Equality comparison operator.
void negate()
Negates each component of vector in place.
friend SbVec4b operator/(const SbVec4b &v, int d)
Component-wise binary scalar division operator.
int32_t dot(const SbVec4b &v) const
Returns dot (inner) product of vector and another vector.
SbVec4b & operator*=(int d)
Component-wise scalar multiplication operator.
SbVec4b(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4b.
friend SbVec4b operator+(const SbVec4b &v1, const SbVec4b &v2)
Component-wise binary vector addition operator.
SbVec4b & operator/=(int d)
Component-wise scalar division operator.
const char * getValue() const
Returns vector components.
SbVec4b & operator+=(const SbVec4b &u)
Component-wise vector addition operator.
friend SbVec4b operator*(const SbVec4b &v, int d)
Component-wise binary scalar multiplication operator.
SbVec4b & operator-=(const SbVec4b &u)
Component-wise vector subtraction operator.
friend int operator!=(const SbVec4b &v1, const SbVec4b &v2)
Inequality comparison operator.
SbVec4b & setValue(const char v[4])
Sets vector components.
void getValue(char &x, char &y, char &z, char &w) const
Returns vector components.
friend std::ostream & operator<<(std::ostream &os, const SbVec4b &v)
Writes the vector to the specified output stream.
SbVec4b()
Default constructor.
SbVec4b operator-() const
Nondestructive unary negation - returns a new vector.
SbVec4b(const char v[4])
Constructor given 4 components.
SbVec4b(char x, char y, char z, char w)
Constructor given 4 components.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class ...
void getValue(double &x, double &y, double &z, double &w) const
Returns vector components.
SbVec4d(double x, double y, double z, double w)
Constructor given vector components.
friend std::ostream & operator<<(std::ostream &os, const SbVec4d &v)
Writes the vector to the specified output stream.
SbVec4d(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4d.
double & operator[](int i)
Accesses indexed component of vector.
void getReal(SbVec3d &v) const
Returns the real portion of the vector by dividing by the fourth value.
friend int operator==(const SbVec4d &v1, const SbVec4d &v2)
Equality comparison operator.
SbVec4d & setValue(const double v[4])
Sets the vector components.
double length() const
Returns geometric length of vector.
SbVec4d(const double v[4])
Constructor given vector components.
void negate()
Negates each component of vector in place.
SbVec4d & setValue(const SbVec4f &vec4f)
Sets value of vector from a single precision vector.
double normalize()
Changes vector to be unit length.
friend int operator!=(const SbVec4d &v1, const SbVec4d &v2)
Inequality comparison operator.
double dot(const SbVec4d &v) const
Returns dot (inner) product of vector and another vector.
SbVec4d & operator-=(const SbVec4d &u)
Component-wise vector subtraction operator.
friend SbVec4d operator+(const SbVec4d &v1, const SbVec4d &v2)
Component-wise binary vector addition operator.
SbVec4d & operator*=(double d)
Component-wise scalar multiplication operator.
SbVec4d operator-() const
Nondestructive unary negation - returns a new vector.
SbBool equals(const SbVec4d &v, double tolerance) const
Equality comparison within given tolerance - the square of the length of the maximum distance between...
friend SbVec4d operator*(const SbVec4d &v, double d)
Component-wise binary scalar multiplication operator.
double lengthSquared() const
Returns square length of vector.
SbVec4d & operator/=(double d)
Component-wise scalar division operator.
const double * getValue() const
Returns vector components.
SbVec4d & setValue(double x, double y, double z, double w)
Sets the vector components.
friend SbVec4d operator/(const SbVec4d &v, double d)
Component-wise binary scalar division operator.
SbVec4d & operator+=(const SbVec4d &u)
Component-wise vector addition operator.
SbVec4d()
Default constructor.
float lengthSquared() const
Returns square length of vector.
float length() const
Returns geometric length of vector.
SbVec4f(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4f.
void negate()
Negates each component of vector in place.
float normalize()
Changes vector to be unit length.
SbVec4f & operator/=(float d)
Component-wise scalar division operator.
SbVec4f & operator+=(const SbVec4f &u)
Component-wise vector addition operator.
SbVec4f & setValue(const float v[4])
Sets the vector components.
SbVec4f operator-() const
Nondestructive unary negation - returns a new vector.
friend int operator!=(const SbVec4f &v1, const SbVec4f &v2)
Inequality comparison operator.
SbVec4f & operator*=(float d)
Component-wise scalar multiplication operator.
void getReal(SbVec3f &v) const
Returns the real portion of the vector by dividing by the fourth value.
const float * getValue() const
Returns vector components.
SbVec4f & operator-=(const SbVec4f &u)
Component-wise vector subtraction operator.
SbBool equals(const SbVec4f &v, float tolerance) const
Equality comparison within given tolerance - the square of the length of the maximum distance between...
friend SbVec4f operator*(const SbVec4f &v, float d)
Component-wise binary scalar multiplication operator.
SbVec4f & setValue(float x, float y, float z, float w)
Sets the vector components.
friend int operator==(const SbVec4f &v1, const SbVec4f &v2)
Equality comparison operator.
void getValue(float &x, float &y, float &z, float &w) const
Returns vector components.
friend SbVec4f operator+(const SbVec4f &v1, const SbVec4f &v2)
Component-wise binary vector addition operator.
SbVec4f & setValue(const SbVec4d &vec4d)
Sets value of vector from a double precision vector.
SbVec4f(const float v[4])
Constructor given vector components.
SbVec4f()
Default constructor.
SbVec4f(float x, float y, float z, float w)
Constructor given vector components.
friend std::ostream & operator<<(std::ostream &os, const SbVec4f &v)
Writes the vector to the specified output stream.
float dot(const SbVec4f &v) const
Returns dot (inner) product of vector and another vector.
float & operator[](int i)
Accesses indexed component of vector.
friend SbVec4f operator/(const SbVec4f &v, float d)
Component-wise binary scalar division operator.
friend SbVec4i32 operator/(const SbVec4i32 &v, int d)
Component-wise binary scalar division operator.
SbVec4i32(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4i32.
SbVec4i32(int32_t x, int32_t y, int32_t z, int32_t w)
Constructor given 4 individual components.
const int32_t * getValue() const
Returns pointer to array of 4 components.
friend SbVec4i32 operator+(const SbVec4i32 &v1, const SbVec4i32 &v2)
Component-wise binary vector addition operator.
friend int operator!=(const SbVec4i32 &v1, const SbVec4i32 &v2)
Inequality comparison operator.
SbVec4i32 & operator-=(const SbVec4i32 &u)
Component-wise vector subtraction operator.
friend int operator==(const SbVec4i32 &v1, const SbVec4i32 &v2)
Equality comparison operator.
friend SbVec4i32 operator*(const SbVec4i32 &v, int d)
Component-wise binary scalar multiplication operator.
SbVec4i32()
Default constructor.
friend std::ostream & operator<<(std::ostream &os, const SbVec4i32 &v)
Writes the vector to the specified output stream.
SbVec4i32 & operator+=(const SbVec4i32 &u)
Component-wise vector addition operator.
SbVec4i32 & operator*=(int d)
Component-wise scalar multiplication operator.
SbVec4i32 & setValue(const int32_t v[4])
Sets value of vector from array of 4 components.
void getValue(int32_t &x, int32_t &y, int32_t &z, int32_t &w) const
Returns 4 individual components.
SbVec4i32(const int32_t v[4])
Constructor given an array of 4 components.
void negate()
Negates each component of vector in place.
SbVec4i32 operator-() const
Nondestructive unary negation - returns a new vector.
int32_t & operator[](int i)
Accesses indexed component of vector.
SbVec4i32 & setValue(int32_t x, int32_t y, int32_t z, int32_t w)
Sets value of vector from 4 individual components.
int32_t dot(const SbVec4i32 &v) const
Returns dot (inner) product of vector and another vector.
SbVec4i32 & operator/=(int d)
Component-wise scalar division operator.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class.
void negate()
Negates each component of vector in place.
SbVec4s(const short v[4])
Constructor given 4 components.
friend int operator!=(const SbVec4s &v1, const SbVec4s &v2)
Inequality comparison operator.
short & operator[](int i)
Accesses indexed component of vector.
int32_t dot(const SbVec4s &v) const
Returns dot (inner) product of vector and another vector.
const short * getValue() const
Returns vector components.
friend SbVec4s operator/(const SbVec4s &v, int d)
Component-wise binary scalar division operator.
SbVec4s operator-() const
Nondestructive unary negation - returns a new vector.
SbVec4s & operator+=(const SbVec4s &u)
Component-wise vector addition operator.
SbVec4s & operator/=(int d)
Component-wise scalar division operator.
friend SbVec4s operator*(const SbVec4s &v, int d)
Component-wise binary scalar multiplication operator.
void getValue(short &x, short &y, short &z, short &w) const
Returns vector components.
friend std::ostream & operator<<(std::ostream &os, const SbVec4s &v)
Writes the vector to the specified output stream.
SbVec4s & setValue(short x, short y, short z, short w)
Sets vector components.
SbVec4s(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4s.
SbVec4s & operator*=(int d)
Component-wise scalar multiplication operator.
friend int operator==(const SbVec4s &v1, const SbVec4s &v2)
Equality comparison operator.
SbVec4s & operator-=(const SbVec4s &u)
Component-wise vector subtraction operator.
SbVec4s & setValue(const short v[4])
Sets vector components.
SbVec4s(short x, short y, short z, short w)
Constructor given 4 components.
friend SbVec4s operator+(const SbVec4s &v1, const SbVec4s &v2)
Component-wise binary vector addition operator.
SbVec4s()
Default constructor.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class.
void negate()
Negates each component of vector in place.
friend SbVec4ub operator*(const SbVec4ub &v, int d)
Component-wise binary scalar multiplication operator.
int32_t dot(const SbVec4ub &v) const
Returns dot (inner) product of vector and another vector.
SbVec4ub & operator-=(const SbVec4ub &u)
Component-wise vector subtraction operator.
SbVec4ub & setValue(unsigned char x, unsigned char y, unsigned char z, unsigned char w)
Sets vector components.
SbVec4ub operator-() const
Nondestructive unary negation - returns a new vector.
SbVec4ub(const unsigned char v[4])
Constructor given 4 components.
SbVec4ub & operator/=(int d)
Component-wise scalar division operator.
friend SbVec4ub operator/(const SbVec4ub &v, int d)
Component-wise binary scalar division operator.
SbVec4ub & setValue(const unsigned char v[4])
Sets vector components.
void clamp(unsigned char a, unsigned char b)
Clamp each component between a and b.
void getValue(unsigned char &x, unsigned char &y, unsigned char &z, unsigned char &w) const
Returns vector components.
friend int operator!=(const SbVec4ub &v1, const SbVec4ub &v2)
Inequality comparison operator.
unsigned char & operator[](int i)
Accesses indexed component of vector.
SbVec4ub & operator*=(int d)
Component-wise scalar multiplication operator.
const unsigned char * getValue() const
Returns vector components.
friend SbVec4ub operator+(const SbVec4ub &v1, const SbVec4ub &v2)
Component-wise binary vector addition operator.
SbVec4ub & operator+=(const SbVec4ub &u)
Component-wise vector addition operator.
SbVec4ub()
Default constructor.
friend std::ostream & operator<<(std::ostream &os, const SbVec4ub &v)
Writes the vector to the specified output stream.
SbVec4ub(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4ub.
friend int operator==(const SbVec4ub &v1, const SbVec4ub &v2)
Equality comparison operator.
SbVec4ub(unsigned char x, unsigned char y, unsigned char z, unsigned char w)
Constructor given 4 components.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class.
int32_t dot(const SbVec4ui32 &v) const
Returns dot (inner) product of vector and another vector.
friend std::ostream & operator<<(std::ostream &os, const SbVec4ui32 &v)
Writes the vector to the specified output stream.
uint32_t & operator[](int i)
Accesses indexed component of vector.
SbVec4ui32 & setValue(uint32_t x, uint32_t y, uint32_t z, uint32_t w)
Sets vector components.
SbVec4ui32 & setValue(const uint32_t v[4])
Sets vector components.
void getValue(uint32_t &x, uint32_t &y, uint32_t &z, uint32_t &w) const
Returns vector components.
SbVec4ui32 & operator*=(int d)
Component-wise scalar multiplication operator.
friend SbVec4ui32 operator*(const SbVec4ui32 &v, int d)
Component-wise binary scalar multiplication operator.
SbVec4ui32(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4ui32.
SbVec4ui32 & operator-=(const SbVec4ui32 &u)
Component-wise vector subtraction operator.
SbVec4ui32()
Default constructor.
friend SbVec4ui32 operator+(const SbVec4ui32 &v1, const SbVec4ui32 &v2)
Component-wise binary vector addition operator.
friend int operator!=(const SbVec4ui32 &v1, const SbVec4ui32 &v2)
Inequality comparison operator.
const uint32_t * getValue() const
Returns vector components.
SbVec4ui32 & operator+=(const SbVec4ui32 &u)
Component-wise vector addition operator.
SbVec4ui32(uint32_t x, uint32_t y, uint32_t z, uint32_t w)
Constructor given 4 components.
friend SbVec4ui32 operator/(const SbVec4ui32 &v, int d)
Component-wise binary scalar division operator.
SbVec4ui32(const uint32_t v[4])
Constructor given 4 components.
friend SbVec4ui32 operator-(const SbVec4ui32 &v1, const SbVec4ui32 &v2)
Component-wise binary vector subtraction operator.
friend int operator==(const SbVec4ui32 &v1, const SbVec4ui32 &v2)
Equality comparison operator.
SbVec4ui32 & operator/=(int d)
Component-wise scalar division operator.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D vector class.
SbVec4us & operator+=(const SbVec4us &u)
Component-wise vector addition operator.
friend std::ostream & operator<<(std::ostream &os, const SbVec4us &v)
Writes the vector to the specified output stream.
friend int operator!=(const SbVec4us &v1, const SbVec4us &v2)
Inequality comparison operator.
SbVec4us & operator-=(const SbVec4us &u)
Component-wise vector subtraction operator.
SbVec4us & setValue(const unsigned short v[4])
Sets vector components.
friend int operator==(const SbVec4us &v1, const SbVec4us &v2)
Equality comparison operator.
SbVec4us & operator*=(int d)
Component-wise scalar multiplication operator.
SbVec4us & setValue(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
Sets vector components.
SbVec4us(const unsigned short v[4])
Constructor given 4 components.
SbVec4us()
Default constructor.
void negate()
Negates each component of vector in place.
friend SbVec4us operator/(const SbVec4us &v, int d)
Component-wise binary scalar division operator.
unsigned short & operator[](int i)
Accesses indexed component of vector.
SbVec4us operator-() const
Nondestructive unary negation - returns a new vector.
SbVec4us(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
Constructor given 4 components.
friend SbVec4us operator*(const SbVec4us &v, int d)
Component-wise binary scalar multiplication operator.
const unsigned short * getValue() const
Returns vector components.
int32_t dot(const SbVec4us &v) const
Returns dot (inner) product of vector and another vector.
void getValue(unsigned short &x, unsigned short &y, unsigned short &z, unsigned short &w) const
Returns vector components.
friend SbVec4us operator+(const SbVec4us &v1, const SbVec4us &v2)
Component-wise binary vector addition operator.
SbVec4us(const T &v)
Constructor that converts an arbitrary SbVec4 to an SbVec4us.
SbVec4us & operator/=(int d)
Component-wise scalar division operator.
T Clamp(T a, T minV, T maxV)
Clamps value to given range [minV, maxV].