Class Mesh<TPosition>
Class for a polyhedral halfedge mesh data structure.
Inheritance
Inherited Members
Namespace: BRIDGES.DataStructures.PolyhedralMeshes.HalfedgeMesh
Assembly: BRIDGES.dll
Syntax
public class Mesh<TPosition> : Mesh<TPosition, Vertex<TPosition>, Edge<TPosition>, Face<TPosition>>, IMesh<TPosition> where TPosition : IEquatable<TPosition>
Type Parameters
Name | Description |
---|---|
TPosition | Type for the position of the vertex. |
Constructors
| Improve this Doc View SourceMesh()
Initialises a new instance of the Mesh<TPosition> class.
Declaration
public Mesh()
Fields
| Improve this Doc View Source_faces
Dictionary containing the Face<TPosition> of the current Mesh<TPosition>.
Declaration
protected Dictionary<int, Face<TPosition>> _faces
Field Value
Type | Description |
---|---|
Dictionary<Int32, Face<TPosition>> |
Remarks
Key : Index of the Face<TPosition>; Value : Corresponding Face<TPosition>.
_halfedges
Dictionary containing the Edge<TPosition> of the current Mesh<TPosition>.
Declaration
protected Dictionary<int, Halfedge<TPosition>> _halfedges
Field Value
Type | Description |
---|---|
Dictionary<Int32, Halfedge<TPosition>> |
Remarks
Key : Index of the Edge<TPosition>; Value : Corresponding Edge<TPosition>.
_newFaceIndex
Index for a newly created face.
Declaration
protected int _newFaceIndex
Field Value
Type | Description |
---|---|
Int32 |
Remarks
This may not match with FaceCount if faces are removed from the mesh.
_newHalfedgeIndex
Index for a newly created edge.
Declaration
protected int _newHalfedgeIndex
Field Value
Type | Description |
---|---|
Int32 |
Remarks
This may not match with EdgeCount if edges are removed from the mesh.
_newVertexIndex
Index for a newly created vertex.
Declaration
protected int _newVertexIndex
Field Value
Type | Description |
---|---|
Int32 |
Remarks
This may not match with VertexCount if vertices are removed from the mesh.
_vertices
Dictionary containing the Vertex<TPosition> of the current Mesh<TPosition>.
Declaration
protected Dictionary<int, Vertex<TPosition>> _vertices
Field Value
Type | Description |
---|---|
Dictionary<Int32, Vertex<TPosition>> |
Remarks
Key : Index of the Vertex<TPosition>; Value : Corresponding Vertex<TPosition>.
Properties
| Improve this Doc View SourceEdgeCount
Gets the number of edges in the current mesh.
Declaration
public override int EdgeCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Overrides
FaceCount
Gets the number of faces in the current mesh.
Declaration
public override int FaceCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Overrides
HalfedgeCount
Class for a polyhedral halfedge mesh data structure.
Declaration
public int HalfedgeCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
VertexCount
Gets the number of vertices in the current mesh.
Declaration
public override int VertexCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Overrides
Methods
| Improve this Doc View SourceAddFace(List<Vertex<TPosition>>)
Adds a new face to the current mesh from its vertices.
Declaration
public override Face<TPosition> AddFace(List<Vertex<TPosition>> vertices)
Parameters
Type | Name | Description |
---|---|---|
List<Vertex<TPosition>> | vertices |
Returns
Type | Description |
---|---|
Face<TPosition> | The new face if it was added, null otherwise. |
Overrides
AddVertex(TPosition)
Adds a vertex in the mesh from its position.
Declaration
public override Vertex<TPosition> AddVertex(TPosition position)
Parameters
Type | Name | Description |
---|---|---|
TPosition | position | Position of the vertex. |
Returns
Type | Description |
---|---|
Vertex<TPosition> | The new vertex if it was added, null otherwise. |
Overrides
CleanMesh(Boolean)
Cleans the current mesh by reindexing the faces, edges and vertices.
Declaration
public override void CleanMesh(bool cullIsolated = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | cullIsolated | Evaluates whether isolated members should be removed in the process. |
Overrides
Clone()
Creates a new object that is a deep copy of the current instance.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
Object | The new object that is a deep copy of the current instance. |
Overrides
EdgeBetween(Vertex<TPosition>, Vertex<TPosition>)
Looks for the edge between vertexA
and vertexB
.
Declaration
public override Edge<TPosition> EdgeBetween(Vertex<TPosition> vertexA, Vertex<TPosition> vertexB)
Parameters
Type | Name | Description |
---|---|---|
Vertex<TPosition> | vertexA | |
Vertex<TPosition> | vertexB |
Returns
Type | Description |
---|---|
Edge<TPosition> | The edge if it exists, null otherwise. |
Overrides
EraseEdge(Edge<TPosition>)
Erases the edge from the mesh. The mesh may not be manifold after this operation.
Declaration
public override void EraseEdge(Edge<TPosition> edge)
Parameters
Type | Name | Description |
---|---|---|
Edge<TPosition> | edge |
Overrides
EraseFace(Face<TPosition>)
Erases the face from the mesh. The mesh may not be manifold after this operation.
Declaration
public override void EraseFace(Face<TPosition> face)
Parameters
Type | Name | Description |
---|---|---|
Face<TPosition> | face |
Overrides
EraseHalfedge(Halfedge<TPosition>)
Erases any reference to the halfedge and its pair halfedge, then delete them from the mesh.
Declaration
public void EraseHalfedge(Halfedge<TPosition> halfedge)
Parameters
Type | Name | Description |
---|---|---|
Halfedge<TPosition> | halfedge | The halfedge to erase. |
EraseVertex(Vertex<TPosition>)
Erases the vertex from the mesh. Every reference to this vertex should be deleted before it is erased.
Declaration
protected override void EraseVertex(Vertex<TPosition> vertex)
Parameters
Type | Name | Description |
---|---|---|
Vertex<TPosition> | vertex |
Overrides
GetEdge(Int32)
Returns the edge at the given index in the mesh.
Declaration
public override Edge<TPosition> GetEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Edge<TPosition> | The edge at the given index in the mesh. |
Overrides
GetEdges()
Returns the list of edges of the current mesh.
Declaration
public override IReadOnlyList<Edge<TPosition>> GetEdges()
Returns
Type | Description |
---|---|
IReadOnlyList<Edge<TPosition>> | List of edges of the mesh. |
Overrides
Remarks
If some edges were removed from the mesh, the index of the edge in the returned list might not match the edge index in the mesh.
The index of the edges in the mesh is accessible through the Index property.
GetFace(Int32)
Returns the face at the given index in the mesh.
Declaration
public override Face<TPosition> GetFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Face<TPosition> | The face at the given index in the mesh. |
Overrides
GetFaces()
Returns the list of faces of the current mesh.
Declaration
public override IReadOnlyList<Face<TPosition>> GetFaces()
Returns
Type | Description |
---|---|
IReadOnlyList<Face<TPosition>> | List of faces of the mesh. |
Overrides
Remarks
If some faces were removed from the mesh, the index of the face in the returned list might not match the face index in the mesh.
The index of the faces in the mesh is accessible through the Index property.
GetHalfedge(Int32)
Returns the halfedge at the given index in the mesh.
Declaration
public Halfedge<TPosition> GetHalfedge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Halfedge<TPosition> | The hlafedge at the given index in the mesh. |
GetHalfedges()
Returns the list of halfedges of the current mesh.
Declaration
public IReadOnlyList<Halfedge<TPosition>> GetHalfedges()
Returns
Type | Description |
---|---|
IReadOnlyList<Halfedge<TPosition>> | List of edges of the mesh. |
Remarks
If some halfedges were removed from the mesh, the index of the halfedge in the returned list might not match the halfedge index in the mesh.
The index of the halfedges in the mesh is accessible through the Index property.
GetVertex(Int32)
Returns the vertex at the given index in the mesh.
Declaration
public override Vertex<TPosition> GetVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Vertex<TPosition> | The vertex at the given index in the mesh. |
Overrides
GetVertices()
Returns the list of vertices of the current mesh.
Declaration
public override IReadOnlyList<Vertex<TPosition>> GetVertices()
Returns
Type | Description |
---|---|
IReadOnlyList<Vertex<TPosition>> | List of vertices of the mesh. |
Overrides
Remarks
If some vertices were removed from the mesh, the index of the vertex in the returned list might not match the vertex index in the mesh.
The index of the vertices in the mesh is accessible through the Index property.
HalfedgeBetween(Vertex<TPosition>, Vertex<TPosition>)
Looks for the halfedge starting at startVertex
and ending at endVertex
.
Declaration
public Halfedge<TPosition> HalfedgeBetween(Vertex<TPosition> startVertex, Vertex<TPosition> endVertex)
Parameters
Type | Name | Description |
---|---|---|
Vertex<TPosition> | startVertex | Start vertex of the halfedge. |
Vertex<TPosition> | endVertex | End vertex of the halfedge. |
Returns
Type | Description |
---|---|
Halfedge<TPosition> | The halfedge if it exists, null otherwise. |
RemoveEdge(Edge<TPosition>)
Removes the edge from the mesh by keeping the mesh manifold.
Declaration
public override void RemoveEdge(Edge<TPosition> edge)
Parameters
Type | Name | Description |
---|---|---|
Edge<TPosition> | edge |
Overrides
RemoveFace(Face<TPosition>)
Removes the face from the mesh by keeping the mesh manifold.
Declaration
public override void RemoveFace(Face<TPosition> face)
Parameters
Type | Name | Description |
---|---|---|
Face<TPosition> | face |
Overrides
RemoveHalfedge(Halfedge<TPosition>)
Removes the halfedge and its pair halfedge by keeping the mesh manifold.
Declaration
public void RemoveHalfedge(Halfedge<TPosition> halfedge)
Parameters
Type | Name | Description |
---|---|---|
Halfedge<TPosition> | halfedge | The halfedge to remove. |
RemoveVertex(Vertex<TPosition>)
Removes the vertex from the mesh by keeping the mesh manifold.
Declaration
public override void RemoveVertex(Vertex<TPosition> vertex)
Parameters
Type | Name | Description |
---|---|---|
Vertex<TPosition> | vertex |
Overrides
ToFaceVertexMesh()
Creates a face-vertex mesh from the current halfedge mesh.
Declaration
public Mesh<TPosition> ToFaceVertexMesh()
Returns
Type | Description |
---|---|
Mesh<TPosition> | Face-vertex mesh which represents the topology and geometry of the current halfedge mesh. |
ToString()
Class for a polyhedral halfedge mesh data structure.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
TryGetEdge(Int32)
Returns the edge at the given index in the mesh if it exists, null otherwise.
Declaration
public override Edge<TPosition> TryGetEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the edge to look for. |
Returns
Type | Description |
---|---|
Edge<TPosition> | The edge if it exists, null otherwise. |
Overrides
TryGetFace(Int32)
Returns the face at the given index in the mesh if it exists, null otherwise.
Declaration
public override Face<TPosition> TryGetFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the face to look for. |
Returns
Type | Description |
---|---|
Face<TPosition> | The face if it exists, null otherwise. |
Overrides
TryGetHalfedge(Int32)
Returns the halfedge at the given index in the mesh if it exists, null otherwise.
Declaration
public Halfedge<TPosition> TryGetHalfedge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the halfedge to look for. |
Returns
Type | Description |
---|---|
Halfedge<TPosition> | The halfedge if it exists, null otherwise. |
TryGetVertex(Int32)
Returns the vertex at the given index in the mesh if it exists, null otherwise.
Declaration
public override Vertex<TPosition> TryGetVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the vertex to look for. |
Returns
Type | Description |
---|---|
Vertex<TPosition> | The vertex if it exists, null otherwise. |