Parameterized base class for points. More...
#include <ogdf/basic/geometry.h>
Public Types | |
using | numberType = T |
The type for coordinates of the point. | |
Public Member Functions | |
GenericPoint (const GenericPoint< T > &p) | |
Copy constructor. | |
GenericPoint (T x=0, T y=0) | |
Creates a generic point (x ,y ). | |
double | angle (GenericPoint< T > q, GenericPoint< T > r) const |
Compute angle (in radians) between vectors. | |
double | angleDegrees (GenericPoint< T > q, GenericPoint< T > r) const |
Compute angle (in degrees) between vectors. | |
T | determinant (const GenericPoint< T > &dv) const |
Returns the determinant of the matrix (this , dv ). | |
double | distance (const GenericPoint< T > &p) const |
Returns the Euclidean distance between p and this point. | |
double | norm () const |
Returns the norm of the point. | |
bool | operator!= (const GenericPoint< T > &p) const |
Inequality operator. | |
T | operator* (const GenericPoint< T > &dv) const |
Returns the scalar product of this and dv . | |
GenericPoint< T > & | operator*= (T c) |
Point-wise multiplies this with c . | |
GenericPoint< T > | operator+ (const GenericPoint< T > &p) const |
Addition of points. | |
GenericPoint< T > & | operator+= (const GenericPoint< T > &p) |
Adds p to this. | |
GenericPoint< T > | operator- (const GenericPoint< T > &p) const |
Subtraction of points. | |
GenericPoint< T > & | operator-= (const GenericPoint< T > &p) |
Subtracts p from this. | |
GenericPoint< T > & | operator/= (T c) |
Point-wise divide this by c . | |
bool | operator< (const GenericPoint< T > &p) const |
Operator 'less'. Returns true iff the x coordinate of this is less than the x coordinate of p or, if they are equal, the same check is done for the y coordinate. | |
GenericPoint< T > & | operator= (const GenericPoint< T > &p) |
Assignment operator. | |
bool | operator== (const GenericPoint< T > &dp) const |
Equality operator. | |
bool | operator> (const GenericPoint< T > &p) const |
Operator 'greater'. Returns true iff p is less than this. | |
GenericPoint< T > | orthogonal () const |
Returns a vector that is orthogonal to this vector. | |
Public Attributes | |
T | m_x |
The x-coordinate. | |
T | m_y |
The y-coordinate. | |
Friends | |
GenericPoint< T > | operator* (const GenericPoint< T > &p, T c) |
Point-wise multiplies p with c . | |
GenericPoint< T > | operator* (T c, const GenericPoint< T > &p) |
Point-wise multiplies p with c . | |
GenericPoint< T > | operator/ (const GenericPoint< T > &p, double c) |
Point-wise divide p by c . | |
Parameterized base class for points.
This class serves as base class for two-dimensional points with specific coordinate types like integer points (IPoint) and real points (DPoint). The template parameter T is the type for the coordinates of the point and has to support assignment and equality/inequality operators.
This class also provides vector operations, e.g., computing an orthogonal vector.
Definition at line 73 of file geometry.h.
using ogdf::GenericPoint< T >::numberType = T |
The type for coordinates of the point.
Definition at line 76 of file geometry.h.
|
inlineexplicit |
Creates a generic point (x
,y
).
Definition at line 82 of file geometry.h.
|
inline |
Copy constructor.
Definition at line 85 of file geometry.h.
|
inline |
Compute angle (in radians) between vectors.
Definition at line 127 of file geometry.h.
|
inline |
Compute angle (in degrees) between vectors.
Definition at line 145 of file geometry.h.
|
inline |
Returns the determinant of the matrix (this
, dv
).
Definition at line 203 of file geometry.h.
|
inline |
Returns the Euclidean distance between p
and this point.
Definition at line 150 of file geometry.h.
|
inline |
Returns the norm of the point.
Definition at line 157 of file geometry.h.
|
inline |
Inequality operator.
Definition at line 103 of file geometry.h.
|
inline |
Returns the scalar product of this and dv
.
Definition at line 206 of file geometry.h.
|
inline |
Point-wise multiplies this with c
.
Definition at line 174 of file geometry.h.
|
inline |
Addition of points.
Definition at line 117 of file geometry.h.
|
inline |
Adds p
to this.
Definition at line 160 of file geometry.h.
|
inline |
Subtraction of points.
Definition at line 122 of file geometry.h.
|
inline |
Subtracts p
from this.
Definition at line 167 of file geometry.h.
|
inline |
Point-wise divide this by c
.
Definition at line 191 of file geometry.h.
|
inline |
Operator 'less'. Returns true
iff the x coordinate of this is less than the x coordinate of p
or, if they are equal, the same check is done for the y coordinate.
Definition at line 107 of file geometry.h.
|
inline |
Assignment operator.
Definition at line 88 of file geometry.h.
|
inline |
Equality operator.
Definition at line 97 of file geometry.h.
|
inline |
Operator 'greater'. Returns true
iff p
is less than this.
Definition at line 114 of file geometry.h.
|
inline |
Returns a vector that is orthogonal to this vector.
Returns the vector (y/x,1) if x != 0, or (1,0) otherwise, where (x,y) is this vector.
Definition at line 214 of file geometry.h.
|
friend |
Point-wise multiplies p
with c
.
Definition at line 186 of file geometry.h.
|
friend |
Point-wise multiplies p
with c
.
Definition at line 181 of file geometry.h.
|
friend |
Point-wise divide p
by c
.
Definition at line 198 of file geometry.h.
T ogdf::GenericPoint< T >::m_x |
The x-coordinate.
Definition at line 78 of file geometry.h.
T ogdf::GenericPoint< T >::m_y |
The y-coordinate.
Definition at line 79 of file geometry.h.