45 this->vec[0] = v[0]; this->vec[1] = v[1]; this->vec[2] = v[2];
48 SbVec3(
const Type x,
const Type y,
const Type z) {
49 this->vec[0] = x; this->vec[1] = y; this->vec[2] = z;
53 this->vec[0] = v[0]; this->vec[1] = v[1]; this->vec[2] = v[2];
57 SbVec3<Type> & setValue(
const Type x,
const Type y,
const Type z) {
58 this->vec[0] = x; this->vec[1] = y; this->vec[2] = z;
62 const Type * getValue(
void)
const {
66 void getValue(Type & x, Type & y, Type & z)
const {
67 x = this->vec[0]; y = this->vec[1]; z = this->vec[2];
71 return SbVec3<Type>(this->vec[1]*v.vec[2] - this->vec[2]*v.vec[1],
72 this->vec[2]*v.vec[0] - this->vec[0]*v.vec[2],
73 this->vec[0]*v.vec[1] - this->vec[1]*v.vec[0]);
77 return this->vec[0]*v.vec[0] + this->vec[1]*v.vec[1] + this->vec[2]*v.vec[2];
80 Type sqrLength(
void)
const {
81 return this->vec[0]*this->vec[0] + this->vec[1]*this->vec[1] + this->vec[2]*this->vec[2];
84 double length(
void)
const {
85 return sqrt(this->sqrLength());
88 double normalize(
void) {
89 const double len = this->length();
91 operator /= ((Type) len);
97 this->vec[0] = -this->vec[0];
98 this->vec[1] = -this->vec[1];
99 this->vec[2] = -this->vec[2];
110 return operator *= (((Type) 1.0) / d);
114 this->vec[0] += u.vec[0];
115 this->vec[1] += u.vec[1];
116 this->vec[2] += u.vec[2];
120 this->vec[0] -= u.vec[0];
121 this->vec[1] -= u.vec[1];
122 this->vec[2] -= u.vec[2];
127 return SbVec3<Type>(-this->vec[0], -this->vec[1], -this->vec[2]);
131 return SbVec3<Type>(this->vec[0] + v.vec[0], this->vec[1] + v.vec[1], this->vec[2] + v.vec[2]);
135 return SbVec3<Type>(this->vec[0] - v.vec[0], this->vec[1] - v.vec[1], this->vec[2] - v.vec[2]);
139 return SbVec3<Type>(this->vec[0] * f, this->vec[1] * f, this->vec[2] * f);
143 return SbVec3<Type>(this->vec[0] / f, this->vec[1] / f, this->vec[2] / f);
146 Type & operator [] (
int idx) {
147 return this->vec[idx];
150 const Type & operator [] (
int idx)
const {
151 return this->vec[idx];