Navigation: Up, Table of Contents, Bibliography, Index, Title Page

2D Triangle (CGAL_Triangle_2)

Definition

An object t of the class CGAL_Triangle_2 is a triangle in the two-dimensional Euclidean plane E2. 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.

As any Jordan curve the boundary of a triangle splits the plane in two open regions, a bounded one and an unbounded one.

#include <CGAL/Triangle_2.h>

Creation

CGAL_Triangle_2<R> t ( CGAL_Point_2<R> p,
CGAL_Point_2<R> q,
CGAL_Point_2<R> r);
introduces a triangle t with vertices p, q and r.

Operations

bool t == t2 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.
bool t != t2 Test for inequality.
CGAL_Point_2<R> t.vertex ( int i) returns the i'th vertex modulo 3 of t.
CGAL_Point_2<R> t [ int i] returns vertex(i).

Predicates

bool t.is_degenerate () triangle t is degenerate, if the vertices are collinear.
CGAL_Orientation t.orientation () returns the orientation of t.
CGAL_Oriented_side t.oriented_side ( CGAL_Point_2<R> p)
returns CGAL_ON_ORIENTED_BOUNDARY, or CGAL_POSITIVE_SIDE, or the constant CGAL_ON_NEGATIVE_SIDE, determined by the position of point p.
CGAL_Bounded_side t.bounded_side ( CGAL_Point_2<R> p)
returns the constant CGAL_ON_BOUNDARY, CGAL_ON_BOUNDED_SIDE, or else CGAL_ON_UNBOUNDED_SIDE, depending on where point p is.

For convenience we provide the following boolean functions:

bool t.has_on_positive_side ( CGAL_Point_2<R> p)
bool t.has_on_negative_side ( CGAL_Point_2<R> p)
bool t.has_on_boundary ( CGAL_Point_2<R> p)
bool t.has_on_bounded_side ( CGAL_Point_2<R> p)
bool t.has_on_unbounded_side ( CGAL_Point_2<R> p)

Miscellaneous

CGAL_Triangle_2<R> t.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).
CGAL_Bbox_2 t.bbox () returns a bounding box containing t.
CGAL_Triangle_2<R> t.transform ( CGAL_Aff_transformation_2<R> at)
returns the triangle obtained by applying at on the three vertices of t.


Return to chapter: 2D Simplex
Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. Wed, January 20, 1999.