SFCGAL 2.3.0
SFCGAL::Coordinate Class Reference

Represents the Coordinate of a Point (wraps either an empty structure, or a Kernel::Point_2, or a Kernel::Point_3). More...

#include <Coordinate.h>

Classes

class  Empty

Public Member Functions

 Coordinate ()
 Empty Coordinate constructor.
 Coordinate (const Kernel::FT &x, const Kernel::FT &y)
 XY Constructor with exact coordinates.
 Coordinate (const Kernel::FT &x, const Kernel::FT &y, const Kernel::FT &z)
 XYZ Constructor with exact coordinates.
 Coordinate (const double &x, const double &y, const double &z)
 XYZ constructor.
 Coordinate (const double &x, const double &y)
 XY constructor.
 Coordinate (const Kernel::Point_2 &other)
 Constructor from CGAL::Point_2<K>.
 Coordinate (const Kernel::Point_3 &other)
 Constructor from CGAL::Point_3<K>.
 Coordinate (const Coordinate &other)
 copy constructor
auto operator= (const Coordinate &other) -> Coordinate &
 assign operator
 ~Coordinate ()
 destructor
auto coordinateDimension () const -> int
 Get the dimension of the coordinates.
auto isEmpty () const -> bool
 Tests if the coordinates are empty.
auto is3D () const -> bool
 Tests if Z is defined.
auto x () const -> Kernel::FT
 Gets the x value.
auto y () const -> Kernel::FT
 Gets the y value.
auto z () const -> Kernel::FT
 Gets the z value.
auto round (const long &scaleFactor=1) -> Coordinate &
 round coordinates with a scale factor
auto operator< (const Coordinate &other) const -> bool
 Compares two points (lexicographic order).
auto operator== (const Coordinate &other) const -> bool
 Compares with an other point.
auto operator!= (const Coordinate &other) const -> bool
 Compares with an other point.
auto almostEqual (const Coordinate &other, double tolerance) const -> bool
 absolute comparison with an other coordinate
auto toVector_2 () const -> Kernel::Vector_2
 Converts to Kernel::Vector_2.
auto toVector_3 () const -> Kernel::Vector_3
 Converts to Kernel::Vector_3.
auto toPoint_2 () const -> Kernel::Point_2
 Converts to Kernel::Point_2.
auto toPoint_3 () const -> Kernel::Point_3
 Converts to Kernel::Point_3.
auto dropZ () -> bool
 Drops the z coordinate.
auto swapXY () -> void
 Swaps the x and y coordinates.
template<class Archive>
void save (Archive &ar, const unsigned int) const
 Save coordinate to archive.
template<class Archive>
void load (Archive &ar, const unsigned int)
 Load coordinate from archive.
template<class Archive>
void serialize (Archive &ar, const unsigned int version)
 Serialize coordinate to/from archive.

Detailed Description

Represents the Coordinate of a Point (wraps either an empty structure, or a Kernel::Point_2, or a Kernel::Point_3).

Constructor & Destructor Documentation

◆ Coordinate() [1/8]

SFCGAL::Coordinate::Coordinate ( )

Empty Coordinate constructor.

◆ Coordinate() [2/8]

SFCGAL::Coordinate::Coordinate ( const Kernel::FT & x,
const Kernel::FT & y )

XY Constructor with exact coordinates.

Parameters
xThe X coordinate
yThe Y coordinate

◆ Coordinate() [3/8]

SFCGAL::Coordinate::Coordinate ( const Kernel::FT & x,
const Kernel::FT & y,
const Kernel::FT & z )

XYZ Constructor with exact coordinates.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate

◆ Coordinate() [4/8]

SFCGAL::Coordinate::Coordinate ( const double & x,
const double & y,
const double & z )

XYZ constructor.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate
Warning
x,y,z must not be not be NaN nor inf

◆ Coordinate() [5/8]

SFCGAL::Coordinate::Coordinate ( const double & x,
const double & y )

XY constructor.

Parameters
xThe X coordinate
yThe Y coordinate
Warning
x,y must not be not be NaN nor inf

◆ Coordinate() [6/8]

SFCGAL::Coordinate::Coordinate ( const Kernel::Point_2 & other)

Constructor from CGAL::Point_2<K>.

Parameters
otherThe CGAL 2D point to copy

◆ Coordinate() [7/8]

SFCGAL::Coordinate::Coordinate ( const Kernel::Point_3 & other)

Constructor from CGAL::Point_3<K>.

Parameters
otherThe CGAL 3D point to copy

◆ Coordinate() [8/8]

SFCGAL::Coordinate::Coordinate ( const Coordinate & other)
default

copy constructor

Parameters
otherThe coordinate to copy from

