38 #include <Inventor/SbBasic.h> 40 #include <Inventor/errors/SoDebugError.h> 51 SbVec2d(
const double v[2]) { vec[0] = v[0]; vec[1] = v[1]; }
52 SbVec2d(
double x,
double y) { vec[0] = x; vec[1] = y; }
58 SbVec2d &
setValue(
const double v[2]) { vec[0] = v[0]; vec[1] = v[1];
return *
this; }
65 const double *
getValue(
void)
const {
return vec; }
66 void getValue(
double & x,
double & y)
const { x = vec[0]; y = vec[1]; }
68 double & operator [] (
int i) {
return vec[i]; }
69 const double & operator [] (
int i)
const {
return vec[i]; }
71 SbBool equals(
const SbVec2d & v,
double tolerance)
const;
72 double dot(
const SbVec2d & v)
const {
return vec[0] * v[0] + vec[1] * v[1]; }
73 double length(
void)
const;
74 double sqrLength(
void)
const {
return vec[0]*vec[0] + vec[1]*vec[1]; }
75 double normalize(
void);
76 void negate(
void) { vec[0] = -vec[0]; vec[1] = -vec[1]; }
78 SbVec2d & operator *= (
double d) { vec[0] *= d; vec[1] *= d;
return *
this; }
79 SbVec2d & operator /= (
double d) { SbDividerChk(
"SbVec2d::operator/=(double)", d);
return operator *= (1.0 / d); }
80 SbVec2d & operator += (
const SbVec2d & v) { vec[0] += v[0]; vec[1] += v[1];
return *
this; }
81 SbVec2d & operator -= (
const SbVec2d & v) { vec[0] -= v[0]; vec[1] -= v[1];
return *
this; }
84 void print(FILE * fp)
const;
92 SbVec2d val(v); val *= d;
return val;
96 SbVec2d val(v); val *= d;
return val;
100 SbDividerChk(
"operator/(SbVec2d,double)", d);
101 SbVec2d val(v); val /= d;
return val;
105 SbVec2d v(v1); v += v2;
return v;
109 SbVec2d v(v1); v -= v2;
return v;
113 return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
122 #endif // !COIN_SBVEC2D_H The SbVec2f class is a 2 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec2f.h:49
SbVec2d(void)
Definition: SbVec2d.h:50
a vector class for containing two byte integers.
Definition: SbVec2b.h:48
SbVec2d(const SbVec2i32 &v)
Definition: SbVec2d.h:56
SbVec2d & setValue(double x, double y)
Definition: SbVec2d.h:59
double dot(const SbVec2d &v) const
Definition: SbVec2d.h:72
const double * getValue(void) const
Definition: SbVec2d.h:65
SbVec2d & setValue(const double v[2])
Definition: SbVec2d.h:58
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
SbVec2d(double x, double y)
Definition: SbVec2d.h:52
The SbVec2i32 class is a 2 dimensional vector with short integer coordinates.This vector class is use...
Definition: SbVec2i32.h:50
void negate(void)
Definition: SbVec2d.h:76
SbVec2d(const SbVec2b &v)
Definition: SbVec2d.h:54
SbVec2d(const double v[2])
Definition: SbVec2d.h:51
SbVec2d(const SbVec2s &v)
Definition: SbVec2d.h:55
SbVec2d(const SbVec2f &v)
Definition: SbVec2d.h:53
The SbVec2s class is a 2 dimensional vector with short integer coordinates.This vector class is used ...
Definition: SbVec2s.h:51
void getValue(double &x, double &y) const
Definition: SbVec2d.h:66