Struct HalfEdgeFace

Struct Documentation

struct legion::physics::HalfEdgeFace

Public Types

enum face_angle_relation

Values:

enumerator coplanar
enumerator convex
enumerator concave

Public Functions

HalfEdgeFace(HalfEdgeEdge *newStartEdge, math::vec3 newNormal)
void deleteEdges()

Deletes all the edges of this face Warning: pairing edges are not deleted because their face may still exist.

void setFaceForAllEdges()

set the face of all the edges to this face

void forEachEdge(legion::core::delegate<void(HalfEdgeEdge*)> functionToExecute)

given a function that takes in a HalfEdgeEdge*, executes the function on each edge connected to ‘startEdge’

void inverse()

Inverses the face The edges will be stored in reverse and therefore the normal will point in the other direction The normal will be changed.

bool testConvexity(const HalfEdgeFace &other) const

Tests if this face is convex in regard to the passed face.

Return

Returns true when convex, false if coplanar or concave

Parameters
  • other: - the other plane

bool makeNormalsConvexWithFace(HalfEdgeFace &other)

Makes the normals for this faces point to the convex side of the plane in regard to each other.

Return

Returns true when the face has been made convex, false when it was already convex

bool makeNormalsConvexWithNeighbors(HalfEdgeFace &other)
face_angle_relation getAngleRelation(const HalfEdgeFace &other)

Calculates the angle relation from this to another face.

void mergeCoplanarNeighbors(std::vector<HalfEdgeFace*> &removed)
void DEBUG_DrawFace(const math::mat4 &transform, const math::color &debugColor, float time = 20.0f)
~HalfEdgeFace()

Public Members

HalfEdgeEdge *startEdge
math::vec3 normal
math::vec3 centroid
math::color DEBUG_color

Public Static Functions

static bool testConvexity(const HalfEdgeFace &first, const HalfEdgeFace &second)

Tests if the the two planes are convex in regard to each other.

Return

true when convex, false if coplanar or concave

static bool makeNormalsConvexWithFace(HalfEdgeFace &first, HalfEdgeFace &second)

Makes the normals for both faces point to the convex side of the plane in regard to each other.

Return

Returns true when one of the faces or both have been made convex, false when they were already convex

static HalfEdgeEdge *findMiddleEdge(const HalfEdgeFace &first, const HalfEdgeFace &second)

Finds the edge that splits the two faces.

Return

A pointer to the edge, nullptr if the two faces are not connected

static HalfEdgeFace *mergeFaces(HalfEdgeEdge &middleEdge)

Merges two faces Warning: Only the face middleEdge.face will be usable after the merge, the other face will be deleted Warning: The passed middleEdge will also be deleted.

Return

Pointer to the merged HalfEdgeFace

Parameters
  • middleEdge: The edge that seperates the two faces7

static inline std::string to_string(const face_angle_relation &relation)

Friends

inline friend friend bool operator== (const HalfEdgeFace &lhs, const HalfEdgeFace &rhs)