SFCGAL 2.3.0
SFCGAL::Triangle Class Reference

[OGC/SFA]Triangle More...

#include <Triangle.h>

Public Member Functions

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

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

◆ Triangle() [1/5]

SFCGAL::Triangle::Triangle ( )

empty Triangle constructor

◆ Triangle() [2/5]

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

Constructor with a CGAL triangle.

Parameters
triangleCGAL 2D triangle to construct from

◆ Triangle() [3/5]

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

Constructor with a CGAL triangle.

Parameters
triangleCGAL 3D triangle to construct from

◆ Triangle() [4/5]

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

◆ Triangle() [5/5]

SFCGAL::Triangle::Triangle ( const Triangle & other)

copy constructor

Parameters
otherTriangle to copy from

◆ ~Triangle()

SFCGAL::Triangle::~Triangle ( )
overridedefault

destructor

Member Function Documentation

◆ accept() [1/2]

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

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept

◆ accept() [2/2]

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

Accept a geometry visitor.

Parameters
visitorVisitor to accept

◆ coordinateDimension()

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

Get the coordinate dimension.

Returns
Coordinate dimension

◆ dropM()

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

Drop M coordinate from all points.

Returns
true if M was dropped, false otherwise

◆ dropZ()

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

Drop Z coordinate from all points.

Returns
true if Z was dropped, false otherwise

◆ geometryType()

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

Get the geometry type as string.

Returns
Geometry type string

◆ geometryTypeId()

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

Get the geometry type identifier.

Returns
Geometry type ID

◆ is3D()

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

Check if the triangle is 3D.

Returns
true if 3D, false otherwise

◆ isEmpty()

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

Check if the triangle is empty.

Returns
true if empty, false otherwise

◆ isMeasured()

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

Check if the triangle has measured coordinates.

Returns
true if measured, false otherwise

◆ operator=()

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

assign operator

Parameters
otherTriangle to assign from
Returns
Reference to this triangle

◆ reverse()

void SFCGAL::Triangle::reverse ( )

reverse Triangle orientation

◆ serialize()

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

Serializer.

Parameters
arArchive for serialization

◆ swapXY()

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

Swap X and Y coordinates.

◆ toPolygon()

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

convert a triangle to a polygon

Returns
Polygon representation of the triangle

◆ toTriangle_2()

auto SFCGAL::Triangle::toTriangle_2 ( ) const -> Kernel::Triangle_2
inlinenodiscard

Convert to CGAL::Triangle_2.

Returns
2D triangle representation

◆ toTriangle_3()

auto SFCGAL::Triangle::toTriangle_3 ( ) const -> Kernel::Triangle_3
inlinenodiscard

Convert to CGAL::Triangle_3.

Returns
3D triangle representation

◆ toTriangle_d()

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

◆ vertex() [1/2]

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

◆ vertex() [2/2]

auto SFCGAL::Triangle::vertex ( const int & i) const -> const Point &
inlinenodiscard

returns the i-th vertex

Parameters
iThe vertex index (modulo 3)
Returns
Const reference to the vertex