Developer Documentation

Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ACG::Triangulator Class Reference

## Classes
struct | RingVertex

## Public Member Functions
| Triangulator (const std::vector< Vec3f > &_pos)
| Execute the triangulation algorithm on a polygon. More...
virtual | ~Triangulator ()
| Destructor.
size_t | numTriangles () const
| Get number of triangles. More...
int | index (int _i) const
| Get local vertex index. More...
const std::vector< int > & | indices () const
| Get local index buffer. More...
bool | convex () const
| Is the polygon convex? More...
size_t | numReflexVertices () const
| Get number of reflex vertices. More...
bool | isReflexVertex (int _i) const
| Check if a vertex is reflex. More...
bool | success () const
| Check if the triangulation was successful. More...

## Private Member Functions
void | initVertexList ()
int | earClippingN2 ()
int | earClippingN3 ()
Triangulator & | operator= (const Triangulator &)=delete
float | triangleAreaSign (const Vec2f &v0, const Vec2f &v1, const Vec2f &v2) const
float | distancePointToSegmentSq (const Vec2f &v0, const Vec2f &v1, const Vec2f &pt) const
bool | isReflexVertex (const Vec2f &v0, const Vec2f &v1, const Vec2f &v2) const
bool | pointInTriangle (const Vec2f &v0, const Vec2f &v1, const Vec2f &v2, const Vec2f &pt) const
bool | updateReflexVertex (RingVertex *v)
void | addEar (RingVertex *_earTip)

## Private Attributes
const size_t | polySize_
size_t | numRemaningVertices_
size_t | numTris_
size_t | numReflexVertices_
bool | ok_
bool | convex_
std::vector< Vec2f > | pos_
std::vector< RingVertex > | vertices_
std::list< RingVertex * > | reflexVertices_
std::vector< int > | tris_

## Detailed Description

Definition at line 58 of file Triangulator.hh.

## Constructor & Destructor Documentation

## ◆ Triangulator()

ACG::Triangulator::Triangulator | ( | const std::vector< Vec3f > & | _pos | ) |
| explicit

Execute the triangulation algorithm on a polygon.

Parameters

  _pos | polygon vertex positions (ccw)

Definition at line 52 of file Triangulator.cc.

## Member Function Documentation

## ◆ convex()

bool ACG::Triangulator::convex | ( |  | ) | const
| inline

Is the polygon convex?

Returns
  convex true or false

Definition at line 93 of file Triangulator.hh.

## ◆ index()

int ACG::Triangulator::index | ( | int | _i | ) | const
| inline

Get local vertex index.

Parameters

  _i | index to index buffer in range [0, .., numTris*3 - 1]

Returns
  vertex index in range [0, .., _pos.size()-1], where _pos is the input vector of positions as passed to the constructor

Definition at line 81 of file Triangulator.hh.

## ◆ indices()

const std::vector<int>& ACG::Triangulator::indices | ( |  | ) | const
| inline

Get local index buffer.

Returns
  index buffer

Definition at line 87 of file Triangulator.hh.

## ◆ isReflexVertex()

bool ACG::Triangulator::isReflexVertex | ( | int | _i | ) | const

Check if a vertex is reflex.

A reflex vertex is a vertex with an inner angle larger than 180 deg.

Parameters

  _i | local vertex index in range [0, .., _pos.size()-1]

Returns
  reflex vertex true or false

Definition at line 188 of file Triangulator.cc.

## ◆ numReflexVertices()

size_t ACG::Triangulator::numReflexVertices | ( |  | ) | const
| inline

Get number of reflex vertices.

A reflex vertex is a vertex with an inner angle larger than 180 deg.

Returns
  number of reflex vertices

Definition at line 100 of file Triangulator.hh.

## ◆ numTriangles()

size_t ACG::Triangulator::numTriangles | ( |  | ) | const
| inline

Get number of triangles.

Returns
  number of triangles after triangulation

Definition at line 74 of file Triangulator.hh.

## ◆ success()

bool ACG::Triangulator::success | ( |  | ) | const
| inline

Check if the triangulation was successful.

Returns
  success true or false

Definition at line 114 of file Triangulator.hh.

The documentation for this class was generated from the following files:

- OpenFlipper/libs_required/ACG/Geometry/Triangulator.hh
- OpenFlipper/libs_required/ACG/Geometry/Triangulator.cc