An object of the class Vector_2<Kernel> is a vector in the two-dimensional vector space ℝ2. Geometrically spoken, a vector is the difference of two points p2, p1 and denotes the direction and the distance from p1 to p2.
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.
| |
An iterator for enumerating the
Cartesian
coordinates of a vector.
|
| |||
introduces the vector b-a.
| |||
| |||
introduces the vector s.target()-s.source().
| |||
| |||
introduces the vector having the same direction as r.
| |||
| |||
introduces the vector having the same direction as l.
| |||
| |||
introduces a null vector v.
| |||
| |||
introduces a vector v initialized to (x,y).
| |||
| |||
introduces a vector v initialized to (x,y).
| |||
| |||
introduces a vector v initialized to (hx/hw,hy/hw).
| |||
| |||
introduces a vector v initialized to (x,y).
|
|
| Test for equality: two vectors are equal, iff their x and y 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 x coordinate. |
|
| returns the homogeneous y 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 hx/hw. |
|
| returns the y-coordinate of v, that is hy/hw. |
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.
| ||
|
|
returns the i'th
Cartesian
coordinate of v, starting at 0.
| ||
|
|
returns cartesian(i).
| ||
|
| returns an iterator to the Cartesian coordinates of v, starting with the 0th coordinate. | ||
|
| returns an off the end iterator to the Cartesian coordinates of v. | ||
|
| returns the dimension (the constant 2). | ||
|
| returns the direction which passes through v. | ||
|
| |||
returns the vector obtained by applying t on v. | ||||
|
| returns the vector perpendicular to v in clockwise or counterclockwise orientation. |
The following operations can be applied to 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. |
|
| returns the squared length of v. |