SFCGAL  2.3.0
Public Member Functions | List of all members
SFCGAL::Point Class Reference

A point in SFA. More...

#include <Point.h>

Inherits SFCGAL::GeometryImpl< Derived, Base >.

Public Member Functions

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

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

SFCGAL::Point::Point ( )

Empty point constructor.

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

Constructor with Coordinate.

Parameters
coordinateThe coordinate to use for this point
SFCGAL::Point::Point ( const Kernel::FT &  x,
const Kernel::FT &  y 
)

XY Constructor with exact coordinates.

Parameters
xThe X coordinate
yThe Y coordinate
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)
SFCGAL::Point::Point ( const double &  x,
const double &  y 
)

XY constructor.

Parameters
xThe X coordinate
yThe Y coordinate
SFCGAL::Point::Point ( const double &  x,
const double &  y,
const double &  z 
)

XYZ constructor.

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

Constructor from CGAL::Point_2<K>

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

Constructor from CGAL::Point_3<K>

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

copy constructor

Parameters
otherThe point to copy from
SFCGAL::Point::~Point ( )
overridedefault

destructor

Member Function Documentation

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

Accept a geometry visitor.

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

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept
auto SFCGAL::Point::almostEqual ( const Point &  other,
double  tolerance 
) const -> bool

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
auto SFCGAL::Point::coordinate ( ) -> Coordinate &
inline

Get reference to coordinate.

Returns
Reference to the coordinate
auto SFCGAL::Point::coordinate ( ) const -> const Coordinate &
inline

Get const reference to coordinate.

Returns
Const reference to the coordinate
auto SFCGAL::Point::coordinateDimension ( ) const -> int
override

Get the coordinate dimension.

Returns
Number of coordinates (2, 3, or 4)
auto SFCGAL::Point::dimension ( ) const -> int
override

Get the dimension of the point.

Returns
0 (points are 0-dimensional)
auto SFCGAL::Point::dropM ( ) -> bool
override

Drop M coordinate.

Returns
true if M was dropped, false otherwise
auto SFCGAL::Point::dropZ ( ) -> bool
override

Drop Z coordinate.

Returns
true if Z was dropped, false otherwise
auto SFCGAL::Point::geometryType ( ) const -> std::string
override

Get the geometry type as string.

Returns
"Point"
auto SFCGAL::Point::geometryTypeId ( ) const -> GeometryType
override

Get the geometry type identifier.

Returns
TYPE_POINT
auto SFCGAL::Point::is3D ( ) const -> bool
override

Check if the point has 3D coordinates.

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

Check if the point is empty.

Returns
true if empty, false otherwise
auto SFCGAL::Point::isMeasured ( ) const -> bool
override

Check if the point has measured coordinates.

Returns
true if measured, false otherwise
auto SFCGAL::Point::m ( ) const -> double
inline

Returns the m value (NaN is not defined)

Returns
M coordinate value
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
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
auto SFCGAL::Point::operator= ( const Point &  other) -> Point &

assign operator

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

Serializer.

Parameters
arArchive for serialization
void SFCGAL::Point::setM ( const double &  m)
inline

Sets the m value.

Parameters
mThe new M coordinate value
auto SFCGAL::Point::swapXY ( ) -> void
override

Swap X and Y coordinates.

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

Convert to CGAL 2D point.

Returns
CGAL 2D point representation
See also
Coordinate::toPoint_2()
auto SFCGAL::Point::toPoint_3 ( ) const -> Kernel::Point_3
inline

Convert to CGAL 3D point.

Returns
CGAL 3D point representation
See also
Coordinate::toPoint_3()
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
auto SFCGAL::Point::toVector_2 ( ) const -> Kernel::Vector_2
inline

Convert to CGAL 2D vector.

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

Convert to CGAL 3D vector.

Returns
CGAL 3D vector representation
See also
Coordinate::toVector_3()
auto SFCGAL::Point::x ( ) const -> Kernel::RT
inline

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

Returns
X coordinate value
auto SFCGAL::Point::y ( ) const -> Kernel::RT
inline

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

Returns
Y coordinate value
auto SFCGAL::Point::z ( ) const -> Kernel::RT
inline

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

Returns
Z coordinate value