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
110 #if GEOM_PSEUDO3D==GEOM_TRUE
117 #if GEOM_PSEUDO3D==GEOM_TRUE
120 void set(
const double x_,
const double y_,
const double z_);
125 void set(
const double x_,
const double y_);
133 #if GEOM_PSEUDO3D==GEOM_TRUE
150 #if GEOM_PSEUDO3D==GEOM_TRUE
163 #if GEOM_PSEUDO3D==GEOM_TRUE
175 #if GEOM_PSEUDO3D==GEOM_TRUE
180 Vector2 operator/(
double val)
const;
188 #if GEOM_PSEUDO3D==GEOM_TRUE
202 inline std::ostream &operator<<(std::ostream &stream,
const Vector2& vec)
204 #if GEOM_PSEUDO3D==GEOM_TRUE
205 stream <<
"Vector2: "<<vec.
x()<<
", "<<vec.
y()<<
", "<<vec.
z();
207 stream <<
"Vector2: "<<vec.
x()<<
", "<<vec.
y();
212 #if GEOM_PSEUDO3D==GEOM_TRUE
220 double x=vec0.
y() * vec1.
z() - vec0.
z() * vec1.
y();
221 double y=vec0.
z() * vec1.
x() - vec0.
x() * vec1.
z();
222 double z=vec0.
x() * vec1.
y() - vec0.
y() * vec1.
x();
232 inline Vector2 normalize(
const Vector2& other)
234 double len(other.length());
235 #if GEOM_PSEUDO3D==GEOM_TRUE
238 return Vector2(other.x()/len,other.y()/len,other.z()/len);
244 std::cout<<
"\n\n** warning: normalize(const Vector2& other), Null length vector!"<<std::endl;
252 return Vector2(0,0,0);
258 return Vector2(other.x()/len,other.y()/len);
262 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 crossProduct(const Vector2 &vec0, const Vector2 &vec1)
Cross product.
Definition: Vector2.h:218
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 a normalized, orthogonal 2D 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.