Represents a 2D point.
More...
#include <Point2.h>
The Point2 class represents a 2D point with x- and y-coordinates.
◆ 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. |
◆ 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
-
p | The 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
-
vec | The vector to be added. |
- Returns
- The resulting Point2
◆ operator-() [1/2]
Vector2 GEOM_FADE2D::Point2::operator- |
( |
const Point2 & |
other | ) |
const |
|
inline |
◆ 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
-
vec | The 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
-
- Returns
true
if the current point is less, false
otherwise
◆ operator=()
Point2& GEOM_FADE2D::Point2::operator= |
( |
const Point2 & |
other | ) |
|
|
inline |
Assignment operator.
- Parameters
-
other | The 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
-
p | The 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
-
- 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
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
stream, |
|
|
const Point2 & |
pnt |
|
) |
| |
|
friend |
Prints a Point2 to an output stream.
- Parameters
-
stream | The output stream. |
pnt | The 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
-
stream | The input stream. |
pnt | The Point2 to be populated with data. |
- Returns
- The input stream.
The documentation for this class was generated from the following file: