CGAL 5.1 - 2D and 3D Linear Geometry Kernel
CGAL::Triangle_2< Kernel > Class Template Reference

#include <CGAL/Triangle_2.h>

Definition

template<typename Kernel>
class CGAL::Triangle_2< Kernel >

An object t of the class Triangle_2 is a triangle in the two-dimensional Euclidean plane \( \E^2\). Triangle t is oriented, i.e., its boundary has clockwise or counterclockwise orientation. We call the side to the left of the boundary the positive side and the side to the right of the boundary the negative side.

The boundary of a triangle splits the plane in two open regions, a bounded one and an unbounded one.

Is Model Of:
Kernel::Triangle_2

Creation

 Triangle_2 (const Point_2< Kernel > &p, const Point_2< Kernel > &q, const Point_2< Kernel > &r)
 introduces a triangle t with vertices p, q and r. More...
 

Operations

bool operator== (const Triangle_2< Kernel > &t2) const
 Test for equality: two triangles are equal, iff there exists a cyclic permutation of the vertices of \( t2\), such that they are equal to the vertices of t. More...
 
bool operator!= (const Triangle_2< Kernel > &t2) const
 Test for inequality. More...
 
Point_2< Kernelvertex (int i) const
 returns the i'th vertex modulo 3 of t. More...
 
Point_2< Kerneloperator[] (int i) const
 returns vertex(i). More...
 

Predicates

For convenience we provide the following Boolean functions:

bool is_degenerate () const
 triangle t is degenerate, if the vertices are collinear. More...
 
Orientation orientation () const
 returns the orientation of t. More...
 
Oriented_side oriented_side (const Point_2< Kernel > &p) const
 returns ON_ORIENTED_BOUNDARY, or POSITIVE_SIDE, or the constant ON_NEGATIVE_SIDE, determined by the position of point p. More...
 
Bounded_side bounded_side (const Point_2< Kernel > &p) const
 returns the constant ON_BOUNDARY, ON_BOUNDED_SIDE, or else ON_UNBOUNDED_SIDE, depending on where point p is. More...
 
bool has_on_positive_side (const Point_2< Kernel > &p) const
 
bool has_on_negative_side (const Point_2< Kernel > &p) const
 
bool has_on_boundary (const Point_2< Kernel > &p) const
 
bool has_on_bounded_side (const Point_2< Kernel > &p) const
 
bool has_on_unbounded_side (const Point_2< Kernel > &p) const
 

Miscellaneous

Triangle_2< Kernelopposite ()
 returns a triangle where the boundary is oriented the other way round (this flips the positive and the negative side, but not the bounded and unbounded side). More...
 
Kernel::FT area () const
 returns the signed area of t. More...
 
Bbox_2 bbox () const
 returns a bounding box containing t. More...
 
Triangle_2< Kerneltransform (const Aff_transformation_2< Kernel > &at) const
 returns the triangle obtained by applying \( at\) on the three vertices of t. More...
 

Constructor & Destructor Documentation

◆ Triangle_2()

template<typename Kernel >
CGAL::Triangle_2< Kernel >::Triangle_2 ( const Point_2< Kernel > &  p,
const Point_2< Kernel > &  q,
const Point_2< Kernel > &  r 
)

introduces a triangle t with vertices p, q and r.

Member Function Documentation

◆ area()

template<typename Kernel >
Kernel::FT CGAL::Triangle_2< Kernel >::area ( ) const

returns the signed area of t.

◆ bbox()

template<typename Kernel >
Bbox_2 CGAL::Triangle_2< Kernel >::bbox ( ) const

returns a bounding box containing t.

◆ bounded_side()

template<typename Kernel >
Bounded_side CGAL::Triangle_2< Kernel >::bounded_side ( const Point_2< Kernel > &  p) const

returns the constant ON_BOUNDARY, ON_BOUNDED_SIDE, or else ON_UNBOUNDED_SIDE, depending on where point p is.

Precondition
t is not degenerate.

◆ has_on_boundary()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::has_on_boundary ( const Point_2< Kernel > &  p) const

◆ has_on_bounded_side()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::has_on_bounded_side ( const Point_2< Kernel > &  p) const

◆ has_on_negative_side()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::has_on_negative_side ( const Point_2< Kernel > &  p) const

◆ has_on_positive_side()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::has_on_positive_side ( const Point_2< Kernel > &  p) const

◆ has_on_unbounded_side()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::has_on_unbounded_side ( const Point_2< Kernel > &  p) const
Precondition
t is not degenerate.

◆ is_degenerate()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::is_degenerate ( ) const

triangle t is degenerate, if the vertices are collinear.

◆ operator!=()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::operator!= ( const Triangle_2< Kernel > &  t2) const

Test for inequality.

◆ operator==()

template<typename Kernel >
bool CGAL::Triangle_2< Kernel >::operator== ( const Triangle_2< Kernel > &  t2) const

Test for equality: two triangles are equal, iff there exists a cyclic permutation of the vertices of \( t2\), such that they are equal to the vertices of t.

◆ operator[]()

template<typename Kernel >
Point_2<Kernel> CGAL::Triangle_2< Kernel >::operator[] ( int  i) const

returns vertex(i).

◆ opposite()

template<typename Kernel >
Triangle_2<Kernel> CGAL::Triangle_2< Kernel >::opposite ( )

returns a triangle where the boundary is oriented the other way round (this flips the positive and the negative side, but not the bounded and unbounded side).

◆ orientation()

template<typename Kernel >
Orientation CGAL::Triangle_2< Kernel >::orientation ( ) const

returns the orientation of t.

◆ oriented_side()

template<typename Kernel >
Oriented_side CGAL::Triangle_2< Kernel >::oriented_side ( const Point_2< Kernel > &  p) const

returns ON_ORIENTED_BOUNDARY, or POSITIVE_SIDE, or the constant ON_NEGATIVE_SIDE, determined by the position of point p.

Precondition
t is not degenerate.

◆ transform()

template<typename Kernel >
Triangle_2<Kernel> CGAL::Triangle_2< Kernel >::transform ( const Aff_transformation_2< Kernel > &  at) const

returns the triangle obtained by applying \( at\) on the three vertices of t.

◆ vertex()

template<typename Kernel >
Point_2<Kernel> CGAL::Triangle_2< Kernel >::vertex ( int  i) const

returns the i'th vertex modulo 3 of t.