1 #ifndef COIN_SBVEC3US_H 2 #define COIN_SBVEC3US_H 37 #include <Inventor/SbBasic.h> 38 #include <Inventor/system/inttypes.h> 39 #include <Inventor/SbByteBuffer.h> 40 #include <Inventor/SbString.h> 43 #include <Inventor/errors/SoDebugError.h> 53 SbVec3us(
const unsigned short v[3]) { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2]; }
54 SbVec3us(
unsigned short x,
unsigned short y,
unsigned short z) { vec[0] = x; vec[1] = y; vec[2] = z; }
59 SbVec3us & setValue(
const unsigned short v[3]) { vec[0] = v[0]; vec[1] = v[1]; vec[2] = v[2];
return *
this; }
60 SbVec3us & setValue(
unsigned short x,
unsigned short y,
unsigned short z) { vec[0] = x; vec[1] = y; vec[2] = z;
return *
this; }
65 const unsigned short * getValue(
void)
const {
return vec; }
66 void getValue(
unsigned short & x,
unsigned short & y,
unsigned short & z)
const { x = vec[0]; y = vec[1]; z = vec[2]; }
68 unsigned short & operator [] (
int i) {
return vec[i]; }
69 const unsigned short & operator [] (
int i)
const {
return vec[i]; }
71 int32_t dot(
const SbVec3us & v)
const {
return vec[0] * v[0] + vec[1] * v[1] + vec[2] * v[2]; }
74 SbVec3us & operator *= (
int d) { vec[0] *= d; vec[1] *= d; vec[2] *= d;
return *
this; }
76 SbVec3us & operator /= (
int d) { SbDividerChk(
"SbVec3us::operator/=(int)", d); vec[0] /= d; vec[1] /= d; vec[2] /= d;
return *
this; }
77 SbVec3us & operator /= (
double d) { SbDividerChk(
"SbVec3us::operator/=(double)", d);
return operator *= (1.0 / d); }
78 SbVec3us & operator += (
const SbVec3us & v) { vec[0] += v[0]; vec[1] += v[1]; vec[2] += v[2];
return *
this; }
79 SbVec3us & operator -= (
const SbVec3us & v) { vec[0] -= v[0]; vec[1] -= v[1]; vec[2] -= v[2];
return *
this; }
80 SbVec3us operator - (
void)
const {
SbVec3us v(*
this); v.negate();
return v; }
83 unsigned short vec[3];
88 SbVec3us val(v); val *= d;
return val;
92 SbVec3us val(v); val *= d;
return val;
96 SbVec3us val(v); val *= d;
return val;
100 SbVec3us val(v); val *= d;
return val;
104 SbDividerChk(
"operator/(SbVec3us,int)", d);
105 SbVec3us val(v); val /= d;
return val;
109 SbDividerChk(
"operator/(SbVec3us,double)", d);
110 SbVec3us val(v); val /= d;
return val;
121 COIN_DLL_API
inline int operator == (
const SbVec3us & v1,
const SbVec3us & v2) {
122 return ((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2]));
125 COIN_DLL_API
inline int operator != (
const SbVec3us & v1,
const SbVec3us & v2) {
129 #endif // !COIN_SBVEC3US_H The SbVec3s class is a 3 dimensional vector with short integer coordinates.This vector class provides...
Definition: SbVec3s.h:51
Definition: SbVec3us.h:50
Definition: SbVec3ub.h:46
Definition: SbVec3ui32.h:46