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
32 class CLASS_DECLSPEC Vector2;
45 #if GEOM_PSEUDO3D==GEOM_TRUE
49 Vector2(
const double x_,
const double y_,
const double z_);
70 Vector2(
const double x_,
const double y_);
88 #if GEOM_PSEUDO3D==GEOM_TRUE
111 #if GEOM_PSEUDO3D==GEOM_TRUE
118 #if GEOM_PSEUDO3D==GEOM_TRUE
121 void set(
const double x_,
const double y_,
const double z_);
126 void set(
const double x_,
const double y_);
134 #if GEOM_PSEUDO3D==GEOM_TRUE
151 #if GEOM_PSEUDO3D==GEOM_TRUE
164 #if GEOM_PSEUDO3D==GEOM_TRUE
176 #if GEOM_PSEUDO3D==GEOM_TRUE
181 Vector2 operator/(
double val)
const;
189 #if GEOM_PSEUDO3D==GEOM_TRUE
203 inline std::ostream &operator<<(std::ostream &stream,
const Vector2& vec)
205 #if GEOM_PSEUDO3D==GEOM_TRUE
206 stream <<
"Vector2: "<<vec.
x()<<
", "<<vec.
y()<<
", "<<vec.
z();
208 stream <<
"Vector2: "<<vec.
x()<<
", "<<vec.
y();
213 #if GEOM_PSEUDO3D==GEOM_TRUE
221 double x=vec0.
y() * vec1.
z() - vec0.
z() * vec1.
y();
222 double y=vec0.
z() * vec1.
x() - vec0.
x() * vec1.
z();
223 double z=vec0.
x() * vec1.
y() - vec0.
y() * vec1.
x();
236 double len(other.
length());
237 #if GEOM_PSEUDO3D==GEOM_TRUE
240 return Vector2(other.
x()/len,other.
y()/len,other.
z()/len);
246 std::cout<<
"\n\n** warning: normalize(const Vector2& other), Null length vector!"<<std::endl;
260 return Vector2(other.
x()/len,other.
y()/len);
264 std::cout<<
"warning: normalize(const Vector2& other), Null length vector!"<<std::endl;
277 #if GEOM_PSEUDO3D==GEOM_TRUE
292 #if GEOM_PSEUDO3D==GEOM_TRUE
293 return Vector2(d*vec.
x(),d*vec.
y(),d*vec.
z());
307 #if GEOM_PSEUDO3D==GEOM_TRUE
308 return Vector2(vec0.
x()+vec1.
x(), vec0.
y()+vec1.
y() , vec0.
z()+vec1.
z());
310 return Vector2(vec0.
x()+vec1.
x(), vec0.
y()+vec1.
y() );
322 #if GEOM_PSEUDO3D==GEOM_TRUE
323 return Vector2(vec0.
x()-vec1.
x(), vec0.
y()-vec1.
y() , vec0.
z()-vec1.
z());
325 return Vector2(vec0.
x()-vec1.
x(), vec0.
y()-vec1.
y() );
Vector2 normalize(const Vector2 &other)
Normalize a vector.
Definition: Vector2.h:234
Vector2 crossProduct(const Vector2 &vec0, const Vector2 &vec1)
Cross product.
Definition: Vector2.h:219
Vector2 operator-(const Vector2 &in)
Opposite vector.
Definition: Vector2.h:275
Vector2 operator+(const Vector2 &vec0, const Vector2 &vec1)
Addition.
Definition: Vector2.h:305
Vector2 operator*(double d, const Vector2 &vec)
Multiplication with a scalar.
Definition: Vector2.h:290
Vector.
Definition: Vector2.h:42
double sqLength() const
Get the squared length of the vector.
Vector2()
Default constructor.
double x() const
Get the x-value.
bool isDegenerate() const
isDegenerate
double y() const
Get the y-value.
double z() const
Get the z-value.
Vector2 orthogonalVector() const
Get an orthogonal vector (CCW direction)
double length() const
Get the length of the vector.
Vector2(const double x_, const double y_, const double z_)
Constructor.
Vector2 operator/(double val) const
Division.
Vector2 operator*(double val) const
Multiplication.
double operator*(const Vector2 &other) const
Scalar product.
void set(const double x_, const double y_, const double z_)
Set the values.
Vector2 & operator=(const Vector2 &other)
Assignment operator.
int getMaxIndex() const
Get max index.
Vector2(const Vector2 &v_)
Copy constructor.