Fade2D Documentation pages v2.16.8
Delaunay Features
GEOM_FADE2D::Point2 Class Reference

Represents a 2D point. More...

#include <Point2.h>

Public Member Functions

 Point2 ()
 Default constructor. More...
 
 Point2 (const double x_, const double y_)
 Constructor. More...
 
 Point2 (const Point2 &p_)
 Copy constructor. More...
 
 ~Point2 ()
 Destructor.
 
int getCustomIndex () const
 Retrieves the custom index of the Point2. More...
 
double getMaxAbs () const
 Get the larger of the absolute values of x and y. More...
 
bool operator!= (const Point2 &p) const
 Compares if the current Point2 is different from another one. More...
 
Point2 operator+ (const Vector2 &vec) const
 Add a Vector2 to the Point2. More...
 
Vector2 operator- (const Point2 &other) const
 Create a Vector2 by subtracing another Point2 from the current one. More...
 
Point2 operator- (const Vector2 &vec) const
 Subtract a Vector2 from the Point2. More...
 
bool operator< (const Point2 &p) const
 Compare if the current Point2 is less than another one. More...
 
Point2operator= (const Point2 &other)
 Assignment operator. More...
 
bool operator== (const Point2 &p) const
 Compares if the current Point2 is equal to another one. More...
 
bool operator> (const Point2 &p) const
 Compare if the current Point2 is greater than another one. More...
 
void setCustomIndex (int customIndex_)
 Sets a custom index for the Point2. More...
 
double x () const
 Get the x-coordinate of the Point2. More...
 
void xy (double &x_, double &y_) const
 Get the x- and y- coordinates of the Point2. More...
 
double y () const
 Get the y-coordinate of the Point2. More...
 

Protected Attributes

double coordX
 x-coordinate
 
double coordY
 y-coordinate
 
int customIndex
 User-defined index.
 

Friends

class Dt2
 
std::ostream & operator<< (std::ostream &stream, const Point2 &pnt)
 Print to output stream. More...
 
std::istream & operator>> (std::istream &stream, Point2 &pnt)
 Read coordinates from an input stream into a Point2. More...
 

Detailed Description

The Point2 class represents a 2D point with x- and y-coordinates.

Constructor & Destructor Documentation

◆ Point2() [1/3]

GEOM_FADE2D::Point2::Point2 ( const double  x_,
const double  y_ 
)
inline

Constructor for a 2D point. Initializes the customIndex to -1.

Parameters
x_,y_The coordinates of the point

◆ Point2() [2/3]

GEOM_FADE2D::Point2::Point2 ( )
inline

Initializes the coordinates to -DBL_MAX, the associated Triangle2 to NULL, and the customIndex to -1.

◆ Point2() [3/3]

GEOM_FADE2D::Point2::Point2 ( const Point2 p_)
inline

Copy constructor. Copies the coordinates and the custom index.

Parameters
[in]p_The point to be copied.

Member Function Documentation

◆ getCustomIndex()

int GEOM_FADE2D::Point2::getCustomIndex ( ) const
inline
Returns
The custom index of the Point2.
Note
The custom index defaults to -1. It is not related to the point's index in the triangulation (since such an index does not exist), but rather an arbitrary value that can be assigned by the user for associating the Point2 with their own data structures.
See also
void setCustomIndex(int customIndex_)

◆ getMaxAbs()

double GEOM_FADE2D::Point2::getMaxAbs ( ) const
inline

Get the maximum of the absolute values of the x- and y-coordinates.

Returns
The larger of the absolute values of x and y

◆ operator!=()

bool GEOM_FADE2D::Point2::operator!= ( const Point2 p) const
inline

This function checks if the current Point2 and p are different, based on the x and y coordinates.

Parameters
pThe point to compare with.
Returns
true if the points are different, false otherwise

◆ operator+()

Point2 GEOM_FADE2D::Point2::operator+ ( const Vector2 vec) const
inline

Adds a Vector2 vec to the current Point2 and returns the resulting Point2.

Parameters
vecThe vector to be added.
Returns
The resulting Point2

◆ operator-() [1/2]

Vector2 GEOM_FADE2D::Point2::operator- ( const Point2 other) const
inline

Creates a Vector2, pointing from Point2 other to the current Point2.

Parameters
otherThe other Point2.
Returns
The resulting Vector2 pointing from Point2 other to the current Point2.

◆ operator-() [2/2]

Point2 GEOM_FADE2D::Point2::operator- ( const Vector2 vec) const
inline

Subtracts a Vector2 from the Point2 and returns the resulting Point2.

Parameters
vecThe vector to be subtracted.
Returns
The resulting Point2

◆ operator<()

bool GEOM_FADE2D::Point2::operator< ( const Point2 p) const
inline

Less-than comparison, based on x and y coordinates.

Parameters
pThe Point2 to compare with
Returns
true if the current point is less, false otherwise

◆ operator=()

Point2& GEOM_FADE2D::Point2::operator= ( const Point2 other)
inline

Assignment operator.

Parameters
otherThe point whose coordinates and the custom index are assigned

◆ operator==()

bool GEOM_FADE2D::Point2::operator== ( const Point2 p) const
inline

This function compares the current Point2 with another one based on the x and y coordinates.

Parameters
pThe point to compare with.
Returns
true if the points are equal (same x and y), false otherwise.

◆ operator>()

bool GEOM_FADE2D::Point2::operator> ( const Point2 p) const
inline

Greater-than comparison, based on x and y coordinates.

Parameters
pThe Point2 to compare with.
Returns
true if the current Point2 is greater, false otherwise.

◆ setCustomIndex()

void GEOM_FADE2D::Point2::setCustomIndex ( int  customIndex_)
inline

This method allows you to assign an arbitrary index to the Point2, which can be used to associate it with custom data structures in your software. To retrieve the index later, you can use the getCustomIndex() method.

Parameters
customIndex_The custom index to be assigned to the Point2.
Note
This method is provided for the user's convenience to associate a Point2 with their own data structures. It is not related to the internal data structures of Fade 2D, and its usage is optional. By default, the customIndex is set to -1.
See also
int getCustomIndex()

◆ x()

double GEOM_FADE2D::Point2::x ( ) const
inline

Get the x-coordinate of the current Point2.

Returns
The x-coordinate

◆ xy()

void GEOM_FADE2D::Point2::xy ( double &  x_,
double &  y_ 
) const
inline

Retrieves the x- and y- coordinates of the current Point2.

Parameters
x_,y_Used to return the coordinate values.

◆ y()

double GEOM_FADE2D::Point2::y ( ) const
inline

Get the y-coordinate of the current Point2.

Returns
The y-coordinate

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Point2 pnt 
)
friend

Prints a Point2 to an output stream.

Parameters
streamThe output stream.
pntThe Point2 to be printed.
Returns
The output stream.

◆ operator>>

std::istream& operator>> ( std::istream &  stream,
Point2 pnt 
)
friend

Reads coordinates from a stream into a Point2.

Parameters
streamThe input stream.
pntThe Point2 to be populated with data.
Returns
The input stream.

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