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

[OGC/SFA]Triangle More...

#include <Triangle.h>

Inherits SFCGAL::GeometryImpl< Derived, Base >.

Public Member Functions

 Triangle ()
 empty Triangle constructor More...
 
 Triangle (const Kernel::Triangle_2 &triangle)
 Constructor with a CGAL triangle. More...
 
 Triangle (const Kernel::Triangle_3 &triangle)
 Constructor with a CGAL triangle. More...
 
 Triangle (const Point &point1, const Point &point2, const Point &point3)
 constructor with 3 points More...
 
 Triangle (const Triangle &other)
 copy constructor More...
 
auto operator= (const Triangle &other) -> Triangle &
 assign operator More...
 
 ~Triangle () 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 coordinateDimension () const -> int override
 Get the coordinate dimension. More...
 
auto isEmpty () const -> bool override
 Check if the triangle is empty. More...
 
auto is3D () const -> bool override
 Check if the triangle is 3D. More...
 
auto isMeasured () const -> bool override
 Check if the triangle has measured coordinates. More...
 
auto dropZ () -> bool override
 Drop Z coordinate from all points. More...
 
auto dropM () -> bool override
 Drop M coordinate from all points. More...
 
auto swapXY () -> void override
 Swap X and Y coordinates. More...
 
void reverse ()
 reverse Triangle orientation More...
 
auto toPolygon () const -> Polygon
 convert a triangle to a polygon More...
 
auto vertex (const int &i) const -> const Point &
 returns the i-th vertex More...
 
auto vertex (const int &i) -> Point &
 returns the i-th vertex More...
 
auto toTriangle_2 () const -> Kernel::Triangle_2
 Convert to CGAL::Triangle_2. More...
 
auto toTriangle_3 () const -> Kernel::Triangle_3
 Convert to CGAL::Triangle_3. More...
 
template<int D>
auto toTriangle_d () const -> typename detail::TypeForDimension< D >::Triangle
 Convert to CGAL::Triangle_2 or CGAL::Triangle_3. More...
 
void accept (GeometryVisitor &visitor) override
 Accept a geometry visitor. More...
 
void accept (ConstGeometryVisitor &visitor) const override
 Accept a const geometry visitor. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer. More...
 

Detailed Description

[OGC/SFA]Triangle

Warning
According to SFA, a Triangle should be inherited from a Polygon. That means that a triangle "is a" Polygon with hole. This inheritance is removed in order to keep CGAL modeling.
An empty triangle has empty points

Constructor & Destructor Documentation

SFCGAL::Triangle::Triangle ( )

empty Triangle constructor

SFCGAL::Triangle::Triangle ( const Kernel::Triangle_2 &  triangle)

Constructor with a CGAL triangle.

Parameters
triangleCGAL 2D triangle to construct from
SFCGAL::Triangle::Triangle ( const Kernel::Triangle_3 &  triangle)

Constructor with a CGAL triangle.

Parameters
triangleCGAL 3D triangle to construct from
SFCGAL::Triangle::Triangle ( const Point &  point1,
const Point &  point2,
const Point &  point3 
)

constructor with 3 points

Parameters
point1First point of the triangle
point2Second point of the triangle
point3Third point of the triangle
SFCGAL::Triangle::Triangle ( const Triangle &  other)

copy constructor

Parameters
otherTriangle to copy from
SFCGAL::Triangle::~Triangle ( )
overridedefault

destructor

Member Function Documentation

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

Accept a geometry visitor.

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

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept
auto SFCGAL::Triangle::coordinateDimension ( ) const -> int
override

Get the coordinate dimension.

Returns
Coordinate dimension
auto SFCGAL::Triangle::dropM ( ) -> bool
override

Drop M coordinate from all points.

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

Drop Z coordinate from all points.

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

Get the geometry type as string.

Returns
Geometry type string
auto SFCGAL::Triangle::geometryTypeId ( ) const -> GeometryType
override

Get the geometry type identifier.

Returns
Geometry type ID
auto SFCGAL::Triangle::is3D ( ) const -> bool
override

Check if the triangle is 3D.

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

Check if the triangle is empty.

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

Check if the triangle has measured coordinates.

Returns
true if measured, false otherwise
auto SFCGAL::Triangle::operator= ( const Triangle &  other) -> Triangle &

assign operator

Parameters
otherTriangle to assign from
Returns
Reference to this triangle
void SFCGAL::Triangle::reverse ( )

reverse Triangle orientation

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

Serializer.

Parameters
arArchive for serialization
auto SFCGAL::Triangle::swapXY ( ) -> void
override

Swap X and Y coordinates.

auto SFCGAL::Triangle::toPolygon ( ) const -> Polygon

convert a triangle to a polygon

Returns
Polygon representation of the triangle
auto SFCGAL::Triangle::toTriangle_2 ( ) const -> Kernel::Triangle_2
inline

Convert to CGAL::Triangle_2.

Returns
2D triangle representation
auto SFCGAL::Triangle::toTriangle_3 ( ) const -> Kernel::Triangle_3
inline

Convert to CGAL::Triangle_3.

Returns
3D triangle representation
template<int D>
auto SFCGAL::Triangle::toTriangle_d ( ) const -> typename detail::TypeForDimension<D>::Triangle
inline

Convert to CGAL::Triangle_2 or CGAL::Triangle_3.

Template Parameters
DDimension (2 or 3)
Returns
Triangle in specified dimension
auto SFCGAL::Triangle::vertex ( const int &  i) const -> const Point &
inline

returns the i-th vertex

Parameters
iThe vertex index (modulo 3)
Returns
Const reference to the vertex
auto SFCGAL::Triangle::vertex ( const int &  i) -> Point &
inline

returns the i-th vertex

Parameters
iThe vertex index (modulo 3)
Returns
Reference to the vertex