|
|
| Vector () |
| | Empty.
|
| |
| | Vector (const double &) |
| | Create a vector with the same coordinates.
|
| |
| | Vector (const double &, const double &, const double &) |
| | Create a vector with argument coordinates.
|
| |
|
constexpr double & | operator[] (int) |
| | Gets the i-th coordinate of vector.
|
| |
|
constexpr double | operator[] (int) const |
| | Returns the i-th coordinate of vector.
|
| |
|
Vector | operator+ () const |
| | Overloaded.
|
| |
|
Vector | operator- () const |
| | Overloaded.
|
| |
|
Vector & | operator+= (const Vector &) |
| | Destructive addition.
|
| |
|
Vector & | operator-= (const Vector &) |
| | Destructive subtraction.
|
| |
| Vector & | operator*= (const Vector &) |
| | Destructively scale a vector by another vector.
|
| |
|
Vector & | operator/= (const Vector &) |
| | Destructively divide the components of a vector by another vector.
|
| |
|
Vector & | operator*= (const double &) |
| | Destructive scalar multiply.
|
| |
|
Vector & | operator/= (const double &) |
| | Destructive division by a scalar.
|
| |
| double | Max () const |
| | Compute the maximum component of a vector.
|
| |
| int | MaxIndex () const |
| | Compute the index of the maximum component of a vector.
|
| |
| int | MinIndex () const |
| | Compute the index of the minimum component of a vector.
|
| |
| Vector | Pow (const double &) const |
| | Raise the components to a power.
|
| |
| QString | ToGLSL () const |
| | Return QString of the form 'vec3(x, y, z)' that write the vector in GLSL.
|
| |
| Vector | Orthogonal () const |
| | Returns a vector orthogonal to the argument vector.
|
| |
| void | RandomOrthonormal (Vector &, Vector &) const |
| | Computes two random orthonormal vectors to the argument vector.
|
| |
| void | Orthonormal (Vector &, Vector &) const |
| | Given a vector, creates two vectors xand y that form an orthogonal basis.
|
| |
| int | Octant (const Vector &) const |
| | Computes octant index of a vector with respect to the vector object.
|
| |
| Vector | Scaled (const Vector &) const |
| | Scale a vector.
|
| |
| Vector | Inverse () const |
| | Inverse of a vector.
|
| |
|
Vector | Sort () const |
| | Sort the terms of the vector into ascending order.
|
| |
| QString | ToString (int=6) const |
| | Create a QString form a vector.
|
| |
| double | Angle (const Vector &) const |
| | Compute the angle between two vectors.
|
| |
| Vector | Fract () const |
| | Compute the fractional part of the coordinates.
|
| |
| Vector | Floor () const |
| | Compute the numerator part of the coordinates.
|
| |
|
| static bool | Equal (const Vector &, const Vector &, const double &=0.0001) |
| | Test if two vectors are almost equal.
|
| |
|
static Vector | Min (const Vector &, const Vector &) |
| | Return a vector with coordinates set to the minimum coordinates of the two argument vectors.
|
| |
|
static Vector | Max (const Vector &, const Vector &) |
| | Return a vector with coordinates set to the maximum coordinates of the two argument vectors.
|
| |
| static void | SetMinMax (const Vector &, Vector &, Vector &) |
| | Update the minimum and maximum values given a vector.
|
| |
| static Vector | Mod (const Vector &, const Vector &) |
| | Modulo of two Vectors.
|
| |
| static bool | Coplanar (const Vector &, const Vector &, const Vector &, const double &=1.0e-6) |
| | Check if three vectors are coplanar.
|
| |
| static bool | Coplanar (const Vector &, const Vector &, const Vector &, const Vector &, const double &=1.0e-6) |
| | Check if four points are coplanar.
|
| |
| static Vector | Bilinear (const Vector &, const Vector &, const Vector &, const Vector &, const double &, const double &) |
| | Bi-linear interpolation between four vectors.
|
| |
| static Vector | Trilinear (const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const Vector &, const double &, const double &, const double &) |
| | Trilinear interpolation between eight vectors.
|
| |
| static double | Slope (const Vector &, const Vector &) |
| | Compute the vertical slope between two vectors.
|
| |
| static Vector | FromString (QString) |
| | Creates a vector from a QString.
|
| |
| static Vector | Polar (const double &, const double &) |
| | Creates a vector given polar coordinates.
|
| |
| static Vector | Solve (const Vector &, const Vector &, const double &, const double &) |
| | Compute the point on a segment such that the linear function satisfies f(a)=va and f(b)=vb.
|
| |
|
|
bool | operator> (const Vector &u, const Vector &v) |
| | Compare two vectors.
|
| |
|
bool | operator< (const Vector &u, const Vector &v) |
| | Compare two vectors.
|
| |
|
bool | operator>= (const Vector &u, const Vector &v) |
| | Overloaded.
|
| |
|
bool | operator<= (const Vector &u, const Vector &v) |
| | Overloaded.
|
| |
|
Vector | operator+ (const Vector &u, const Vector &v) |
| | Adds up two vectors.
|
| |
|
Vector | operator- (const Vector &u, const Vector &v) |
| | Difference between two vectors.
|
| |
|
constexpr double | operator* (const Vector &u, const Vector &v) |
| | Scalar product.
|
| |
|
Vector | operator* (const Vector &u, double a) |
| | Right multiply by a scalar.
|
| |
|
Vector | operator* (const double &a, const Vector &v) |
| | Left multiply by a scalar.
|
| |
|
Vector | operator/ (const Vector &u, double a) |
| | Left multiply by a scalar.
|
| |
|
Vector | operator/ (const Vector &u, const Vector &v) |
| | Cross product.
|
| |
|
bool | operator== (const Vector &u, const Vector &v) |
| | Strong equality test.
|
| |
|
bool | operator!= (const Vector &u, const Vector &v) |
| | Strong difference test.
|
| |
| double | Norm (const Vector &u) |
| | Compute the Euclidean norm of a vector.
|
| |
| double | SquaredNorm (const Vector &u) |
| | Compute the squared Euclidean norm of a vector.
|
| |
| double | NormInfinity (const Vector &u) |
| | Compute the norm infinity of a vector.
|
| |
| void | Normalize (Vector &u) |
| | Normalize a vector, computing the inverse of its norm and scaling the components.
|
| |
| Vector | Normalized (const Vector &u) |
| | Return a normalized vector.
|
| |
| double | Sine (const Vector &u, const Vector &v) |
| | Returns the positive sine of two vectors.
|
| |
| double | Cosine (const Vector &u, const Vector &v) |
| | Returns the positive cosine of two vectors.
|
| |
| Vector | Abs (const Vector &u) |
| | Computes the absolute value of a vector.
|
| |
| void | Swap (Vector &a, Vector &b) |
| | Swap two vectors.
|
| |
| void | Swap (Vector *&a, Vector *&b) |
| | Swap two pointers to (arrays) vectors.
|
| |
| int | Aligned (const Vector &u, const Vector &v) |
| | Check if two vectors are aligned.
|
| |
| Vector | Clamp (const Vector &x, const Vector &a, const Vector &b) |
| | Clamp a vector between two bounds.
|
| |
| Vector | Lerp (const Vector &a, const Vector &b, const double &t) |
| | Linear interpolation between two vectors.
|
| |
| std::ostream & | operator<< (std::ostream &s, const Vector &u) |
| | Overloaded output-stream operator.
|
| |
Vectors in three dimensions.
Most binary operators have been overloaded as expected, destructive operators, such as addition and subtraction have been implemented and behave as one could expect.
How do I compute the cross product of two vectors?
Simply use the overloaded Vector::operator/, for instance
Vector()
Empty.
Definition evector.h:25
double c[3]
Components.
Definition evector.h:22
computes the cross product of a and b.
How do I compute the sine of the angle between two vectors?
Simply use the Sine(const Vector&, const Vector&) function, which internally computes the norm of the cross product divided by the norm of the argument vectors.
friend double Sine(const Vector &, const Vector &)
Returns the positive sine of two vectors.
Definition evector.cpp:111
How can I get access to the x, y and z components of a vector?
Use v[0], v[1] and v[2] to get access to the x, y and z components of a vector v respectively.
How do I compute the normal of a triangle?
Let a,b,c the vertices of the triangle, simply compute the cross product
or use the member function of the Triangle class:
Base minimum storage triangle class.
Definition triangle.h:17
Vector Normal() const
Compute the normal vector of the triangle.
Definition triangle.cpp:64
How can I sort the three elements in a vector?
Use Vector::Sort() as follows:
How do I perform bi-linear interpolation on vectors?
Use Vector::Bilinear() with four vectors and bilinear coordinates. Alternatively, some geometric classes implement bilinear interpolation, such as Quadrangle::Vertex().