1 #ifndef COIN_SBVEC2US_H
2 #define COIN_SBVEC2US_H
27 #include <Inventor/SbBasic.h>
28 #include <Inventor/system/inttypes.h>
30 #include <Inventor/errors/SoDebugError.h>
40 SbVec2us(
const unsigned short v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
41 SbVec2us(
unsigned short x,
unsigned short y) { vec[0] = x; vec[1] = y; }
46 SbVec2us & setValue(
const unsigned short v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
47 SbVec2us & setValue(
unsigned short x,
unsigned short y) { vec[0] = x; vec[1] = y;
return *
this; }
52 const unsigned short * getValue(
void)
const {
return vec; }
53 void getValue(
unsigned short & x,
unsigned short & y)
const { x = vec[0]; y = vec[1]; }
55 unsigned short & operator [] (
int i) {
return vec[i]; }
56 const unsigned short & operator [] (
int i)
const {
return vec[i]; }
58 int32_t dot(
SbVec2us v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
61 SbVec2us & operator *= (
int d) { vec[0] *= d; vec[1] *= d;
return *
this; }
63 SbVec2us & operator /= (
int d) { SbDividerChk(
"SbVec2us::operator/=(int)", d); vec[0] /= d; vec[1] /= d;
return *
this; }
64 SbVec2us & operator /= (
double d) { SbDividerChk(
"SbVec2us::operator/=(double)", d);
return operator *= (1.0 / d); }
65 SbVec2us & operator += (
SbVec2us v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
66 SbVec2us & operator -= (
SbVec2us v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
67 SbVec2us operator - (
void)
const {
SbVec2us v(*
this); v.negate();
return v; }
70 unsigned short vec[2];
75 SbVec2us val(v); val *= d;
return val;
79 SbVec2us val(v); val *= d;
return val;
83 SbVec2us val(v); val *= d;
return val;
87 SbVec2us val(v); val *= d;
return val;
91 SbDividerChk(
"operator/(SbVec2us,int)", d);
92 SbVec2us val(v); val /= d;
return val;
96 SbDividerChk(
"operator/(SbVec2us,double)", d);
97 SbVec2us val(v); val /= d;
return val;
109 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
116 #endif // !COIN_SBVEC2US_H
int operator!=(const SbBox2d &b1, const SbBox2d &b2)
Definition: SbBox2d.h:92
int operator==(const SbBox2d &b1, const SbBox2d &b2)
Definition: SbBox2d.h:88
Definition: SbVec2ui32.h:37
Definition: SbVec2us.h:37
SbVec2d operator*(const SbVec2d &v, double d)
Definition: SbVec2d.h:82
SbVec2d operator-(const SbVec2d &v1, const SbVec2d &v2)
Definition: SbVec2d.h:99
SbVec2d operator/(const SbVec2d &v, double d)
Definition: SbVec2d.h:90
SbVec2d operator+(const SbVec2d &v1, const SbVec2d &v2)
Definition: SbVec2d.h:95
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:41
Definition: SbVec2ub.h:37