36 #include <Inventor/SbBasic.h> 37 #include <Inventor/system/inttypes.h> 39 #include <Inventor/errors/SoDebugError.h> 51 SbVec2b(
const int8_t v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
52 SbVec2b(int8_t x, int8_t y) { vec[0] = x; vec[1] = y; }
59 SbVec2b & setValue(
const int8_t v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
60 SbVec2b & setValue(int8_t x, int8_t y) { vec[0] = x; vec[1] = y;
return *
this; }
67 const int8_t * getValue(
void)
const {
return vec; }
68 void getValue(int8_t & x, int8_t & y)
const { x = vec[0]; y = vec[1]; }
70 int8_t & operator [] (
int i) {
return vec[i]; }
71 const int8_t & operator [] (
int i)
const {
return vec[i]; }
73 int32_t dot(
SbVec2b v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
74 void negate(
void) { vec[0] = -vec[0]; vec[1] = -vec[1]; }
76 SbVec2b & operator *= (
int d) { vec[0] = int8_t(vec[0] * d); vec[1] = int8_t(vec[1] * d);
return *
this; }
77 SbVec2b & operator *= (
double d);
78 SbVec2b & operator /= (
int d) { SbDividerChk(
"SbVec2b::operator/=(int)", d); vec[0] = int8_t(vec[0] / d); vec[1] = int8_t(vec[1] / d);
return *
this; }
79 SbVec2b & operator /= (
double d) { SbDividerChk(
"SbVec2b::operator/=(double)", d);
return operator *= (1.0 / d); }
80 SbVec2b & operator += (
SbVec2b v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
81 SbVec2b & operator -= (
SbVec2b v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
82 SbVec2b operator - (
void)
const {
return SbVec2b(-vec[0], -vec[1]); }
90 SbVec2b val(v); val *= d;
return val;
94 SbVec2b val(v); val *= d;
return val;
98 SbVec2b val(v); val *= d;
return val;
102 SbVec2b val(v); val *= d;
return val;
106 SbDividerChk(
"operator/(SbVec2b,int)", d);
107 SbVec2b val(v); val /= d;
return val;
111 SbDividerChk(
"operator/(SbVec2b,double)", d);
112 SbVec2b val(v); val /= d;
return val;
116 SbVec2b v(v1); v += v2;
return v;
120 SbVec2b v(v1); v -= v2;
return v;
124 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
131 #endif // !COIN_SBVEC2B_H The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition: SbVec2f.h:49
a vector class for containing two byte integers.
Definition: SbVec2b.h:48
int operator==(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:102
SbVec2s operator-(const SbVec2s &v1, const SbVec2s &v2)
int operator!=(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:106
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
SbVec2s operator/(const SbVec2s &v, int d)
SbVec2s operator*(const SbVec2s &v, int d)
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition: SbVec2s.h:51
Definition: SbVec2ub.h:46
SbVec2s operator+(const SbVec2s &v1, const SbVec2s &v2)