29 #include <Inventor/SbBasic.h>
31 #include <Inventor/errors/SoDebugError.h>
42 SbVec2f(
const float v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
43 SbVec2f(
float x,
float y) { vec[0] = x; vec[1] = y; }
49 SbVec2f &
setValue(
const float v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
56 const float *
getValue(
void)
const {
return vec; }
57 void getValue(
float & x,
float & y)
const { x = vec[0]; y = vec[1]; }
59 float & operator [] (
int i) {
return vec[i]; }
60 const float & operator [] (
int i)
const {
return vec[i]; }
62 float dot(
const SbVec2f & v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
63 SbBool equals(
const SbVec2f & v,
float tolerance)
const;
64 float length(
void)
const;
65 float sqrLength(
void)
const {
return vec[0] * vec[0] + vec[1] * vec[1]; }
66 void negate(
void) { vec[0] = -vec[0]; vec[1] = -vec[1]; }
67 float normalize(
void);
69 SbVec2f & operator *= (
float d) { vec[0] *= d; vec[1] *= d;
return *
this; }
70 SbVec2f & operator /= (
float d) { SbDividerChk(
"SbVec2f::operator/=(float)", d);
return operator *= (1.0f / d); }
71 SbVec2f & operator += (
const SbVec2f & v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
72 SbVec2f & operator -= (
const SbVec2f & v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
75 void print(FILE * fp)
const;
83 SbVec2f val(v); val *= d;
return val;
87 SbVec2f val(v); val *= d;
return val;
91 SbDividerChk(
"operator/(SbVec2f,float)", d);
92 SbVec2f val(v); val /= d;
return val;
96 SbVec2f v(v1); v += v2;
return v;
100 SbVec2f v(v1); v -= v2;
return v;
104 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
113 #endif // !COIN_SBVEC2F_H
The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:39
SbVec2f(void)
Definition: SbVec2f.h:41
a vector class for containing two byte integers.
Definition: SbVec2b.h:39
int operator!=(const SbBox2d &b1, const SbBox2d &b2)
Definition: SbBox2d.h:92
float dot(const SbVec2f &v) const
Definition: SbVec2f.h:62
int operator==(const SbBox2d &b1, const SbBox2d &b2)
Definition: SbBox2d.h:88
const float * getValue(void) const
Definition: SbVec2f.h:56
SbVec2f(const SbVec2i32 &v)
Definition: SbVec2f.h:47
void negate(void)
Definition: SbVec2f.h:66
SbVec2f(const SbVec2s &v)
Definition: SbVec2f.h:46
SbVec2f(const SbVec2d &v)
Definition: SbVec2f.h:44
The SbVec2d class is a 2 dimensional vector with double precision floating point coordinates.This vector class is used by many other classes in Coin. It provides storage for a vector in 2 dimensions aswell as simple floating point arithmetic operations on this vector.
Definition: SbVec2d.h:39
SbVec2d operator*(const SbVec2d &v, double d)
Definition: SbVec2d.h:82
SbVec2d operator-(const SbVec2d &v1, const SbVec2d &v2)
Definition: SbVec2d.h:99
The SbVec2i32 class is a 2 dimensional vector with short integer coordinates.This vector class is use...
Definition: SbVec2i32.h:41
SbVec2f & setValue(float x, float y)
Definition: SbVec2f.h:50
SbVec2f & setValue(const float v[2])
Definition: SbVec2f.h:49
SbVec2d operator/(const SbVec2d &v, double d)
Definition: SbVec2d.h:90
SbVec2f(float x, float y)
Definition: SbVec2f.h:43
SbVec2d operator+(const SbVec2d &v1, const SbVec2d &v2)
Definition: SbVec2d.h:95
SbVec2f(const float v[2])
Definition: SbVec2f.h:42
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:41
SbVec2f(const SbVec2b &v)
Definition: SbVec2f.h:45
void getValue(float &x, float &y) const
Definition: SbVec2f.h:57
float sqrLength(void) const
Definition: SbVec2f.h:65