◆ ~Coordinate()

SFCGAL::Coordinate::~Coordinate ( )
default

destructor

Member Function Documentation

◆ almostEqual()

auto SFCGAL::Coordinate::almostEqual ( const Coordinate & other,
double tolerance ) const -> bool
nodiscard

absolute comparison with an other coordinate

Parameters
otherThe coordinate to compare with
toleranceThe tolerance for comparison
Returns
true if coordinates are almost equal within tolerance

◆ coordinateDimension()

auto SFCGAL::Coordinate::coordinateDimension ( ) const -> int
nodiscard

Get the dimension of the coordinates.

Returns
Number of coordinates (2 or 3)

◆ dropZ()

auto SFCGAL::Coordinate::dropZ ( ) -> bool

Drops the z coordinate.

Returns
TRUE if a Z value was present and has been removed

◆ is3D()

auto SFCGAL::Coordinate::is3D ( ) const -> bool
nodiscard

Tests if Z is defined.

Returns
true if 3D, false otherwise

◆ isEmpty()

auto SFCGAL::Coordinate::isEmpty ( ) const -> bool
nodiscard

Tests if the coordinates are empty.

Returns
true if empty, false otherwise

◆ load()

template<class Archive>
void SFCGAL::Coordinate::load ( Archive & ar,
const unsigned int  )
inline

Load coordinate from archive.

Parameters
arArchive to load from

◆ operator!=()

auto SFCGAL::Coordinate::operator!= ( const Coordinate & other) const -> bool

Compares with an other point.

Parameters
otherThe coordinate to compare with
Returns
true if coordinates are not equal
Warning
coordinates must have the same dimension

◆ operator<()

auto SFCGAL::Coordinate::operator< ( const Coordinate & other) const -> bool

Compares two points (lexicographic order).

Parameters
otherThe coordinate to compare with
Returns
true if this coordinate is less than other
Warning
coordinates must have the same dimension

◆ operator=()

auto SFCGAL::Coordinate::operator= ( const Coordinate & other) -> Coordinate &
default

assign operator

Parameters
otherThe coordinate to assign from
Returns
Reference to this coordinate

◆ operator==()

auto SFCGAL::Coordinate::operator== ( const Coordinate & other) const -> bool

Compares with an other point.

Parameters
otherThe coordinate to compare with
Returns
true if coordinates are equal
Warning
coordinates must have the same dimension

◆ round()

auto SFCGAL::Coordinate::round ( const long & scaleFactor = 1) -> Coordinate &

round coordinates with a scale factor

Parameters
scaleFactorThe scale factor to apply (default 1)
Returns
*this

◆ save()

template<class Archive>
void SFCGAL::Coordinate::save ( Archive & ar,
const unsigned int  ) const
inline

Save coordinate to archive.

Parameters
arArchive to save to

◆ serialize()

template<class Archive>
void SFCGAL::Coordinate::serialize ( Archive & ar,
const unsigned int version )
inline

Serialize coordinate to/from archive.

Parameters
arArchive for serialization
versionSerialization version

◆ swapXY()

auto SFCGAL::Coordinate::swapXY ( ) -> void

Swaps the x and y coordinates.

◆ toPoint_2()

auto SFCGAL::Coordinate::toPoint_2 ( ) const -> Kernel::Point_2
nodiscard

Converts to Kernel::Point_2.

Returns
CGAL 2D point representation

◆ toPoint_3()

auto SFCGAL::Coordinate::toPoint_3 ( ) const -> Kernel::Point_3
nodiscard

Converts to Kernel::Point_3.

Returns
CGAL 3D point representation

◆ toVector_2()

auto SFCGAL::Coordinate::toVector_2 ( ) const -> Kernel::Vector_2
inlinenodiscard

Converts to Kernel::Vector_2.

Returns
CGAL 2D vector representation

◆ toVector_3()

auto SFCGAL::Coordinate::toVector_3 ( ) const -> Kernel::Vector_3
inlinenodiscard

Converts to Kernel::Vector_3.

Returns
CGAL 3D vector representation

◆ x()

auto SFCGAL::Coordinate::x ( ) const -> Kernel::FT
nodiscard

Gets the x value.

Returns
The X coordinate value
Warning
Exact, NaN for empty coordinates

◆ y()

auto SFCGAL::Coordinate::y ( ) const -> Kernel::FT
nodiscard

Gets the y value.

Returns
The Y coordinate value
Warning
Exact, NaN for empty coordinates

◆ z()

auto SFCGAL::Coordinate::z ( ) const -> Kernel::FT
nodiscard

Gets the z value.

Returns
The Z coordinate value
Warning
Exact, NaN for empty or 0 for 2D coordinates