Struct Triangle

Struct Documentation

struct Triangle

Represents a triangle.

Public Functions

Triangle(const Coord &coord_a, const Coord &coord_b, const Coord &coord_c)

Constructs a Triangle from three Coords.

Parameters:
  • coord_a[in] – Coord A.

  • coord_b[in] – Coord B.

  • coord_c[in] – Coord C.

bool inside(const Coord &coord) const

Returns true if the provided Coord is inside this Triangle.

Parameters:

coord[in] – a Coord to test.

Returns:

true if the Coord is inside this Triangle.

float intersect(const Ray &beam) const

Computes the intersection point of a Ray with this Triangle.

Parameters:

beam[in] – the Ray. point.

Returns:

a positive float point distance or std::numeric_limits<float>::lowest if there was no intersection.

inline bool operator==(const Triangle &rhs) const

Compares two Triangles for equality.

Parameters:

rhs[in] – the Triangle to compare against.

Returns:

true if the Triangles are equal, false otherwise.

inline bool operator!=(const Triangle &rhs) const

Compares two Triangles for inequality.

Parameters:

rhs[in] – the Triangle to compare against.

Returns:

true if the Triangles are not equal, false otherwise.

Public Members

std::array<Coord, 3> coords

Coords representing the corners of the Triangle.

std::array<Coord, 3> edges

Coords representing the edges of the Triangle.

Coord normal

A Coord representing the normal of the Triangle;.