Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

class Enlighten::Triangle2D

A triangle in 2D defined by three points.

Variables

NameDescription
Vertex2D m_A

First point.

Vertex2D m_B

Second point.

Vertex2D m_C

Third point.

Functions

NameDescription
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.


Anchor
a5f61cb2283f466b249070ae5584e2494
a5f61cb2283f466b249070ae5584e2494

double Enlighten::Triangle2D::Area

...

public: double Area() const

...

Computes the unsigned area of the triangle.


Anchor
af59eca3a988d4337196dadf1cfcc04c4
af59eca3a988d4337196dadf1cfcc04c4

double Enlighten::Triangle2D::AreaTimesTwo

...

public: double AreaTimesTwo() const

...

Computes the unsigned area of the triangle multiplied by two.


Anchor
a647779fd1c454c2de0429d1e78eaca78
a647779fd1c454c2de0429d1e78eaca78

BaryCoords Enlighten::Triangle2D::GetBarycentricCoordinates

...

public: BaryCoords GetBarycentricCoordinates
(
    const Vertex2D & p
) const

...

Computes the barycentric coordinates for a point and this triangle.


Anchor
a7f9d2673eabfb005d907ee716fc5b4d5
a7f9d2673eabfb005d907ee716fc5b4d5

Geo::BaryWeights Enlighten::Triangle2D::GetBarycentricWeights

...

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

...

Computes the barycentric weights for a point and this triangle.


Anchor
a29dd2d22acdf24b9491670aff4cf1042
a29dd2d22acdf24b9491670aff4cf1042

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.


Anchor
ae6ea74c7772c8c754773e9d61a486d6a
ae6ea74c7772c8c754773e9d61a486d6a

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.


Anchor
ae7af2732c8395b7ce37657c505e3bc1f
ae7af2732c8395b7ce37657c505e3bc1f

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.


Anchor
a8eccf4070d0b7690374c0e1cc5742527
a8eccf4070d0b7690374c0e1cc5742527

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.


Anchor
a4632ee5db583b1d540de163d302df509
a4632ee5db583b1d540de163d302df509

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.


Anchor
a0c253d165b2243529328c3836a2a8f78
a0c253d165b2243529328c3836a2a8f78

void Enlighten::Triangle2D::Scale

...

public: void Scale
(
    double s
)

...

Componentwise scaling of the triangle.


Anchor
a2e92a6ae03aa366a90ac62015c3bdea2
a2e92a6ae03aa366a90ac62015c3bdea2

Enlighten::Triangle2D::Triangle2D

...

public: Triangle2D()

...

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


Anchor
adb9abf23685567804f5e9b878198c490
adb9abf23685567804f5e9b878198c490

Enlighten::Triangle2D::Triangle2D

...

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

...

Constructor defining the three vertices of the triangle.


Anchor
aa9858458b6ca701cf0889ca99c96627f
aa9858458b6ca701cf0889ca99c96627f

bool Enlighten::Triangle2D::Validate

...

public: bool Validate() const

...

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