Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::GenericPoint< T > Class Template Reference

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.
 
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.
 
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

m_x
 The x-coordinate.
 
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.
 

Detailed Description

template<typename T>
class ogdf::GenericPoint< T >

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.

Member Typedef Documentation

◆ numberType

template<typename T >
using ogdf::GenericPoint< T >::numberType = T

The type for coordinates of the point.

Definition at line 76 of file geometry.h.

Constructor & Destructor Documentation

◆ GenericPoint() [1/2]

template<typename T >
ogdf::GenericPoint< T >::GenericPoint ( x = 0,
y = 0 
)
inlineexplicit

Creates a generic point (x,y).

Definition at line 82 of file geometry.h.

◆ GenericPoint() [2/2]

template<typename T >
ogdf::GenericPoint< T >::GenericPoint ( const GenericPoint< T > &  p)
inline

Copy constructor.

Definition at line 85 of file geometry.h.

Member Function Documentation

◆ angle()

template<typename T >
double ogdf::GenericPoint< T >::angle ( GenericPoint< T >  q,
GenericPoint< T >  r 
) const
inline

Compute angle (in radians) between vectors.

Definition at line 127 of file geometry.h.

◆ angleDegrees()

template<typename T >
double ogdf::GenericPoint< T >::angleDegrees ( GenericPoint< T >  q,
GenericPoint< T >  r 
) const
inline

Compute angle (in degrees) between vectors.

Definition at line 145 of file geometry.h.

◆ determinant()

template<typename T >
T ogdf::GenericPoint< T >::determinant ( const GenericPoint< T > &  dv) const
inline

Returns the determinant of the matrix (this, dv).

Definition at line 203 of file geometry.h.

◆ distance()

template<typename T >
double ogdf::GenericPoint< T >::distance ( const GenericPoint< T > &  p) const
inline

Returns the Euclidean distance between p and this point.

Definition at line 150 of file geometry.h.

◆ norm()

template<typename T >
double ogdf::GenericPoint< T >::norm ( ) const
inline

Returns the norm of the point.

Definition at line 157 of file geometry.h.

◆ operator!=()

template<typename T >
bool ogdf::GenericPoint< T >::operator!= ( const GenericPoint< T > &  p) const
inline

Inequality operator.

Definition at line 103 of file geometry.h.

◆ operator*()

template<typename T >
T ogdf::GenericPoint< T >::operator* ( const GenericPoint< T > &  dv) const
inline

Returns the scalar product of this and dv.

Definition at line 206 of file geometry.h.

◆ operator*=()

template<typename T >
GenericPoint< T > & ogdf::GenericPoint< T >::operator*= ( c)
inline

Point-wise multiplies this with c.

Definition at line 174 of file geometry.h.

◆ operator+()

template<typename T >
GenericPoint< T > ogdf::GenericPoint< T >::operator+ ( const GenericPoint< T > &  p) const
inline

Addition of points.

Definition at line 117 of file geometry.h.

◆ operator+=()

template<typename T >
GenericPoint< T > & ogdf::GenericPoint< T >::operator+= ( const GenericPoint< T > &  p)
inline

Adds p to this.

Definition at line 160 of file geometry.h.

◆ operator-()

template<typename T >
GenericPoint< T > ogdf::GenericPoint< T >::operator- ( const GenericPoint< T > &  p) const
inline

Subtraction of points.

Definition at line 122 of file geometry.h.

◆ operator-=()

template<typename T >
GenericPoint< T > & ogdf::GenericPoint< T >::operator-= ( const GenericPoint< T > &  p)
inline

Subtracts p from this.

Definition at line 167 of file geometry.h.

◆ operator/=()

template<typename T >
GenericPoint< T > & ogdf::GenericPoint< T >::operator/= ( c)
inline

Point-wise divide this by c.

Definition at line 191 of file geometry.h.

◆ operator<()

template<typename T >
bool ogdf::GenericPoint< T >::operator< ( const GenericPoint< T > &  p) const
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.

◆ operator=()

template<typename T >
GenericPoint< T > & ogdf::GenericPoint< T >::operator= ( const GenericPoint< T > &  p)
inline

Assignment operator.

Definition at line 88 of file geometry.h.

◆ operator==()

template<typename T >
bool ogdf::GenericPoint< T >::operator== ( const GenericPoint< T > &  dp) const
inline

Equality operator.

Definition at line 97 of file geometry.h.

◆ operator>()

template<typename T >
bool ogdf::GenericPoint< T >::operator> ( const GenericPoint< T > &  p) const
inline

Operator 'greater'. Returns true iff p is less than this.

Definition at line 114 of file geometry.h.

◆ orthogonal()

template<typename T >
GenericPoint< T > ogdf::GenericPoint< T >::orthogonal ( ) const
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.

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<typename T >
GenericPoint< T > operator* ( const GenericPoint< T > &  p,
c 
)
friend

Point-wise multiplies p with c.

Definition at line 186 of file geometry.h.

◆ operator* [2/2]

template<typename T >
GenericPoint< T > operator* ( c,
const GenericPoint< T > &  p 
)
friend

Point-wise multiplies p with c.

Definition at line 181 of file geometry.h.

◆ operator/

template<typename T >
GenericPoint< T > operator/ ( const GenericPoint< T > &  p,
double  c 
)
friend

Point-wise divide p by c.

Definition at line 198 of file geometry.h.

Member Data Documentation

◆ m_x

template<typename T >
T ogdf::GenericPoint< T >::m_x

The x-coordinate.

Definition at line 78 of file geometry.h.

◆ m_y

template<typename T >
T ogdf::GenericPoint< T >::m_y

The y-coordinate.

Definition at line 79 of file geometry.h.


The documentation for this class was generated from the following file: