SFCGAL 2.3.0
SFCGAL::Point Class Reference

A point in SFA. More...

#include <Point.h>

Public Member Functions

 Point ()
 Empty point constructor.
 Point (const Coordinate &coordinate)
 Constructor with Coordinate.
 Point (const Kernel::FT &x, const Kernel::FT &y)
 XY Constructor with exact coordinates.
 Point (const Kernel::FT &x, const Kernel::FT &y, const Kernel::FT &z, const double &m=NaN())
 XYZ Constructor with exact coordinates.
 Point (const double &x, const double &y)
 XY constructor.
 Point (const double &x, const double &y, const double &z)
 XYZ constructor.
 Point (const double &x, const double &y, const double &z, const double &m)
 XYZM constructor.
 Point (const double &x, const double &y, const double &z, const double &m, CoordinateType dim)
 Generic XYZM constructor determined by CoordinateType.
 Point (const Kernel::FT &x, const Kernel::FT &y, const Kernel::FT &z, const double &m, CoordinateType dim)
 Generic XYZM constructor determined by CoordinateType.
 Point (const Kernel::Point_2 &other)
 Constructor from CGAL::Point_2<K>.
 Point (const Kernel::Point_3 &other)
 Constructor from CGAL::Point_3<K>.
 Point (const Point &other)
 copy constructor
auto operator= (const Point &other) -> Point &
 assign operator
 ~Point () override
 destructor
auto geometryType () const -> std::string override
 Get the geometry type as string.
auto geometryTypeId () const -> GeometryType override
 Get the geometry type identifier.
auto dimension () const -> int override
 Get the dimension of the point.
auto coordinateDimension () const -> int override
 Get the coordinate dimension.
auto isEmpty () const -> bool override
 Check if the point is empty.
auto is3D () const -> bool override
 Check if the point has 3D coordinates.
auto isMeasured () const -> bool override
 Check if the point has measured coordinates.
auto dropZ () -> bool override
 Drop Z coordinate.
auto dropM () -> bool override
 Drop M coordinate.
auto swapXY () -> void override
 Swap X and Y coordinates.
auto x () const -> Kernel::RT
 Returns the x value as a double throw for empty Point.
auto y () const -> Kernel::RT
 Returns the y value as a double throw for empty Point.
auto z () const -> Kernel::RT
 Returns the z value (zero for 2D) throw for empty Point.
auto m () const -> double
 Returns the m value (NaN is not defined).
void setM (const double &m)
 Sets the m value.
auto operator< (const Point &other) const -> bool
 compare two points
auto operator== (const Point &other) const -> bool
 compare with an other point
auto operator!= (const Point &other) const -> bool
 compare with an other point
auto almostEqual (const Point &other, double tolerance) const -> bool
 absolute comparison with an other point
void accept (GeometryVisitor &visitor) override
 Accept a geometry visitor.
void accept (ConstGeometryVisitor &visitor) const override
 Accept a const geometry visitor.
auto toVector_2 () const -> Kernel::Vector_2
 Convert to CGAL 2D vector.
auto toVector_3 () const -> Kernel::Vector_3
 Convert to CGAL 3D vector.
auto toPoint_2 () const -> Kernel::Point_2
 Convert to CGAL 2D point.
auto toPoint_3 () const -> Kernel::Point_3
 Convert to CGAL 3D point.
template<int Dim>
auto toPoint_d () const -> typename detail::TypeForDimension< Dim >::Point
 Converts to CGAL::Point_2 or CGAL::Point_3.
auto coordinate () -> Coordinate &
 Get reference to coordinate.
auto coordinate () const -> const Coordinate &
 Get const reference to coordinate.
template<class Archive>
void serialize (Archive &ar, const unsigned int)
 Serializer.

Detailed Description

A point in SFA.

The x(),y(),z() interface is based on CGAL kernel requirements, taken from examples/Kernel_23/MyPointC2.h

Todo
strong typing on coordinate dimension?

Constructor & Destructor Documentation

◆ Point() [1/12]

SFCGAL::Point::Point ( )

Empty point constructor.

◆ Point() [2/12]

SFCGAL::Point::Point ( const Coordinate & coordinate)

Constructor with Coordinate.

Parameters
coordinateThe coordinate to use for this point

◆ Point() [3/12]

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

XY Constructor with exact coordinates.

Parameters
xThe X coordinate
yThe Y coordinate

◆ Point() [4/12]

SFCGAL::Point::Point ( const Kernel::FT & x,
const Kernel::FT & y,
const Kernel::FT & z,
const double & m = NaN() )

XYZ Constructor with exact coordinates.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate
mThe M coordinate (default NaN)

◆ Point() [5/12]

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

XY constructor.

Parameters
xThe X coordinate
yThe Y coordinate

◆ Point() [6/12]

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

XYZ constructor.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate

◆ Point() [7/12]

SFCGAL::Point::Point ( const double & x,
const double & y,
const double & z,
const double & m )

XYZM constructor.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate
mThe M coordinate

◆ Point() [8/12]

SFCGAL::Point::Point ( const double & x,
const double & y,
const double & z,
const double & m,
CoordinateType dim )

Generic XYZM constructor determined by CoordinateType.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate
mThe M coordinate
dimThe coordinate type dimension

◆ Point() [9/12]

SFCGAL::Point::Point ( const Kernel::FT & x,
const Kernel::FT & y,
const Kernel::FT & z,
const double & m,
CoordinateType dim )

Generic XYZM constructor determined by CoordinateType.

