23 #if GEOM_PSEUDO3D==GEOM_TRUE
24 namespace GEOM_FADE25D {
25 #elif GEOM_PSEUDO3D==GEOM_FALSE
26 namespace GEOM_FADE2D {
28 #error GEOM_PSEUDO3D is not defined
31 class CLASS_DECLSPEC Vector2;
41 #if GEOM_PSEUDO3D==GEOM_TRUE
45 Vector2(
const double x_,
const double y_,
const double z_);
84 #if GEOM_PSEUDO3D==GEOM_TRUE
90 Vector2 orthogonalVector()
const;
107 #if GEOM_PSEUDO3D==GEOM_TRUE
114 #if GEOM_PSEUDO3D==GEOM_TRUE
117 void set(
const double x_,
const double y_,
const double z_);
122 void set(
const double x_,
const double y_);
130 #if GEOM_PSEUDO3D==GEOM_TRUE
135 int getMaxIndex()
const;
147 #if GEOM_PSEUDO3D==GEOM_TRUE
160 #if GEOM_PSEUDO3D==GEOM_TRUE
172 #if GEOM_PSEUDO3D==GEOM_TRUE
174 Vector2 operator/(
double val)
const;
185 #if GEOM_PSEUDO3D==GEOM_TRUE
201 #if GEOM_PSEUDO3D==GEOM_TRUE
202 stream <<
"Vector2: "<<vec.
x()<<
", "<<vec.
y()<<
", "<<vec.z();
204 stream <<
"Vector2: "<<vec.
x()<<
", "<<vec.
y();
209 #if GEOM_PSEUDO3D==GEOM_TRUE
215 inline Vector2 crossProduct(
const Vector2& vec0,
const Vector2& vec1)
217 double x=vec0.y() * vec1.z() - vec0.z() * vec1.y();
218 double y=vec0.z() * vec1.x() - vec0.x() * vec1.z();
219 double z=vec0.x() * vec1.y() - vec0.y() * vec1.x();
220 return Vector2(x,y,z);
232 double len(other.
length());
233 #if GEOM_PSEUDO3D==GEOM_TRUE
236 return Vector2(other.
x()/len,other.
y()/len,other.z()/len);
242 std::cout<<
"\n\n** warning: normalize(const Vector2& other), Null length vector!"<<std::endl;
256 return Vector2(other.
x()/len,other.
y()/len);
260 std::cout<<
"warning: normalize(const Vector2& other), Null length vector!"<<std::endl;
273 #if GEOM_PSEUDO3D==GEOM_TRUE
288 #if GEOM_PSEUDO3D==GEOM_TRUE
289 return Vector2(d*vec.
x(),d*vec.
y(),d*vec.z());
303 #if GEOM_PSEUDO3D==GEOM_TRUE
304 return Vector2(vec0.
x()+vec1.
x(), vec0.
y()+vec1.
y() , vec0.z()+vec1.z());
306 return Vector2(vec0.
x()+vec1.
x(), vec0.
y()+vec1.
y() );
318 #if GEOM_PSEUDO3D==GEOM_TRUE
319 return Vector2(vec0.
x()-vec1.
x(), vec0.
y()-vec1.
y() , vec0.z()-vec1.z());
321 return Vector2(vec0.
x()-vec1.
x(), vec0.
y()-vec1.
y() );
std::ostream & operator<<(std::ostream &stream, const Bbox2 &pC)
Print the box.
Definition: Bbox2.h:492
Vector2 normalize(const Vector2 &other)
Normalize a vector.
Definition: Vector2.h:230
Vector2 operator+(const Vector2 &vec0, const Vector2 &vec1)
Addition.
Definition: Vector2.h:301
Vector2 operator-(const Vector2 &in)
Opposite vector.
Definition: Vector2.h:271
Vector2 operator*(double d, const Vector2 &vec)
Multiplication with a scalar.
Definition: Vector2.h:286
Vector.
Definition: Vector2.h:38
double sqLength() const
Get the squared length of the vector.
Vector2(const Vector2 &v_)
Copy constructor.
Vector2()
Default constructor.
void set(const double x_, const double y_)
Set the values.
bool isDegenerate() const
isDegenerate
Vector2 operator*(double val) const
Multiplication.
double y() const
Get the y-value.
double operator*(const Vector2 &other) const
Scalar product.
Vector2 & operator=(const Vector2 &other)
Assignment operator.
double length() const
Get the length of the vector.
Vector2(const double x_, const double y_)
Constructor.
double x() const
Get the x-value.
Vector2 operator/(double val) const
Division.