Ipelib
|
Two-dimensional vector. More...
#include <ipegeo.h>
Two-dimensional vector.
Unlike some other libraries, I don't make a difference between points and vectors.
ipe::Vector::Vector | ( | ) | [inline] |
Uninitialized vector.
Vector::Vector | ( | Angle | alpha | ) | [explicit] |
Construct a unit vector with this direction.
ipe::Vector::Vector | ( | double | x0, |
double | y0 | ||
) | [inline, explicit] |
Construct a vector.
double ipe::Vector::sqLen | ( | ) | const [inline] |
Return square of Euclidean length.
Return square of vector's length.
double Vector::len | ( | ) | const |
Angle Vector::angle | ( | ) | const |
Return angle of the vector (with positive x-direction).
The returned angle lies between -pi and +pi. Returns zero for the zero vector.
Vector Vector::normalized | ( | ) | const |
Return this vector normalized (with length one).
Normalizing the zero vector returns the vector (1,0).
Vector Vector::orthogonal | ( | ) | const |
Return this vector turned 90 degrees to the left.
double Vector::factorize | ( | Vector & | unit | ) | const |
Normalizes this vector into unit and returns length. If this is the zero vector, unit is set to (1,0).
Snap to nearby vertex.
If distance between mouse and this vector is less than bound, set pos to this vector and bound to the distance, and return true
.
bool ipe::Vector::operator== | ( | const Vector & | rhs | ) | const [inline] |
Equality.
bool ipe::Vector::operator!= | ( | const Vector & | rhs | ) | const [inline] |
Inequality.
void ipe::Vector::operator+= | ( | const Vector & | rhs | ) | [inline] |
Vector-addition.
void ipe::Vector::operator-= | ( | const Vector & | rhs | ) | [inline] |
Vector-subtraction.
void ipe::Vector::operator*= | ( | double | rhs | ) | [inline] |
Multiply vector by scalar.
Vector Vector::ZERO = Vector(0.0, 0.0) [static] |
The origin (zero vector).
double ipe::Vector::x |
Coordinates are public.
double ipe::Vector::y |
Coordinates are public.