Class HalfEdgeMesh
Namespace: ValveResourceFormat.IO.ContentFormats.HalfEdgeMesh
Assembly: ValveResourceFormat.dll
Half-Edge mesh typically used in Hammer.
public class HalfEdgeMeshInheritance
Remarks
Taken from Sbox.
Properties
FaceHandles
Handles of every live face.
public IEnumerable<FaceHandle> FaceHandles { get; }Property Value
HalfEdgeHandles
Handles of every live half edge.
public IEnumerable<HalfEdgeHandle> HalfEdgeHandles { get; }Property Value
OnClearFaceVertexData
Called when a half edge loses its corner data.
public Action<HalfEdgeHandle>? OnClearFaceVertexData { get; set; }Property Value
OnCopyFaceVertexData
Called when corner data must follow a half edge, with the source edge first and the destination second.
public Action<HalfEdgeHandle, HalfEdgeHandle>? OnCopyFaceVertexData { get; set; }Property Value
Action<HalfEdgeHandle, HalfEdgeHandle>?
VertexHandles
Handles of every live vertex.
public IEnumerable<VertexHandle> VertexHandles { get; }Property Value
this[VertexHandle]
Gets the topology of a vertex, or when the handle is not from this mesh.
public Vertex this[VertexHandle hVertex] { get; }Property Value
this[FaceHandle]
Gets the topology of a face, or when the handle is not from this mesh.
public Face this[FaceHandle hFace] { get; }Property Value
this[HalfEdgeHandle]
Gets the topology of a half edge, or when the handle is not from this mesh.
public HalfEdge this[HalfEdgeHandle hEdge] { get; }Property Value
Methods
AddFace(params VertexHandle[])
Adds a face bounded by the given vertices, in order.
public FaceHandle AddFace(params VertexHandle[] hVertices)Parameters
hVertices VertexHandle[]
Corner vertices of the new face.
Returns
The new face, or when the face would break the mesh.
AddFace(out FaceHandle, params VertexHandle[])
Adds a face bounded by the given vertices, in order.
public bool AddFace(out FaceHandle hOutFace, params VertexHandle[] hVertices)Parameters
hOutFace FaceHandle
The new face, set only when this returns true.
hVertices VertexHandle[]
Corner vertices of the new face.
Returns
Whether the face was added.
AddVertex()
Adds one vertex that borders no edge yet.
public VertexHandle AddVertex()Returns
AddVertices(int)
Adds several vertices that border no edge yet.
public IEnumerable<VertexHandle> AddVertices(int count)Parameters
count int
How many vertices to add.
Returns
AppendComponentsFromMesh(HalfEdgeMesh, out Dictionary<VertexHandle, VertexHandle>, out Dictionary<HalfEdgeHandle, HalfEdgeHandle>, out Dictionary<FaceHandle, FaceHandle>)
Copies every component of another mesh into this one, reporting the handle each source component landed on.
public void AppendComponentsFromMesh(HalfEdgeMesh sourceMesh, out Dictionary<VertexHandle, VertexHandle> newVertices, out Dictionary<HalfEdgeHandle, HalfEdgeHandle> newHalfEdges, out Dictionary<FaceHandle, FaceHandle> newFaces)Parameters
sourceMesh HalfEdgeMesh
Mesh to copy from.
newVertices Dictionary<VertexHandle, VertexHandle>
Source vertex to new vertex.
newHalfEdges Dictionary<HalfEdgeHandle, HalfEdgeHandle>
Source half edge to new half edge.
newFaces Dictionary<FaceHandle, FaceHandle>
Source face to new face.
ClassifyEdgeListConnectivity(IReadOnlyList<HalfEdgeHandle>, int, out List<HalfEdgeHandle>)
Classifies how a set of edges is connected, and reports the edges forming the largest group.
public static ComponentConnectivityType ClassifyEdgeListConnectivity(IReadOnlyList<HalfEdgeHandle> pEdgeList, int nNumEdges, out List<HalfEdgeHandle> pOutSortedHalfEdgeList)Parameters
pEdgeList IReadOnlyList<HalfEdgeHandle>
nNumEdges int
pOutSortedHalfEdgeList List<HalfEdgeHandle>
Returns
ComputeNumEdgesConnectedToVertex(VertexHandle)
Collects the vertices one edge away from a vertex.
public static int ComputeNumEdgesConnectedToVertex(VertexHandle hVertex)Parameters
hVertex VertexHandle
Returns
ComputeNumEdgesInFace(FaceHandle)
Collects the corner vertices of a face.
public static int ComputeNumEdgesInFace(FaceHandle hFace)Parameters
hFace FaceHandle
Returns
ComputeNumFacesConnectedToVertex(VertexHandle)
Counts the faces meeting at a vertex.
public static int ComputeNumFacesConnectedToVertex(VertexHandle hVertex)Parameters
hVertex VertexHandle
Returns
ComputeNumOpenEdgesInVertexLoop(VertexHandle)
Counts the edges around a vertex that border no face.
public static int ComputeNumOpenEdgesInVertexLoop(VertexHandle hVertex)Parameters
hVertex VertexHandle
Vertex whose edge loop is walked.
Returns
CreateFaceData<TData>(string)
Attaches a named per face data stream to the mesh.
public FaceData<TData> CreateFaceData<TData>(string name) where TData : structParameters
name string
Name to register the stream under.
Returns
FaceData<TData>
Type Parameters
TData
Type stored per face.
CreateHalfEdgeData<TData>(string)
Attaches a named per half edge data stream to the mesh.
public HalfEdgeData<TData> CreateHalfEdgeData<TData>(string name) where TData : structParameters
name string
Name to register the stream under.
Returns
HalfEdgeData<TData>
Type Parameters
TData
Type stored per half edge.
CreateVertexData<TData>(string)
Attaches a named per vertex data stream to the mesh.
public VertexData<TData> CreateVertexData<TData>(string name) where TData : structParameters
name string
Name to register the stream under.
Returns
VertexData<TData>
Type Parameters
TData
Type stored per vertex.
DissolveEdge(HalfEdgeHandle, out FaceHandle)
Merges the two faces sharing an edge. The face of the given half edge survives, the opposite face is freed together with the edge pair.
public bool DissolveEdge(HalfEdgeHandle hEdge, out FaceHandle hOutFace)Parameters
hEdge HalfEdgeHandle
Edge to dissolve.
hOutFace FaceHandle
The surviving face, set only when this returns true.
Returns
Whether the edge was dissolved.
FindBoundaryEdgesConnectedToFaces(IReadOnlyList<FaceHandle>, int, out List<HalfEdgeHandle>)
Collects the edges on the boundary of a set of faces.
public void FindBoundaryEdgesConnectedToFaces(IReadOnlyList<FaceHandle> faceList, int numFaces, out List<HalfEdgeHandle> outBoundaryEdges)Parameters
faceList IReadOnlyList<FaceHandle>
numFaces int
outBoundaryEdges List<HalfEdgeHandle>
FindClosedFaces(IReadOnlyList<FaceHandle>, out List<FaceHandle>)
Returns the faces of a set whose every edge borders two faces.
public static void FindClosedFaces(IReadOnlyList<FaceHandle> faceList, out List<FaceHandle> outClosedFaces)Parameters
faceList IReadOnlyList<FaceHandle>
outClosedFaces List<FaceHandle>
FindConnectedHalfEdgeInSet(HalfEdgeHandle, IReadOnlyList<HalfEdgeHandle>, int)
Walks the vertex loop from an edge and returns the first edge that appears in the given set.
public static HalfEdgeHandle FindConnectedHalfEdgeInSet(HalfEdgeHandle hEdge, IReadOnlyList<HalfEdgeHandle> pEdges, int nNumEdges)Parameters
hEdge HalfEdgeHandle
Edge to start from.
pEdges IReadOnlyList<HalfEdgeHandle>
Set to look in.
nNumEdges int
How many entries of pEdges to consider.
Returns
The connected edge, or when none is in the set.
FindEdgeConnectedToFaceEndingAtVertex(FaceHandle, VertexHandle)
Returns the edge of a face that ends at the given vertex.
public static HalfEdgeHandle FindEdgeConnectedToFaceEndingAtVertex(FaceHandle hFace, VertexHandle hVertex)Parameters
hFace FaceHandle
hVertex VertexHandle
Returns
FindEdgeConnectingFaces(FaceHandle, FaceHandle)
Returns the edge shared by two faces.
public HalfEdgeHandle FindEdgeConnectingFaces(FaceHandle hFaceA, FaceHandle hFaceB)Parameters
hFaceA FaceHandle
hFaceB FaceHandle
Returns
FindEdgeIslands(IReadOnlyList<HalfEdgeHandle>, out List<List<HalfEdgeHandle>>)
Splits a set of edges into connected groups.
public void FindEdgeIslands(IReadOnlyList<HalfEdgeHandle> pEdgeList, out List<List<HalfEdgeHandle>> pOutEdgeList)Parameters
pEdgeList IReadOnlyList<HalfEdgeHandle>
pOutEdgeList List<List<HalfEdgeHandle>>
FindEdgeLoop(HalfEdgeHandle, int, out List<HalfEdgeHandle>?)
Collects the edge loop the given edge belongs to.
public void FindEdgeLoop(HalfEdgeHandle hEdge, int nMaxVertices, out List<HalfEdgeHandle>? pOutEdgeList)Parameters
hEdge HalfEdgeHandle
nMaxVertices int
pOutEdgeList List<HalfEdgeHandle>?
FindEdgeLoopStartingAtEdge(HalfEdgeHandle, int, out HalfEdgeHandle[]?)
Walks the edge loop that starts at the given edge.
public static void FindEdgeLoopStartingAtEdge(HalfEdgeHandle hStartEdge, int nMaxVertexEdges, out HalfEdgeHandle[]? pOutEdgeList)Parameters
hStartEdge HalfEdgeHandle
nMaxVertexEdges int
pOutEdgeList HalfEdgeHandle[]?
FindEdgeRibs(IReadOnlyList<HalfEdgeHandle>, int, out List<List<HalfEdgeHandle>>, out List<List<HalfEdgeHandle>>, out List<HalfEdgeHandle>)
Splits a set of edges into ribs and rails, and reports the edges that belong to neither.
public static int FindEdgeRibs(IReadOnlyList<HalfEdgeHandle> edges, int numEdges, out List<List<HalfEdgeHandle>> leftRibs, out List<List<HalfEdgeHandle>> rightRibs, out List<HalfEdgeHandle> spineEdges)Parameters
edges IReadOnlyList<HalfEdgeHandle>
numEdges int
leftRibs List<List<HalfEdgeHandle>>
rightRibs List<List<HalfEdgeHandle>>
spineEdges List<HalfEdgeHandle>
Returns
FindEdgeRing(HalfEdgeHandle, out List<HalfEdgeHandle>)
Collects the edge ring the given edge belongs to.
public void FindEdgeRing(HalfEdgeHandle hEdge, out List<HalfEdgeHandle> outEdgeList)Parameters
hEdge HalfEdgeHandle
outEdgeList List<HalfEdgeHandle>
FindFaceConnectingFullEdges(HalfEdgeHandle, HalfEdgeHandle)
Returns the face both full edges border.
public static FaceHandle FindFaceConnectingFullEdges(HalfEdgeHandle hEdgeA, HalfEdgeHandle hEdgeB)Parameters
hEdgeA HalfEdgeHandle
hEdgeB HalfEdgeHandle
Returns
FindFaceSharedByVertices(VertexHandle, VertexHandle)
Returns a face both vertices are corners of.
public static FaceHandle FindFaceSharedByVertices(VertexHandle hVertexA, VertexHandle hVertexB)Parameters
hVertexA VertexHandle
hVertexB VertexHandle
Returns
FindFaceWithEdgeConnectingVertices(VertexHandle, VertexHandle)
Returns the face bordered by the edge connecting two vertices.
public static FaceHandle FindFaceWithEdgeConnectingVertices(VertexHandle hVertexA, VertexHandle hVertexB)Parameters
hVertexA VertexHandle
hVertexB VertexHandle
Returns
FindFacesConnectedToFullEdges(IReadOnlyList<HalfEdgeHandle>, List<FaceHandle>, List<int>)
Collects the faces bordered by a set of full edges, along with how many of those edges each face borders.
public static void FindFacesConnectedToFullEdges(IReadOnlyList<HalfEdgeHandle> edgeList, List<FaceHandle> outFaces, List<int> outFaceEdgeCounts)Parameters
edgeList IReadOnlyList<HalfEdgeHandle>
outFaces List<FaceHandle>
FindFacesConnectedToHalfEdges(IReadOnlyList<HalfEdgeHandle>, int, out List<FaceHandle>, out List<HalfEdgeHandle>)
Collects the faces bordered by a set of half edges, along with the edges that border no face.
public static void FindFacesConnectedToHalfEdges(IReadOnlyList<HalfEdgeHandle> pHalfEdgeList, int nNumEdges, out List<FaceHandle> pOutFaceList, out List<HalfEdgeHandle> pOutEdgeForFaces)Parameters
pHalfEdgeList IReadOnlyList<HalfEdgeHandle>
nNumEdges int
pOutFaceList List<FaceHandle>
pOutEdgeForFaces List<HalfEdgeHandle>
FindFacesConnectedToVertices(IReadOnlyList<VertexHandle>, int, out FaceHandle[], out int[])
Collects the faces touched by a set of vertices, along with how many of those vertices each face uses.
public static void FindFacesConnectedToVertices(IReadOnlyList<VertexHandle> hVertices, int nNumVertices, out FaceHandle[] newFaces, out int[] faceVertexCounts)Parameters
hVertices IReadOnlyList<VertexHandle>
nNumVertices int
newFaces FaceHandle[]
faceVertexCounts int[]
FindFacesSharedByVertices(VertexHandle, VertexHandle, out List<FaceHandle>)
Collects every face both vertices are corners of.
public static bool FindFacesSharedByVertices(VertexHandle hVertexA, VertexHandle hVertexB, out List<FaceHandle> faces)Parameters
hVertexA VertexHandle
hVertexB VertexHandle
faces List<FaceHandle>
Returns
FindFullEdgeConnectingVertices(VertexHandle, VertexHandle)
Returns the full edge connecting two vertices.
public HalfEdgeHandle FindFullEdgeConnectingVertices(VertexHandle hVertexA, VertexHandle hVertexB)Parameters
hVertexA VertexHandle
hVertexB VertexHandle
Returns
FindFullEdgesConnectedToFaces(IReadOnlyList<FaceHandle>, int, out HalfEdgeHandle[], out int[])
Collects the full edges of a set of faces, along with how many of those faces each edge borders.
public void FindFullEdgesConnectedToFaces(IReadOnlyList<FaceHandle> pFaceList, int nNumFaces, out HalfEdgeHandle[] pOutEdgeList, out int[] pOutEdgeFaceCounts)Parameters
pFaceList IReadOnlyList<FaceHandle>
nNumFaces int
pOutEdgeList HalfEdgeHandle[]
pOutEdgeFaceCounts int[]
FindFullEdgesConnectedToVertices(IReadOnlyList<VertexHandle>, int, out HalfEdgeHandle[], out int[])
Collects the full edges touched by a set of vertices, along with how many of those vertices each edge uses.
public void FindFullEdgesConnectedToVertices(IReadOnlyList<VertexHandle> hVertices, int nNumVertices, out HalfEdgeHandle[] newEdges, out int[] edgeVertexCounts)Parameters
hVertices IReadOnlyList<VertexHandle>
nNumVertices int
newEdges HalfEdgeHandle[]
edgeVertexCounts int[]
FindHalfEdgeConnectingVertices(VertexHandle, VertexHandle)
Returns the half edge running from one vertex to the other.
public static HalfEdgeHandle FindHalfEdgeConnectingVertices(VertexHandle hVertexA, VertexHandle hVertexB)Parameters
hVertexA VertexHandle
hVertexB VertexHandle
Returns
FindNextHalfEdgeInLoop(HalfEdgeHandle, int)
Returns the next edge of an edge loop, carrying straight on through the vertex.
public static HalfEdgeHandle FindNextHalfEdgeInLoop(HalfEdgeHandle hEdge, int nMaxVertexEdges)Parameters
hEdge HalfEdgeHandle
nMaxVertexEdges int
Returns
FindOpenEdgeIslands(IReadOnlyList<HalfEdgeHandle>, out List<List<HalfEdgeHandle>>, out List<List<HalfEdgeHandle>>)
Splits the open edges of a set into connected groups, both as half edges and as full edges.
public void FindOpenEdgeIslands(IReadOnlyList<HalfEdgeHandle> edges, out List<List<HalfEdgeHandle>> outHalfEdgeIslandList, out List<List<HalfEdgeHandle>> outFullEdgeIslandList)Parameters
edges IReadOnlyList<HalfEdgeHandle>
outHalfEdgeIslandList List<List<HalfEdgeHandle>>
outFullEdgeIslandList List<List<HalfEdgeHandle>>
FindOpenOppositeEdgeInVertexLoop(VertexHandle)
Finds an edge pointing at a vertex that borders no face.
public static HalfEdgeHandle FindOpenOppositeEdgeInVertexLoop(VertexHandle hVertex)Parameters
hVertex VertexHandle
Vertex whose edge loop is walked.
Returns
The open edge, or when the vertex is closed.
FindOppositeEdgeWithNextEdgeInVertexLoop(VertexHandle, HalfEdgeHandle)
Finds the edge pointing at a vertex whose next edge is the given one.
public static HalfEdgeHandle FindOppositeEdgeWithNextEdgeInVertexLoop(VertexHandle hVertex, HalfEdgeHandle hNextEdge)Parameters
hVertex VertexHandle
Vertex whose edge loop is walked.
hNextEdge HalfEdgeHandle
Edge the result must lead into.
Returns
The matching edge, or when there is none.
FindOppositeHalfEdgeInFace(HalfEdgeHandle, int)
Returns the edge across the face from the given one.
public static HalfEdgeHandle FindOppositeHalfEdgeInFace(HalfEdgeHandle hEdge, int nMaxFaceSides = -1)Parameters
hEdge HalfEdgeHandle
nMaxFaceSides int
Returns
FindPreviousEdgeInFaceLoop(HalfEdgeHandle)
Returns the previous edge around the face.
public static HalfEdgeHandle FindPreviousEdgeInFaceLoop(HalfEdgeHandle hEdge)Parameters
hEdge HalfEdgeHandle
Returns
FindPreviousEdgeInVertexLoop(HalfEdgeHandle)
Returns the previous edge around the vertex.
public static HalfEdgeHandle FindPreviousEdgeInVertexLoop(HalfEdgeHandle hEdge)Parameters
hEdge HalfEdgeHandle
Returns
FindVertexConnectingFullEdges(HalfEdgeHandle, HalfEdgeHandle)
Returns the vertex both full edges meet at.
public static VertexHandle FindVertexConnectingFullEdges(HalfEdgeHandle hEdgeA, HalfEdgeHandle hEdgeB)Parameters
hEdgeA HalfEdgeHandle
hEdgeB HalfEdgeHandle
Returns
FindVertexIslands(IReadOnlyList<VertexHandle>, int, out List<List<VertexHandle>>)
Splits a set of vertices into groups connected by edges.
public static void FindVertexIslands(IReadOnlyList<VertexHandle> hVertices, int nNumVertices, out List<List<VertexHandle>> pOutVertexList)Parameters
hVertices IReadOnlyList<VertexHandle>
nNumVertices int
pOutVertexList List<List<VertexHandle>>
FindVerticesConnectedToFaces(IReadOnlyList<FaceHandle>, int, out VertexHandle[])
Collects every vertex touched by a set of faces.
public static void FindVerticesConnectedToFaces(IReadOnlyList<FaceHandle> pFaceList, int nNumFaces, out VertexHandle[] outVertices)Parameters
pFaceList IReadOnlyList<FaceHandle>
nNumFaces int
outVertices VertexHandle[]
FindVerticesConnectedToFullEdges(IReadOnlyList<HalfEdgeHandle>, out VertexHandle[])
Collects every vertex touched by a set of full edges.
public static void FindVerticesConnectedToFullEdges(IReadOnlyList<HalfEdgeHandle> edgeList, out VertexHandle[] outVertices)Parameters
edgeList IReadOnlyList<HalfEdgeHandle>
outVertices VertexHandle[]
GetEndVertexConnectedToEdge(HalfEdgeHandle)
Returns the face the half edge borders.
public static VertexHandle GetEndVertexConnectedToEdge(HalfEdgeHandle hHalfEdge)Parameters
hHalfEdge HalfEdgeHandle
Returns
GetFaceConnectedToFullEdge(HalfEdgeHandle)
Returns the first face a full edge borders.
public static FaceHandle GetFaceConnectedToFullEdge(HalfEdgeHandle hFullEdge)Parameters
hFullEdge HalfEdgeHandle
Returns
GetFaceConnectedToHalfEdge(HalfEdgeHandle)
Returns the face the half edge borders.
public static FaceHandle GetFaceConnectedToHalfEdge(HalfEdgeHandle hEdge)Parameters
hEdge HalfEdgeHandle
Returns
GetFacesConnectedToFace(FaceHandle, out List<FaceHandle>)
Collects the faces sharing an edge with the given face.
public static bool GetFacesConnectedToFace(FaceHandle hFace, out List<FaceHandle> faces)Parameters
hFace FaceHandle
faces List<FaceHandle>
Returns
GetFacesConnectedToFullEdge(HalfEdgeHandle, out FaceHandle, out FaceHandle)
Returns the faces on either side of a full edge.
public static void GetFacesConnectedToFullEdge(HalfEdgeHandle hFullEdge, out FaceHandle hOutFaceA, out FaceHandle hOutFaceB)Parameters
hFullEdge HalfEdgeHandle
hOutFaceA FaceHandle
hOutFaceB FaceHandle
GetFacesConnectedToVertex(VertexHandle, out List<FaceHandle>)
Collects the faces meeting at a vertex.
public static bool GetFacesConnectedToVertex(VertexHandle hVertex, out List<FaceHandle> faces)Parameters
hVertex VertexHandle
faces List<FaceHandle>
Returns
GetFirstEdgeInFaceLoop(FaceHandle)
Returns the edge a face loop starts at.
public static HalfEdgeHandle GetFirstEdgeInFaceLoop(FaceHandle hFace)Parameters
hFace FaceHandle
Returns
GetFirstEdgeInVertexLoop(VertexHandle)
Returns the edge a vertex loop starts at.
public static HalfEdgeHandle GetFirstEdgeInVertexLoop(VertexHandle hVertex)Parameters
hVertex VertexHandle
Returns
GetFullEdgeForHalfEdge(HalfEdgeHandle)
Returns the canonical half-edge representing the full edge that hEdge belongs to.
public HalfEdgeHandle GetFullEdgeForHalfEdge(HalfEdgeHandle hEdge)Parameters
hEdge HalfEdgeHandle
The half-edge to find the full edge for.
Returns
The half-edge of the opposite pair with the lower index, or if hEdge is invalid.
GetFullEdgesConnectedToFace(FaceHandle, out List<HalfEdgeHandle>)
Collects the full edges bounding a face.
public bool GetFullEdgesConnectedToFace(FaceHandle hFace, out List<HalfEdgeHandle> edges)Parameters
hFace FaceHandle
edges List<HalfEdgeHandle>
Returns
GetFullEdgesConnectedToVertex(VertexHandle, out List<HalfEdgeHandle>, EdgeConnectivityType)
Collects the full edges at a vertex, filtered by how many faces they border.
public bool GetFullEdgesConnectedToVertex(VertexHandle hVertex, out List<HalfEdgeHandle> edges, EdgeConnectivityType nEdgeType = EdgeConnectivityType.Any)Parameters
hVertex VertexHandle
edges List<HalfEdgeHandle>
nEdgeType EdgeConnectivityType
Returns
GetHalfEdgeForFaceEdge(FaceHandle, HalfEdgeHandle)
Returns the half edge of a full edge that borders the given face.
public static HalfEdgeHandle GetHalfEdgeForFaceEdge(FaceHandle hFace, HalfEdgeHandle hFullEdge)Parameters
hFace FaceHandle
hFullEdge HalfEdgeHandle
Returns
GetHalfEdgesConnectedToFace(FaceHandle, out HalfEdgeHandle[]?)
Collects the half edges bounding a face.
public static bool GetHalfEdgesConnectedToFace(FaceHandle hFace, out HalfEdgeHandle[]? hEdges)Parameters
hFace FaceHandle
hEdges HalfEdgeHandle[]?
Returns
GetHalfEdgesConnectedToFullEdge(HalfEdgeHandle, out HalfEdgeHandle, out HalfEdgeHandle)
Returns the two half edges that make up a full edge.
public static void GetHalfEdgesConnectedToFullEdge(HalfEdgeHandle hFullEdge, out HalfEdgeHandle hOutHalfEdgeA, out HalfEdgeHandle hOutHalfEdgeB)Parameters
hFullEdge HalfEdgeHandle
hOutHalfEdgeA HalfEdgeHandle
hOutHalfEdgeB HalfEdgeHandle
GetIncomingHalfEdgesConnectedToVertex(VertexHandle, out List<HalfEdgeHandle>)
Collects the half edges arriving at a vertex.
public static bool GetIncomingHalfEdgesConnectedToVertex(VertexHandle hVertex, out List<HalfEdgeHandle> edges)Parameters
hVertex VertexHandle
edges List<HalfEdgeHandle>
Returns
GetNextEdgeInFaceLoop(HalfEdgeHandle)
Returns the next edge around the face.
public static HalfEdgeHandle GetNextEdgeInFaceLoop(HalfEdgeHandle hEdge)Parameters
hEdge HalfEdgeHandle
Returns
GetNextEdgeInVertexLoop(HalfEdgeHandle)
Returns the next edge around the vertex.
public static HalfEdgeHandle GetNextEdgeInVertexLoop(HalfEdgeHandle hHalfEdge)Parameters
hHalfEdge HalfEdgeHandle
Returns
GetOppositeFaceConnectedToFullEdge(HalfEdgeHandle, FaceHandle)
Returns the face on the other side of a full edge from the given one.
public static FaceHandle GetOppositeFaceConnectedToFullEdge(HalfEdgeHandle hFullEdge, FaceHandle hFace)Parameters
hFullEdge HalfEdgeHandle
hFace FaceHandle
Returns
GetOppositeHalfEdge(HalfEdgeHandle)
Returns the half edge running the opposite direction.
public static HalfEdgeHandle GetOppositeHalfEdge(HalfEdgeHandle hEdge)Parameters
hEdge HalfEdgeHandle
Returns
GetOutgoingHalfEdgesConnectedToVertex(VertexHandle, out List<HalfEdgeHandle>)
Collects the half edges leaving a vertex.
public static bool GetOutgoingHalfEdgesConnectedToVertex(VertexHandle hVertex, out List<HalfEdgeHandle> edges)Parameters
hVertex VertexHandle
edges List<HalfEdgeHandle>
Returns
GetVerticesConnectedToFace(FaceHandle, out VertexHandle[]?)
Collects the corner vertices of a face.
public static bool GetVerticesConnectedToFace(FaceHandle hFace, out VertexHandle[]? vertices)Parameters
hFace FaceHandle
vertices VertexHandle[]?
Returns
GetVerticesConnectedToFullEdge(HalfEdgeHandle, out VertexHandle, out VertexHandle)
Returns both vertices of a full edge.
public static void GetVerticesConnectedToFullEdge(HalfEdgeHandle hEdge, out VertexHandle hVertexA, out VertexHandle hVertexB)Parameters
hEdge HalfEdgeHandle
hVertexA VertexHandle
hVertexB VertexHandle
GetVerticesConnectedToHalfEdge(HalfEdgeHandle, out VertexHandle, out VertexHandle)
Walks the edge loop that starts at the given edge.
public static void GetVerticesConnectedToHalfEdge(HalfEdgeHandle hEdge, out VertexHandle hVertexA, out VertexHandle hVertexB)Parameters
hEdge HalfEdgeHandle
hVertexA VertexHandle
hVertexB VertexHandle
GetVerticesConnectedToVertexByEdge(VertexHandle, out List<VertexHandle>)
Collects the vertices one edge away from a vertex.
public static bool GetVerticesConnectedToVertexByEdge(VertexHandle hVertex, out List<VertexHandle> vertices)Parameters
hVertex VertexHandle
vertices List<VertexHandle>
Returns
IsFaceAllocated(FaceHandle)
Whether the face slot is still in use.
public bool IsFaceAllocated(FaceHandle hFace)Parameters
hFace FaceHandle
Face to test.
Returns
IsFullEdgeOpen(HalfEdgeHandle)
Whether the full edge borders only one face.
public static bool IsFullEdgeOpen(HalfEdgeHandle hFullEdge)Parameters
hFullEdge HalfEdgeHandle
Returns
IsHalfEdgeAllocated(HalfEdgeHandle)
Whether the half edge slot is still in use.
public bool IsHalfEdgeAllocated(HalfEdgeHandle hHalfEdge)Parameters
hHalfEdge HalfEdgeHandle
Half edge to test.
Returns
IsVertexAllocated(VertexHandle)
Whether the vertex slot is still in use.
public bool IsVertexAllocated(VertexHandle hVertex)Parameters
hVertex VertexHandle
Vertex to test.
Returns
IsVertexInternal(VertexHandle)
Whether every edge at the vertex borders two faces.
public static bool IsVertexInternal(VertexHandle hVertex)Parameters
hVertex VertexHandle
Returns
UntriangulateMesh(VertexData<Vector3>, Func<FaceHandle, FaceHandle, bool>?, float, float)
Untriangulation inspired by blender's "Triangles to Quads" operator
Joins pairs of adjacent triangles into quads by dissolving their shared edge, processing the candidates with the lowest quad error first
A pair is skipped when the angle between the triangle normals exceeds maxFaceAngleDegrees, or if any of its corners deviates from 90 degrees by more than maxShapeAngleDegrees
public int UntriangulateMesh(VertexData<Vector3> positions, Func<FaceHandle, FaceHandle, bool>? canMergeFaces = null, float maxFaceAngleDegrees = 40, float maxShapeAngleDegrees = 80)Parameters
positions VertexData<Vector3>
Mesh Vertex Positions
canMergeFaces Func<FaceHandle, FaceHandle, bool>?
Function that compares two faces, and returns if the faces should be merged or not
maxFaceAngleDegrees float
Angle between triangle normals to skip this pair
maxShapeAngleDegrees float
Angle deviation of a triangle corner from 90 degrees to skip
Returns
The number of edges dissolved (pairs of triangles joined into quads)

