Class Mesh3D
- Namespace
- HelixToolkit.Wpf
- Assembly
- HelixToolkit.Wpf.dll
Represents a 3D mesh for polygon models containing faces with any number of vertices.
public class Mesh3D : ICloneable
- Inheritance
-
Mesh3D
- Implements
- Inherited Members
Constructors
Mesh3D()
Initializes a new instance of the Mesh3D class.
public Mesh3D()
Mesh3D(IEnumerable<Point3D>, IEnumerable<int>)
Initializes a new instance of the Mesh3D class.
public Mesh3D(IEnumerable<Point3D> positions, IEnumerable<int> triangleIndices)
Parameters
positionsIEnumerable<Point3D>The positions.
triangleIndicesIEnumerable<int>The triangle indices.
Mesh3D(IEnumerable<Point3D>, IEnumerable<Point>?, IEnumerable<int>)
Initializes a new instance of the Mesh3D class.
public Mesh3D(IEnumerable<Point3D> positions, IEnumerable<Point>? textureCoordinates, IEnumerable<int> triangleIndices)
Parameters
positionsIEnumerable<Point3D>The positions.
textureCoordinatesIEnumerable<Point>The texture Coordinates.
triangleIndicesIEnumerable<int>The triangle indices.
Properties
Edges
Gets the edges.
public IList<int[]> Edges { get; }
Property Value
Faces
Gets the faces.
public IList<int[]> Faces { get; }
Property Value
TextureCoordinates
Gets the texture coordinates.
public IList<Point>? TextureCoordinates { get; }
Property Value
Vertices
Gets the vertices.
public IList<Point3D> Vertices { get; }
Property Value
Methods
AddFace(params int[])
Adds a face.
public void AddFace(params int[] vertexIndices)
Parameters
vertexIndicesint[]The vertex indices of the face.
Clone()
Creates a new object that is a copy of the current instance.
public object Clone()
Returns
- object
A new object that is a copy of this instance.
FindCentroid(int)
Finds the centroid of the specified face.
public Point3D FindCentroid(int faceIndex)
Parameters
faceIndexintIndex of the face.
Returns
- Point3D
The centroid.
FindFaceFromEdge(int, int)
Finds the face from edge.
public int FindFaceFromEdge(int v0, int v1)
Parameters
Returns
- int
The face index.
GetBounds()
Gets the bounds.
public Rect3D GetBounds()
Returns
- Rect3D
The bounds.
GetFaceNormal(int)
Gets the face normal (averaged).
public Vector3D GetFaceNormal(int faceIndex)
Parameters
faceIndexintIndex of the face.
Returns
- Vector3D
The face normal.
GetNeighbourVertices(int)
Gets the neighbour vertices.
public int[] GetNeighbourVertices(int vertexIndex)
Parameters
vertexIndexintIndex of the vertex.
Returns
- int[]
The neighbour vertices.
IsQuadrilateralMesh()
Determines whether the mesh contains quadrilateral faces only.
public bool IsQuadrilateralMesh()
Returns
- bool
trueif the mesh is quadrilateral; otherwise,false.
IsTriangularMesh()
Determines whether the mesh contains triangular faces only.
public bool IsTriangularMesh()
Returns
- bool
trueif the mesh is triangular; otherwise,false.
Quadrangulate()
Converts the mesh to a mesh of quadrilaterals.
public void Quadrangulate()
ToMeshGeometry3D(bool, double, List<int>?)
Converts the mesh to a MeshGeometry3D.
public MeshGeometry3D ToMeshGeometry3D(bool sharedVertices = true, double shrinkFactor = 0, List<int>? faceIndices = null)
Parameters
sharedVerticesboolAllow shared vertices (smooth shading) if set to
true.shrinkFactordoubleThe shrink factor.
faceIndicesList<int>The face indices.
Returns
- MeshGeometry3D
A mesh geometry.
Triangulate(bool)
Triangulates the specified mesh.
public void Triangulate(bool barycentric)
Parameters
barycentricboolUse barycentric subdivision if set to
true.
UpdateEdges()
Updates the edges.
public void UpdateEdges()