27 #include <Inventor/SbBasic.h> 28 #include <Inventor/system/inttypes.h> 30 #include <Inventor/errors/SoDebugError.h> 40 SbVec2b(
const int8_t v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
41 SbVec2b(int8_t x, int8_t y) { vec[0] = x; vec[1] = y; }
46 SbVec2b &
setValue(
const int8_t v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
52 const int8_t *
getValue(
void)
const {
return vec; }
53 void getValue(int8_t & x, int8_t & y)
const { x = vec[0]; y = vec[1]; }
55 int8_t & operator [] (
int i) {
return vec[i]; }
56 const int8_t & operator [] (
int i)
const {
return vec[i]; }
58 int32_t
dot(
SbVec2b v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
59 void negate(
void) { vec[0] = -vec[0]; vec[1] = -vec[1]; }
61 SbVec2b & operator *= (
int d) { vec[0] *= d; vec[1] *= d;
return *
this; }
62 SbVec2b & operator *= (
double d);
63 SbVec2b & operator /= (
int d) { SbDividerChk(
"SbVec2b::operator/=(int)", d); vec[0] /= d; vec[1] /= d;
return *
this; }
64 SbVec2b & operator /= (
double d) { SbDividerChk(
"SbVec2b::operator/=(double)", d);
return operator *= (1.0 / d); }
65 SbVec2b & operator += (
SbVec2b v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
66 SbVec2b & operator -= (
SbVec2b v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
75 SbVec2b val(v); val *= d;
return val;
79 SbVec2b val(v); val *= d;
return val;
83 SbVec2b val(v); val *= d;
return val;
87 SbVec2b val(v); val *= d;
return val;
91 SbDividerChk(
"operator/(SbVec2b,int)", d);
92 SbVec2b val(v); val /= d;
return val;
96 SbDividerChk(
"operator/(SbVec2b,double)", d);
97 SbVec2b val(v); val /= d;
return val;
101 SbVec2b v(v1); v += v2;
return v;
105 SbVec2b v(v1); v -= v2;
return v;
109 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
116 #endif // !COIN_SBVEC2B_H SbVec2b(const SbVec2s &v)
Definition: SbVec2b.h:43
The SbVec2b class is a 2 dimensional vector with 8-bit integer coordinates.
Definition: SbVec2b.h:37
const int8_t * getValue(void) const
Definition: SbVec2b.h:52
SbVec2b & setValue(int8_t x, int8_t y)
Definition: SbVec2b.h:47
int32_t dot(SbVec2b v) const
Definition: SbVec2b.h:58
SbVec2b(int8_t x, int8_t y)
Definition: SbVec2b.h:41
SbVec2b(const SbVec2ub &v)
Definition: SbVec2b.h:42
SbVec2b(void)
Definition: SbVec2b.h:39
The SbVec2i32 class is a 2 dimensional vector with 32-bit integer coordinates.
Definition: SbVec2i32.h:39
SbVec2b(const int8_t v[2])
Definition: SbVec2b.h:40
void negate(void)
Definition: SbVec2b.h:59
SbVec2b(const SbVec2i32 &v)
Definition: SbVec2b.h:44
SbVec2b & setValue(const int8_t v[2])
Definition: SbVec2b.h:46
void getValue(int8_t &x, int8_t &y) const
Definition: SbVec2b.h:53
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:37
The SbVec2ub class is a 2 dimensional vector with unsigned 8-bit integer coordinates.
Definition: SbVec2ub.h:37