Parameters
xThe X coordinate
yThe Y coordinate
zThe Z coordinate
mThe M coordinate
dimThe coordinate type dimension

◆ Point() [10/12]

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

Constructor from CGAL::Point_2<K>.

Parameters
otherThe CGAL 2D point to copy

◆ Point() [11/12]

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

Constructor from CGAL::Point_3<K>.

Parameters
otherThe CGAL 3D point to copy

◆ Point() [12/12]

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

copy constructor

Parameters
otherThe point to copy from

◆ ~Point()

SFCGAL::Point::~Point ( )
overridedefault

destructor

Member Function Documentation

◆ accept() [1/2]

void SFCGAL::Point::accept ( ConstGeometryVisitor & visitor) const
override

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept

◆ accept() [2/2]

void SFCGAL::Point::accept ( GeometryVisitor & visitor)
override

Accept a geometry visitor.

Parameters
visitorVisitor to accept

◆ almostEqual()

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

absolute comparison with an other point

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

◆ coordinate() [1/2]

auto SFCGAL::Point::coordinate ( ) -> Coordinate &
inline

Get reference to coordinate.

Returns
Reference to the coordinate

◆ coordinate() [2/2]

auto SFCGAL::Point::coordinate ( ) const -> const Coordinate &
inlinenodiscard

Get const reference to coordinate.

Returns
Const reference to the coordinate

◆ coordinateDimension()

auto SFCGAL::Point::coordinateDimension ( ) const -> int
nodiscardoverride

Get the coordinate dimension.

Returns
Number of coordinates (2, 3, or 4)

◆ dimension()

auto SFCGAL::Point::dimension ( ) const -> int
nodiscardoverride

Get the dimension of the point.

Returns
0 (points are 0-dimensional)

◆ dropM()

auto SFCGAL::Point::dropM ( ) -> bool
override

Drop M coordinate.

Returns
true if M was dropped, false otherwise

◆ dropZ()

auto SFCGAL::Point::dropZ ( ) -> bool
override

Drop Z coordinate.

Returns
true if Z was dropped, false otherwise

◆ geometryType()

auto SFCGAL::Point::geometryType ( ) const -> std::string
nodiscardoverride

Get the geometry type as string.

Returns
"Point"

◆ geometryTypeId()

auto SFCGAL::Point::geometryTypeId ( ) const -> GeometryType
nodiscardoverride

Get the geometry type identifier.

Returns
TYPE_POINT

◆ is3D()

auto SFCGAL::Point::is3D ( ) const -> bool
nodiscardoverride

Check if the point has 3D coordinates.

Returns
true if 3D, false otherwise

◆ isEmpty()

auto SFCGAL::Point::isEmpty ( ) const -> bool
nodiscardoverride

Check if the point is empty.

Returns
true if empty, false otherwise

◆ isMeasured()

auto SFCGAL::Point::isMeasured ( ) const -> bool
nodiscardoverride

Check if the point has measured coordinates.

Returns
true if measured, false otherwise

◆ m()

auto SFCGAL::Point::m ( ) const -> double
inlinenodiscard

Returns the m value (NaN is not defined).

Returns
M coordinate value

◆ operator!=()

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

compare with an other point

Parameters
otherThe point to compare with
Returns
true if points are not equal

◆ operator<()

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

compare two points

Parameters
otherThe point to compare with
Returns
true if this point is less than other

◆ operator=()

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

assign operator

Parameters
otherThe point to assign from
Returns
Reference to this point

◆ operator==()

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

compare with an other point

Parameters
otherThe point to compare with
Returns
true if points are equal

◆ serialize()

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

Serializer.

Parameters
arArchive for serialization

◆ setM()

void SFCGAL::Point::setM ( const double & m)
inline

Sets the m value.

Parameters
mThe new M coordinate value

◆ swapXY()

auto SFCGAL::Point::swapXY ( ) -> void
override

Swap X and Y coordinates.

◆ toPoint_2()

auto SFCGAL::Point::toPoint_2 ( ) const -> Kernel::Point_2
inlinenodiscard

Convert to CGAL 2D point.

Returns
CGAL 2D point representation
See also
Coordinate::toPoint_2()

◆ toPoint_3()

auto SFCGAL::Point::toPoint_3 ( ) const -> Kernel::Point_3
inlinenodiscard

Convert to CGAL 3D point.

Returns
CGAL 3D point representation
See also
Coordinate::toPoint_3()

◆ toPoint_d()

template<int Dim>
auto SFCGAL::Point::toPoint_d ( ) const -> typename detail::TypeForDimension< Dim >::Point

Converts to CGAL::Point_2 or CGAL::Point_3.

Template Parameters
DimThe dimension (2 or 3)
Returns
CGAL point of specified dimension

◆ toVector_2()

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

Convert to CGAL 2D vector.

Returns
CGAL 2D vector representation
See also
Coordinate::toVector_2()

◆ toVector_3()

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

Convert to CGAL 3D vector.

Returns
CGAL 3D vector representation
See also
Coordinate::toVector_3()

◆ x()

auto SFCGAL::Point::x ( ) const -> Kernel::RT
inlinenodiscard

Returns the x value as a double throw for empty Point.

Returns
X coordinate value

◆ y()

auto SFCGAL::Point::y ( ) const -> Kernel::RT
inlinenodiscard

Returns the y value as a double throw for empty Point.

Returns
Y coordinate value

◆ z()

auto SFCGAL::Point::z ( ) const -> Kernel::RT
inlinenodiscard

Returns the z value (zero for 2D) throw for empty Point.

Returns
Z coordinate value