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_2.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).
Precondition: hw not equal to 0
|
|
| 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 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 . |
The following operations are for convenience and for making the class CGAL_Vector_2 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 2). |
| ||
| returns the direction which passes through v. | |
|
| |
returns the vector obtained by applying on v. | ||
|
| |
returns the vector perpendicular to v in clockwise or counterclockwise orientation. |
|
| Addition. |
|
| Subtraction. |
|
| returns the opposite vector. |
|
| 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. |