38 #include <Inventor/SbBasic.h> 39 #include <Inventor/SbString.h> 41 #include <Inventor/errors/SoDebugError.h> 52 SbVec2f(
const float v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
53 SbVec2f(
float x,
float y) { vec[0] = x; vec[1] = y; }
59 SbVec2f &
setValue(
const float v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
66 const float *
getValue(
void)
const {
return vec; }
67 void getValue(
float & x,
float & y)
const { x = vec[0]; y = vec[1]; }
69 float & operator [] (
int i) {
return vec[i]; }
70 const float & operator [] (
int i)
const {
return vec[i]; }
72 float dot(
const SbVec2f & v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
73 SbBool equals(
const SbVec2f & v,
float tolerance)
const;
74 float length(
void)
const;
75 float sqrLength(
void)
const {
return vec[0] * vec[0] + vec[1] * vec[1]; }
76 void negate(
void) { vec[0] = -vec[0]; vec[1] = -vec[1]; }
77 float normalize(
void);
79 SbVec2f & operator *= (
float d) { vec[0] *= d; vec[1] *= d;
return *
this; }
80 SbVec2f & operator /= (
float d) { SbDividerChk(
"SbVec2f::operator/=(float)", d);
return operator *= (1.0f / d); }
81 SbVec2f & operator += (
const SbVec2f & v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
82 SbVec2f & operator -= (
const SbVec2f & v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
86 SbBool fromString(
const SbString & str);
88 void print(FILE * fp)
const;
96 SbVec2f val(v); val *= d;
return val;
100 SbVec2f val(v); val *= d;
return val;
104 SbDividerChk(
"operator/(SbVec2f,float)", d);
105 SbVec2f val(v); val /= d;
return val;
109 SbVec2f v(v1); v += v2;
return v;
113 SbVec2f v(v1); v -= v2;
return v;
117 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
126 #endif // !COIN_SBVEC2F_H The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition: SbVec2f.h:49
void getValue(float &x, float &y) const
Definition: SbVec2f.h:67
SbVec2f(void)
Definition: SbVec2f.h:51
float dot(const SbVec2f &v) const
Definition: SbVec2f.h:72
a vector class for containing two byte integers.
Definition: SbVec2b.h:48
SbVec2f(const SbVec2i32 &v)
Definition: SbVec2f.h:57
int operator==(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:102
void negate(void)
Definition: SbVec2f.h:76
SbVec2f(const SbVec2s &v)
Definition: SbVec2f.h:56
SbVec2s operator-(const SbVec2s &v1, const SbVec2s &v2)
int operator!=(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:106
SbVec2f(const SbVec2d &v)
Definition: SbVec2f.h:54
float sqrLength(void) const
Definition: SbVec2f.h:75
The SbVec2d class is a 2 dimensional vector with double precision floating point coordinates.
Definition: SbVec2d.h:48
The SbVec2i32 class is a 2 dimensional vector with 32-bit signed integer coordinates.
Definition: SbVec2i32.h:50
SbVec2f & setValue(float x, float y)
Definition: SbVec2f.h:60
SbVec2f & setValue(const float v[2])
Definition: SbVec2f.h:59
SbVec2f(float x, float y)
Definition: SbVec2f.h:53
SbVec2s operator/(const SbVec2s &v, int d)
SbVec2s operator*(const SbVec2s &v, int d)
The SbString class is a string class with convenience functions for string operations.
Definition: SbString.h:52
SbVec2f(const float v[2])
Definition: SbVec2f.h:52
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition: SbVec2s.h:51
SbVec2f(const SbVec2b &v)
Definition: SbVec2f.h:55
const float * getValue(void) const
Definition: SbVec2f.h:66
SbVec2s operator+(const SbVec2s &v1, const SbVec2s &v2)