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

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

SFCGAL::Coordinate::Coordinate ( )

Empty Coordinate constructor.

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

XY Constructor with exact coordinates.

Parameters
xThe X coordinate
yThe Y coordinate
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
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
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
SFCGAL::Coordinate::Coordinate ( const Kernel::Point_2 &  other)

Constructor from CGAL::Point_2<K>

Parameters
otherThe CGAL 2D point to copy
SFCGAL::Coordinate::Coordinate ( const Kernel::Point_3 &  other)

Constructor from CGAL::Point_3<K>

Parameters
otherThe CGAL 3D point to copy
SFCGAL::Coordinate::Coordinate ( const Coordinate &  other)
default

copy constructor

Parameters
otherThe coordinate to copy from
SFCGAL::Coordinate::~Coordinate ( )
default

destructor

Member Function Documentation

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

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
auto SFCGAL::Coordinate::coordinateDimension ( ) const -> int

Get the dimension of the coordinates.

Returns
Number of coordinates (2 or 3)
auto SFCGAL::Coordinate::dropZ ( ) -> bool

Drops the z coordinate.

Returns
TRUE if a Z value was present and has been removed
auto SFCGAL::Coordinate::is3D ( ) const -> bool

Tests if Z is defined.

Returns
true if 3D, false otherwise
auto SFCGAL::Coordinate::isEmpty ( ) const -> bool

Tests if the coordinates are empty.

Returns
true if empty, false otherwise
template<class Archive >
void SFCGAL::Coordinate::load ( Archive &  ar,
const unsigned  int 
)
inline

Load coordinate from archive.

Parameters
arArchive to load from
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
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
auto SFCGAL::Coordinate::operator= ( const Coordinate &  other) -> Coordinate &
default

assign operator

Parameters
otherThe coordinate to assign from
Returns
Reference to this coordinate
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
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
template<class Archive >
void SFCGAL::Coordinate::save ( Archive &  ar,
const unsigned  int 
) const
inline

Save coordinate to archive.

Parameters
arArchive to save to
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
auto SFCGAL::Coordinate::swapXY ( ) -> void

Swaps the x and y coordinates.

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

Converts to Kernel::Point_2.

Returns
CGAL 2D point representation
auto SFCGAL::Coordinate::toPoint_3 ( ) const -> Kernel::Point_3

Converts to Kernel::Point_3.

Returns
CGAL 3D point representation
auto SFCGAL::Coordinate::toVector_2 ( ) const -> Kernel::Vector_2
inline

Converts to Kernel::Vector_2.

Returns
CGAL 2D vector representation
auto SFCGAL::Coordinate::toVector_3 ( ) const -> Kernel::Vector_3
inline

Converts to Kernel::Vector_3.

Returns
CGAL 3D vector representation
auto SFCGAL::Coordinate::x ( ) const -> Kernel::FT

Gets the x value.

Returns
The X coordinate value
Warning
Exact, NaN for empty coordinates
auto SFCGAL::Coordinate::y ( ) const -> Kernel::FT

Gets the y value.

Returns
The Y coordinate value
Warning
Exact, NaN for empty coordinates
auto SFCGAL::Coordinate::z ( ) const -> Kernel::FT

Gets the z value.

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