Class MeshGeometryHelper
- Namespace
- HelixToolkit.Geometry
- Assembly
- HelixToolkit.Geometry.dll
Provides helper methods for mesh geometries.
public static class MeshGeometryHelper
- Inheritance
-
MeshGeometryHelper
- Inherited Members
Methods
CalculateNormals(MeshGeometry3D)
Calculates the normal vectors.
public static IList<Vector3> CalculateNormals(this MeshGeometry3D mesh)
Parameters
meshMeshGeometry3DThe mesh.
Returns
CalculateNormals(IList<Vector3>, IList<int>)
Calculates the normal vectors.
public static IList<Vector3> CalculateNormals(IList<Vector3> positions, IList<int> triangleIndices)
Parameters
Returns
CombineSegments(IList<Vector3>, float)
Combines the segments.
public static IEnumerable<IList<Vector3>> CombineSegments(IList<Vector3> segments, float eps)
Parameters
Returns
- IEnumerable<IList<Vector3>>
Enumerated connected contour curves.
Cut(MeshGeometry3D, Plane)
Cuts the mesh with the specified plane.
public static MeshGeometry3D Cut(this MeshGeometry3D mesh, Plane plane)
Parameters
meshMeshGeometry3DThe mesh.
planePlaneThe plane
Returns
- MeshGeometry3D
The new cutted MeshGeometry3D by the plane.
Cut(MeshGeometry3D, Vector3, Vector3)
Cuts the mesh with the specified plane.
public static MeshGeometry3D Cut(this MeshGeometry3D mesh, Vector3 planeOrigin, Vector3 planeNormal)
Parameters
meshMeshGeometry3DThe mesh.
planeOriginVector3The plane origin.
planeNormalVector3The plane normal.
Returns
- MeshGeometry3D
The new cutted MeshGeometry3D by the plane.
FindBorderEdges(MeshGeometry3D)
Finds edges that are only connected to one triangle.
public static IList<int> FindBorderEdges(this MeshGeometry3D mesh)
Parameters
meshMeshGeometry3DA mesh geometry.
Returns
FindEdges(MeshGeometry3D)
Finds all edges in the mesh (each edge is only included once).
public static IList<int> FindEdges(this MeshGeometry3D mesh)
Parameters
meshMeshGeometry3DA mesh geometry.
Returns
FindSharpEdges(MeshGeometry3D, float)
Finds all edges where the angle between adjacent triangle normal vectors. is larger than minimumAngle
public static IList<int> FindSharpEdges(this MeshGeometry3D mesh, float minimumAngle)
Parameters
meshMeshGeometry3DA mesh geometry.
minimumAnglefloatThe minimum angle between the normal vectors of two adjacent triangles (degrees).
Returns
GetContourSegments(MeshGeometry3D, Plane)
Gets the contour segments.
public static IList<Vector3> GetContourSegments(this MeshGeometry3D mesh, Plane plane)
Parameters
meshMeshGeometry3DThe mesh.
planePlaneThe plane.
Returns
GetContourSegments(MeshGeometry3D, Vector3, Vector3)
Gets the contour segments.
public static IList<Vector3> GetContourSegments(this MeshGeometry3D mesh, Vector3 planeOrigin, Vector3 planeNormal)
Parameters
meshMeshGeometry3DThe mesh.
planeOriginVector3The plane origin.
planeNormalVector3The plane normal.
Returns
NoSharedVertices(MeshGeometry3D)
Creates a new mesh where no vertices are shared.
public static MeshGeometry3D NoSharedVertices(this MeshGeometry3D input)
Parameters
inputMeshGeometry3DThe input mesh.
Returns
- MeshGeometry3D
A new mesh.
NormalizeInPlace(Vector3Collection)
public static void NormalizeInPlace(Vector3Collection data)
Parameters
dataVector3Collection
RemoveIsolatedVertices(MeshGeometry3D)
Remove isolated(not connected to any triangles) vertices
public static MeshGeometry3D RemoveIsolatedVertices(this MeshGeometry3D mesh)
Parameters
meshMeshGeometry3D
Returns
RemoveIsolatedVertices(IList<Vector3>, IList<int>, IList<Vector2>?, IList<Vector3>?, out IList<Vector3>, out IList<int>, out IList<Vector2>?, out IList<Vector3>?)
Remove isolated(not connected to any triangles) vertices
public static void RemoveIsolatedVertices(IList<Vector3> vertices, IList<int> triangles, IList<Vector2>? texture, IList<Vector3>? normals, out IList<Vector3> verticesOut, out IList<int> trianglesOut, out IList<Vector2>? textureOut, out IList<Vector3>? normalOut)
Parameters
verticesIList<Vector3>trianglesIList<int>textureIList<Vector2>normalsIList<Vector3>verticesOutIList<Vector3>trianglesOutIList<int>textureOutIList<Vector2>normalOutIList<Vector3>
RemoveOutOfRangeTriangles(IList<int>, int)
public static void RemoveOutOfRangeTriangles(this IList<int> triangles, int numVerts)
Parameters
Simplify(MeshGeometry3D, float)
Simplifies the specified mesh.
public static MeshGeometry3D Simplify(this MeshGeometry3D mesh, float eps)
Parameters
meshMeshGeometry3DThe mesh.
epsfloatThe tolerance.
Returns
- MeshGeometry3D
A simplified mesh.
Validate(MeshGeometry3D)
Validates the specified mesh.
public static string? Validate(this MeshGeometry3D mesh)
Parameters
meshMeshGeometry3DThe mesh.
Returns
- string
Validation report or null if no issues were found.