An object of the class Vector_3<Kernel> is a vector in the three-dimensional vector space . Geometrically spoken a vector is the difference of two points , and denotes the direction and the distance from to .
CGAL defines a symbolic constant NULL_VECTOR. We will explicitly state where you can pass this constant as an argument instead of a vector initialized with zeros.
| |||
introduces the vector .
| |||
| |||
introduces the vector .
| |||
| |||
introduces a vector having the same direction as .
| |||
| |||
introduces a vector having the same direction as .
| |||
| |||
introduces a null vector v.
| |||
| |||
introduces a vector v initialized to .
|
|
| |
Test for equality: two vectors are equal, iff their , and coordinates are equal. You can compare a vector with the NULL_VECTOR. | ||
|
| |
Test for inequality. You can compare a vector with the NULL_VECTOR. |
There are two sets of coordinate access functions, namely to the homogeneous and to the Cartesian coordinates. They can be used independently from the chosen kernel model.
|
| returns the homogeneous coordinate. |
|
| returns the homogeneous coordinate. |
|
| returns the homogeneous coordinate. |
|
| returns the homogenizing coordinate. |
Note that you do not loose information with the homogeneous representation, because the FieldNumberType is a quotient.
|
| returns the x-coordinate of v, that is . |
|
| returns the y-coordinate of v, that is . |
|
| returns the z coordinate of v, that is . |
The following operations are for convenience and for compatibility with higher dimensional vectors. Again they come in a Cartesian and homogeneous flavor.
|
| |
returns the i'th homogeneous coordinate of v, starting with 0. Precondition: . | ||
|
| |
returns the i'th
Cartesian
coordinate of v, starting at 0. Precondition: . | ||
|
| |
returns cartesian(i). Precondition: . | ||
|
| returns the dimension (the constant 3). |
|
| |
returns the vector obtained by applying on v. | ||
| ||
| returns the direction of v. |
The following operations can be applied on vectors:
|
| Addition. |
|
| Subtraction. |
|
| Returns the opposite vector. |
|
| returns the scalar product (= inner product) of the two vectors. |
|
| |
Multiplication with a scalar from the right. | ||
|
| |
Multiplication with a scalar from the right. | ||
|
| |
Multiplication with a scalar from the left. | ||
|
| |
Multiplication with a scalar from the left. | ||
|
| |
Division by a scalar. |