This is the documentation for Enlighten.

class Enlighten Triangle2D

class Enlighten::Triangle2D

A triangle in 2D defined by three points.

Variables

Name Description
Vertex2D m_A

First point.

Vertex2D m_B

Second point.

Vertex2D m_C

Third point.

Functions

Name Description
Area()

Computes the unsigned area of the triangle.

AreaTimesTwo()

Computes the unsigned area of the triangle multiplied by two.

GetBarycentricCoordinates(const Vertex2D &)

Computes the barycentric coordinates for a point and this triangle.

GetBarycentricWeights(const Vertex2D &)

Computes the barycentric weights for a point and this triangle.

IsInsideExclusive(const Vertex2D &)

Tests if a point is truly inside the triangle, which excludes the edges of the triangle.

IsInsideExclusive(const Vertex2D &, const double &)

Tests if a point is inside the triangle incorporating a certain tolerance, which also excludes the edges defined by the triangle and this tolerance.

IsInsideInclusive(const Vertex2D &)

Tests if a point is inside the triangle including the edges of the triangle. This does not handle 0 area triangles.

NearestTriangleEdgeIntersection(Vertex2D &)

Computes the point on the triangle's edges that is closest to a given point.

SafeIsInsideInclusive(const Vertex2D &)

Tests if a point is inside the triangle including the edges of the triangle. Handles 0 area triangles.

Scale(double)

Componentwise scaling of the triangle.

Triangle2D()

Default constructor initialising the triangle to a point at (0,0).

Triangle2D(const Vertex2D &, const Vertex2D &, const Vertex2D &)

Constructor defining the three vertices of the triangle.

Validate()

Tests if the triangle is valid which means that all vertices are finite.


double Enlighten::Triangle2D::Area


public: double Area() const


Computes the unsigned area of the triangle.


double Enlighten::Triangle2D::AreaTimesTwo


public: double AreaTimesTwo() const


Computes the unsigned area of the triangle multiplied by two.


BaryCoords Enlighten::Triangle2D::GetBarycentricCoordinates


public: BaryCoords GetBarycentricCoordinates
(
    const Vertex2D & p
) const


Computes the barycentric coordinates for a point and this triangle.


Geo::BaryWeights Enlighten::Triangle2D::GetBarycentricWeights


public: Geo::BaryWeights GetBarycentricWeights
(
    const Vertex2D & p
) const


Computes the barycentric weights for a point and this triangle.


bool Enlighten::Triangle2D::IsInsideExclusive


public: bool IsInsideExclusive
(
    const Vertex2D & p
) const


Tests if a point is truly inside the triangle, which excludes the edges of the triangle.


bool Enlighten::Triangle2D::IsInsideExclusive


public: bool IsInsideExclusive
(
    const Vertex2D & p,
    const double & tolerance
) const


Tests if a point is inside the triangle incorporating a certain tolerance, which also excludes the edges defined by the triangle and this tolerance.

A positive tolerance effeectively makes the triangle smaller whereas a negative tolerance makes it larger.


bool Enlighten::Triangle2D::IsInsideInclusive


public: bool IsInsideInclusive
(
    const Vertex2D & p
) const


Tests if a point is inside the triangle including the edges of the triangle. This does not handle 0 area triangles.


Vertex2D Enlighten::Triangle2D::NearestTriangleEdgeIntersection


public: Vertex2D NearestTriangleEdgeIntersection
(
    Vertex2D & p
) const


Computes the point on the triangle's edges that is closest to a given point.


bool Enlighten::Triangle2D::SafeIsInsideInclusive


public: bool SafeIsInsideInclusive
(
    const Vertex2D & p
) const


Tests if a point is inside the triangle including the edges of the triangle. Handles 0 area triangles.


void Enlighten::Triangle2D::Scale


public: void Scale
(
    double s
)


Componentwise scaling of the triangle.


Enlighten::Triangle2D::Triangle2D


public: Triangle2D()


Default constructor initialising the triangle to a point at (0,0).


Enlighten::Triangle2D::Triangle2D


public: Triangle2D
(
    const Vertex2D & a,
    const Vertex2D & b,
    const Vertex2D & c
)


Constructor defining the three vertices of the triangle.


bool Enlighten::Triangle2D::Validate


public: bool Validate() const


Tests if the triangle is valid which means that all vertices are finite.