46class COIN_DLL_API SbVec2us {
49 SbVec2us(
const unsigned short v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
50 SbVec2us(
unsigned short x,
unsigned short y) { vec[0] = x; vec[1] = y; }
51 explicit SbVec2us(
const SbVec2s & v) { setValue(v); }
52 explicit SbVec2us(
const SbVec2ub & v) { setValue(v); }
53 explicit SbVec2us(
const SbVec2ui32 & v) { setValue(v); }
55 SbVec2us & setValue(
const unsigned short v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
56 SbVec2us & setValue(
unsigned short x,
unsigned short y) { vec[0] = x; vec[1] = y;
return *
this; }
57 SbVec2us & setValue(
const SbVec2s & v);
58 SbVec2us & setValue(
const SbVec2ub & v);
61 const unsigned short * getValue(
void)
const {
return vec; }
62 void getValue(
unsigned short & x,
unsigned short & y)
const { x = vec[0]; y = vec[1]; }
64 unsigned short & operator [] (
int i) {
return vec[i]; }
65 const unsigned short & operator [] (
int i)
const {
return vec[i]; }
67 int32_t dot(SbVec2us v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
70 SbVec2us & operator *= (
int d) { vec[0] = (
unsigned short)(vec[0] * d); vec[1] = (
unsigned short)(vec[1] * d);
return *
this; }
71 SbVec2us & operator *= (
double d);
72 SbVec2us & operator /= (
int d) { SbDividerChk(
"SbVec2us::operator/=(int)", d); vec[0] = (
unsigned short)(vec[0] / d); vec[1] = (
unsigned short)(vec[1] / d);
return *
this; }
73 SbVec2us & operator /= (
double d) { SbDividerChk(
"SbVec2us::operator/=(double)", d);
return operator *= (1.0 / d); }
74 SbVec2us & operator += (SbVec2us v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
75 SbVec2us & operator -= (SbVec2us v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
76 SbVec2us operator - (
void)
const { SbVec2us v(*
this); v.negate();
return v; }
79 unsigned short vec[2];