Table of Contents

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

positions IEnumerable<Point3D>

The positions.

triangleIndices IEnumerable<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

positions IEnumerable<Point3D>

The positions.

textureCoordinates IEnumerable<Point>

The texture Coordinates.

triangleIndices IEnumerable<int>

The triangle indices.

Properties

Edges

Gets the edges.

public IList<int[]> Edges { get; }

Property Value

IList<int[]>

The edges.

Faces

Gets the faces.

public IList<int[]> Faces { get; }

Property Value

IList<int[]>

The faces.

TextureCoordinates

Gets the texture coordinates.

public IList<Point>? TextureCoordinates { get; }

Property Value

IList<Point>

The texture coordinates.

Vertices

Gets the vertices.

public IList<Point3D> Vertices { get; }

Property Value

IList<Point3D>

The vertices.

Methods

AddFace(params int[])

Adds a face.

public void AddFace(params int[] vertexIndices)

Parameters

vertexIndices int[]

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

faceIndex int

Index of the face.

Returns

Point3D

The centroid.

FindFaceFromEdge(int, int)

Finds the face from edge.

public int FindFaceFromEdge(int v0, int v1)

Parameters

v0 int

The v0.

v1 int

The v1.

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

faceIndex int

Index of the face.

Returns

Vector3D

The face normal.

GetNeighbourVertices(int)

Gets the neighbour vertices.

public int[] GetNeighbourVertices(int vertexIndex)

Parameters

vertexIndex int

Index of the vertex.

Returns

int[]

The neighbour vertices.

IsQuadrilateralMesh()

Determines whether the mesh contains quadrilateral faces only.

public bool IsQuadrilateralMesh()

Returns

bool

true if the mesh is quadrilateral; otherwise, false .

IsTriangularMesh()

Determines whether the mesh contains triangular faces only.

public bool IsTriangularMesh()

Returns

bool

true if 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

sharedVertices bool

Allow shared vertices (smooth shading) if set to true .

shrinkFactor double

The shrink factor.

faceIndices List<int>

The face indices.

Returns

MeshGeometry3D

A mesh geometry.

Triangulate(bool)

Triangulates the specified mesh.

public void Triangulate(bool barycentric)

Parameters

barycentric bool

Use barycentric subdivision if set to true .

UpdateEdges()

Updates the edges.

public void UpdateEdges()