Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

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

Public Member Functions

 GenericPoint (const GenericPoint< T > &p)
 Copy constructor. More...
 
 GenericPoint (T x=0, T y=0)
 Creates a generic point (x,y). More...
 
double angle (GenericPoint< T > q, GenericPoint< T > r) const
 Compute angle (in radians) between vectors. More...
 
double angleDegrees (GenericPoint< T > q, GenericPoint< T > r) const
 Compute angle (in degrees) between vectors. More...
 
determinant (const GenericPoint< T > &dv) const
 Returns the determinant of the matrix (this, dv). More...
 
double distance (const GenericPoint< T > &p) const
 Returns the Euclidean distance between p and this point. More...
 
double norm () const
 Returns the norm of the point. More...
 
bool operator!= (const GenericPoint< T > &p) const
 Inequality operator. More...
 
operator* (const GenericPoint< T > &dv) const
 Returns the scalar product of this and dv. More...
 
GenericPoint< T > & operator*= (T c)
 Point-wise multiplies this with c. More...
 
GenericPoint< T > operator+ (const GenericPoint< T > &p) const
 Addition of points. More...
 
GenericPoint< T > & operator+= (const GenericPoint< T > &p)
 Adds p to this. More...
 
GenericPoint< T > operator- (const GenericPoint< T > &p) const
 Subtraction of points. More...
 
GenericPoint< T > & operator-= (const GenericPoint< T > &p)
 Subtracts p from this. More...
 
GenericPoint< T > & operator/= (T c)
 Point-wise divide this by c. More...
 
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. More...
 
GenericPoint< T > & operator= (const GenericPoint< T > &p)
 Assignment operator. More...
 
bool operator== (const GenericPoint< T > &dp) const
 Equality operator. More...
 
bool operator> (const GenericPoint< T > &p) const
 Operator 'greater'. Returns true iff p is less than this. More...
 
GenericPoint< T > orthogonal () const
 Returns a vector that is orthogonal to this vector. More...
 

Public Attributes

m_x
 The x-coordinate. More...
 
m_y
 The y-coordinate. More...
 

Friends

GenericPoint< T > operator* (const GenericPoint< T > &p, T c)
 Point-wise multiplies p with c. More...
 
GenericPoint< T > operator* (T c, const GenericPoint< T > &p)
 Point-wise multiplies p with c. More...
 
GenericPoint< T > operator/ (const GenericPoint< T > &p, double c)
 Point-wise divide p by c. More...
 

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 72 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 131 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 147 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 207 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 152 of file geometry.h.

◆ norm()

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

Returns the norm of the point.

Definition at line 159 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 212 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 178 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 121 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 164 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 126 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 171 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 195 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 109 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 116 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 222 of file geometry.h.

Friends And Related Function 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 190 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 185 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 202 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: