Class Mesh<TPosition, TVertex, TEdge, TFace>
Abstract class for a polyhedral mesh data structure.
Namespace: BRIDGES.DataStructures.PolyhedralMeshes.Abstract
Assembly: BRIDGES.dll
Syntax
public abstract class Mesh<TPosition, TVertex, TEdge, TFace> : object, IMesh<TPosition> where TPosition : IEquatable<TPosition> where TVertex : Vertex<TPosition, TVertex, TEdge, TFace> where TEdge : Edge<TPosition, TVertex, TEdge, TFace> where TFace : Face<TPosition, TVertex, TEdge, TFace>
Type Parameters
Name | Description |
---|---|
TPosition | Type for the position of the vertex. |
TVertex | Type of vertex for the mesh. |
TEdge | Type of vertex for the mesh. |
TFace | Type of vertex for the mesh. |
Constructors
| Improve this Doc View SourceMesh()
Initialises a new instance of the Mesh<TPosition, TVertex, TEdge, TFace> class.
Declaration
protected Mesh()
Properties
| Improve this Doc View SourceEdgeCount
Gets the number of edges in the current mesh.
Declaration
public abstract int EdgeCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
FaceCount
Gets the number of faces in the current mesh.
Declaration
public abstract int FaceCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
VertexCount
Gets the number of vertices in the current mesh.
Declaration
public abstract int VertexCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAddEdge(Int32, Int32)
Adds a new edge to the current mesh.
Declaration
protected TEdge AddEdge(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | startIndex | Index of the start vertex for the new edge. |
Int32 | endIndex | Index of the end vertex for the new edge. |
Returns
Type | Description |
---|---|
TEdge | The new edge if it was added, null otherwise. |
AddFace(TVertex, TVertex, TVertex, TVertex)
Adds a new quadrangular face to the current mesh.
Declaration
public TFace AddFace(TVertex vertexA, TVertex vertexB, TVertex vertexC, TVertex vertexD)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertexA | First vertex for the new face. |
TVertex | vertexB | Second vertex for the new face. |
TVertex | vertexC | Third vertex for the new face. |
TVertex | vertexD | Fourth vertex for the new face. |
Returns
Type | Description |
---|---|
TFace | The newly created quadrangular face. |
AddFace(TVertex, TVertex, TVertex)
Adds a new triangular face to the current mesh.
Declaration
public TFace AddFace(TVertex vertexA, TVertex vertexB, TVertex vertexC)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertexA | First vertex for the new face. |
TVertex | vertexB | Second vertex for the new face. |
TVertex | vertexC | Third vertex for the new face. |
Returns
Type | Description |
---|---|
TFace | The newly created triangular face. |
AddFace(List<TVertex>)
Adds a new face to the current mesh from its vertices.
Declaration
public abstract TFace AddFace(List<TVertex> vertices)
Parameters
Type | Name | Description |
---|---|---|
List<TVertex> | vertices | Ordered list of the face's vertex. |
Returns
Type | Description |
---|---|
TFace | The new face if it was added, null otherwise. |
AddFace(List<Int32>)
Adds a new face to the current mesh.
Declaration
public TFace AddFace(List<int> indices)
Parameters
Type | Name | Description |
---|---|---|
List<Int32> | indices | Ordered list of the face's vertex indices. |
Returns
Type | Description |
---|---|
TFace | The newly created face. |
AddFace(Int32, Int32, Int32, Int32)
Adds a new quadrangular face to the current mesh.
Declaration
public TFace AddFace(int indexA, int indexB, int indexC, int indexD)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexA | Index of the first vertex for the new face. |
Int32 | indexB | Index of the second vertex for the new face. |
Int32 | indexC | Index of the third vertex for the new face. |
Int32 | indexD | Index of the fourth vertex for the new face. |
Returns
Type | Description |
---|---|
TFace | The newly created quadrangular face. |
AddFace(Int32, Int32, Int32)
Adds a new triangular face to the current mesh.
Declaration
public TFace AddFace(int indexA, int indexB, int indexC)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexA | Index of the first vertex for the new face. |
Int32 | indexB | Index of the second vertex for the new face. |
Int32 | indexC | Index of the third vertex for the new face. |
Returns
Type | Description |
---|---|
TFace | The newly created triangular face. |
AddVertex(TPosition)
Adds a vertex in the mesh from its position.
Declaration
public abstract TVertex AddVertex(TPosition position)
Parameters
Type | Name | Description |
---|---|---|
TPosition | position | Position of the vertex. |
Returns
Type | Description |
---|---|
TVertex | The new vertex if it was added, null otherwise. |
CleanMesh(Boolean)
Cleans the current mesh by reindexing the faces, edges and vertices.
Declaration
public abstract void CleanMesh(bool cullIsolated = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | cullIsolated | Evaluates whether isolated members should be removed in the process. |
Clone()
Creates a new object that is a deep copy of the current instance.
Declaration
public abstract object Clone()
Returns
Type | Description |
---|---|
Object | The new object that is a deep copy of the current instance. |
EdgeBetween(TVertex, TVertex)
Looks for the edge between vertexA
and vertexB
.
Declaration
public virtual TEdge EdgeBetween(TVertex vertexA, TVertex vertexB)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertexA | First end vertex of the edge. |
TVertex | vertexB | Second end vertex of the edge. |
Returns
Type | Description |
---|---|
TEdge | The edge if it exists, null otherwise. |
EdgeBetween(Int32, Int32)
Looks for the edge between two vertices.
Declaration
public TEdge EdgeBetween(int indexA, int indexB)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexA | Index of the first end vertex of the edge. |
Int32 | indexB | Index of the second end vertex of the edge. |
Returns
Type | Description |
---|---|
TEdge | The edge if it exists, null otherwise. |
Equals(Object)
Abstract class for a polyhedral mesh data structure.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
EraseEdge(TEdge)
Erases the edge from the mesh. The mesh may not be manifold after this operation.
Declaration
public abstract void EraseEdge(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | Edge to erase. |
EraseEdge(Int32)
Erases the edge at the given index in the mesh. The mesh may be non-manifold after this operation.
Declaration
public void EraseEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the edge to erase. |
EraseFace(TFace)
Erases the face from the mesh. The mesh may not be manifold after this operation.
Declaration
public abstract void EraseFace(TFace face)
Parameters
Type | Name | Description |
---|---|---|
TFace | face | Face to erase. |
EraseFace(Int32)
Erases the face at the given index in the mesh. The mesh may be non-manifold after this operation.
Declaration
public void EraseFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the face to erase. |
EraseVertex(TVertex)
Erases the vertex from the mesh. Every reference to this vertex should be deleted before it is erased.
Declaration
protected abstract void EraseVertex(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | The vertex to erase. |
EraseVertex(Int32)
Erases the vertex at the given index in the mesh. Every reference to this vertex should be deleted before it is erased.
Declaration
public void EraseVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the vertex to erase. |
GetEdge(Int32)
Returns the edge at the given index in the mesh.
Declaration
public abstract TEdge GetEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
TEdge | The edge at the given index in the mesh. |
GetEdges()
Returns the list of edges of the current mesh.
Declaration
public abstract IReadOnlyList<TEdge> GetEdges()
Returns
Type | Description |
---|---|
IReadOnlyList<TEdge> | List of edges of the mesh. |
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 abstract TFace GetFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
TFace | The face at the given index in the mesh. |
GetFaces()
Returns the list of faces of the current mesh.
Declaration
public abstract IReadOnlyList<TFace> GetFaces()
Returns
Type | Description |
---|---|
IReadOnlyList<TFace> | List of faces of the mesh. |
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.
GetHashCode()
Abstract class for a polyhedral mesh data structure.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
GetVertex(Int32)
Returns the vertex at the given index in the mesh.
Declaration
public abstract TVertex GetVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
TVertex | The vertex at the given index in the mesh. |
GetVertices()
Returns the list of vertices of the current mesh.
Declaration
public abstract IReadOnlyList<TVertex> GetVertices()
Returns
Type | Description |
---|---|
IReadOnlyList<TVertex> | List of vertices of the mesh. |
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.
RemoveEdge(TEdge)
Removes the edge from the mesh by keeping the mesh manifold.
Declaration
public abstract void RemoveEdge(TEdge edge)
Parameters
Type | Name | Description |
---|---|---|
TEdge | edge | Edge to remove. |
RemoveEdge(Int32)
Removes the edge at the given index in the mesh by keeping the mesh manifold.
Declaration
public void RemoveEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the edge to remove. |
RemoveFace(TFace)
Removes the face from the mesh by keeping the mesh manifold.
Declaration
public abstract void RemoveFace(TFace face)
Parameters
Type | Name | Description |
---|---|---|
TFace | face | Face to remove. |
RemoveFace(Int32)
Removes the face at the given index in the mesh by keeping the mesh manifold.
Declaration
public void RemoveFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the face to remove. |
RemoveVertex(TVertex)
Removes the vertex from the mesh by keeping the mesh manifold.
Declaration
public abstract void RemoveVertex(TVertex vertex)
Parameters
Type | Name | Description |
---|---|---|
TVertex | vertex | Vertex to remove. |
RemoveVertex(Int32)
Removes the vertex at the given index in the mesh by keeping the mesh manifold.
Declaration
public void RemoveVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the vertex to remove. |
ToString()
Abstract class for a polyhedral mesh data structure.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
TryGetEdge(Int32)
Returns the edge at the given index in the mesh if it exists, null otherwise.
Declaration
public abstract TEdge TryGetEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the edge to look for. |
Returns
Type | Description |
---|---|
TEdge | The edge if it exists, null otherwise. |
TryGetFace(Int32)
Returns the face at the given index in the mesh if it exists, null otherwise.
Declaration
public abstract TFace TryGetFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the face to look for. |
Returns
Type | Description |
---|---|
TFace | The face if it exists, null otherwise. |
TryGetVertex(Int32)
Returns the vertex at the given index in the mesh if it exists, null otherwise.
Declaration
public abstract TVertex TryGetVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the vertex to look for. |
Returns
Type | Description |
---|---|
TVertex | The vertex if it exists, null otherwise. |
Explicit Interface Implementations
| Improve this Doc View SourceIMesh<TPosition>.AddEdge(Int32, Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IEdge<TPosition> IMesh<TPosition>.AddEdge(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | startIndex | |
Int32 | endIndex |
Returns
Type | Description |
---|---|
IEdge<TPosition> |
IMesh<TPosition>.AddFace(List<Int32>)
Abstract class for a polyhedral mesh data structure.
Declaration
IFace<TPosition> IMesh<TPosition>.AddFace(List<int> indices)
Parameters
Type | Name | Description |
---|---|---|
List<Int32> | indices |
Returns
Type | Description |
---|---|
IFace<TPosition> |
IMesh<TPosition>.AddFace(Int32, Int32, Int32, Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IFace<TPosition> IMesh<TPosition>.AddFace(int indexA, int indexB, int indexC, int indexD)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexA | |
Int32 | indexB | |
Int32 | indexC | |
Int32 | indexD |
Returns
Type | Description |
---|---|
IFace<TPosition> |
IMesh<TPosition>.AddFace(Int32, Int32, Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IFace<TPosition> IMesh<TPosition>.AddFace(int indexA, int indexB, int indexC)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexA | |
Int32 | indexB | |
Int32 | indexC |
Returns
Type | Description |
---|---|
IFace<TPosition> |
IMesh<TPosition>.AddVertex(TPosition)
Abstract class for a polyhedral mesh data structure.
Declaration
IVertex<TPosition> IMesh<TPosition>.AddVertex(TPosition position)
Parameters
Type | Name | Description |
---|---|---|
TPosition | position |
Returns
Type | Description |
---|---|
IVertex<TPosition> |
IMesh<TPosition>.EdgeBetween(Int32, Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IEdge<TPosition> IMesh<TPosition>.EdgeBetween(int indexA, int indexB)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexA | |
Int32 | indexB |
Returns
Type | Description |
---|---|
IEdge<TPosition> |
IMesh<TPosition>.GetEdge(Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IEdge<TPosition> IMesh<TPosition>.GetEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
IEdge<TPosition> |
IMesh<TPosition>.GetEdges()
Abstract class for a polyhedral mesh data structure.
Declaration
IReadOnlyList<IEdge<TPosition>> IMesh<TPosition>.GetEdges()
Returns
Type | Description |
---|---|
IReadOnlyList<IEdge<TPosition>> |
IMesh<TPosition>.GetFace(Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IFace<TPosition> IMesh<TPosition>.GetFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
IFace<TPosition> |
IMesh<TPosition>.GetFaces()
Abstract class for a polyhedral mesh data structure.
Declaration
IReadOnlyList<IFace<TPosition>> IMesh<TPosition>.GetFaces()
Returns
Type | Description |
---|---|
IReadOnlyList<IFace<TPosition>> |
IMesh<TPosition>.GetVertex(Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IVertex<TPosition> IMesh<TPosition>.GetVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
IVertex<TPosition> |
IMesh<TPosition>.GetVertices()
Abstract class for a polyhedral mesh data structure.
Declaration
IReadOnlyList<IVertex<TPosition>> IMesh<TPosition>.GetVertices()
Returns
Type | Description |
---|---|
IReadOnlyList<IVertex<TPosition>> |
IMesh<TPosition>.TryGetEdge(Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IEdge<TPosition> IMesh<TPosition>.TryGetEdge(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
IEdge<TPosition> |
IMesh<TPosition>.TryGetFace(Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IFace<TPosition> IMesh<TPosition>.TryGetFace(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
IFace<TPosition> |
IMesh<TPosition>.TryGetVertex(Int32)
Abstract class for a polyhedral mesh data structure.
Declaration
IVertex<TPosition> IMesh<TPosition>.TryGetVertex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
IVertex<TPosition> |