CGAL defines a symbolic constant CGAL_NULL_VECTOR. We will explicitly state where you can pass this constant as an argument instead of a vector initialized with zeros.
#include <CGAL/Vector_3.h>
| |
introduces a null vector v.
| |
| |
introduces a vector v initialized to
. If the third argument is not
explicitly given it defaults to R::RT(1).
|
|
| Test for equality: two vectors are equal, iff their , and coordinates are equal. You can compare a vector with the CGAL_NULL_VECTOR. |
|
| Test for inequality. You can compare a vector with the CGAL_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 representation type R.
|
| returns the homogeneous coordinate. |
|
| returns the homogeneous coordinate. |
|
| returns the homogeneous coordinate. |
|
| returns the homogenizing coordinate. |
Here come the Cartesian access functions. Note that you do not loose information with the homogeneous representation, because then the field type 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 making the class CGAL_Vector_3 compatible with code for 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 coordinate(i).
Precondition: . |
|
| returns the dimension (the constant 3). |
|
| |
returns the vector obtained by applying on v. |
|
| Addition. |
|
| Subtraction. |
|
| Negation. |
|
| returns the scalar product (= inner product) of the two vectors. |
|
| Multiplication with a scalar from the right. Although it would be more natural, CGAL does not offer a multiplication with a scalar from the left. (This is due to problems of some compilers.) |
|
| |
Multiplication with a scalar from the right. | ||
|
| Division by a scalar. |
| ||
| returns the direction of v. |