38 #include <Inventor/SbBasic.h> 39 #include <Inventor/system/inttypes.h> 40 #include <Inventor/SbString.h> 42 #include <Inventor/errors/SoDebugError.h> 54 SbVec2s(
const short v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
55 SbVec2s(
short x,
short y) { vec[0] = x; vec[1] = y; }
62 SbVec2s &
setValue(
const short v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
70 const short *
getValue(
void)
const {
return vec; }
71 void getValue(
short & x,
short & y)
const { x = vec[0]; y = vec[1]; }
73 short & operator [] (
int i) {
return vec[i]; }
74 const short & operator [] (
int i)
const {
return vec[i]; }
76 int32_t
dot(
SbVec2s v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
77 void negate(
void) { vec[0] = -vec[0]; vec[1] = -vec[1]; }
79 SbVec2s & operator *= (
int d) { vec[0] = short(vec[0] * d); vec[1] = short(vec[1] * d);
return *
this; }
80 SbVec2s & operator *= (
double d);
81 SbVec2s & operator /= (
int d) { SbDividerChk(
"SbVec2s::operator/=(int)", d); vec[0] = short(vec[0] / d); vec[1] = short(vec[1] / d);
return *
this; }
82 SbVec2s & operator /= (
double d) { SbDividerChk(
"SbVec2s::operator/=(double)", d);
return operator *= (1.0 / d); }
83 SbVec2s & operator += (
SbVec2s v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
84 SbVec2s & operator -= (
SbVec2s v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
88 SbBool fromString(
const SbString & str);
90 void print(FILE * fp)
const;
98 SbVec2s val(v); val *= d;
return val;
102 SbVec2s val(v); val *= d;
return val;
106 SbVec2s val(v); val *= d;
return val;
110 SbVec2s val(v); val *= d;
return val;
114 SbDividerChk(
"operator/(SbVec2s,int)", d);
115 SbVec2s val(v); val /= d;
return val;
119 SbDividerChk(
"operator/(SbVec2s,double)", d);
120 SbVec2s val(v); val /= d;
return val;
124 SbVec2s v(v1); v += v2;
return v;
128 SbVec2s v(v1); v -= v2;
return v;
132 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
139 #endif // !COIN_SBVEC2S_H The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:49
void getValue(short &x, short &y) const
Definition: SbVec2s.h:71
a vector class for containing two byte integers.
Definition: SbVec2b.h:48
void negate(void)
Definition: SbVec2s.h:77
SbVec2s(const short v[2])
Definition: SbVec2s.h:54
SbVec2s(short x, short y)
Definition: SbVec2s.h:55
SbVec2s & setValue(const short v[2])
Definition: SbVec2s.h:62
const short * getValue(void) const
Definition: SbVec2s.h:70
Definition: SbVec2us.h:46
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:48
int32_t dot(SbVec2s v) const
Definition: SbVec2s.h:76
SbVec2s(const SbVec2b &v)
Definition: SbVec2s.h:57
The SbVec2i32 class is a 2 dimensional vector with short integer coordinates.This vector class is use...
Definition: SbVec2i32.h:50
SbVec2s & setValue(short x, short y)
Definition: SbVec2s.h:63
SbVec2s(const SbVec2d &v)
Definition: SbVec2s.h:60
SbVec2s(void)
Definition: SbVec2s.h:53
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:52
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:51
SbVec2s(const SbVec2f &v)
Definition: SbVec2s.h:59
SbVec2s(const SbVec2us &v)
Definition: SbVec2s.h:56
SbVec2s(const SbVec2i32 &v)
Definition: SbVec2s.h:58