Mesh — Aspose.3D FOSS for .NET

Namespace: Aspose.ThreeD.Entities (Aspose.3D.Converter 1.0.0)

Mesh stores polygon geometry as a list of control points (vertex positions) and a list of polygon faces. Each polygon face is a list of zero-based indices into the control points array. Additional per-vertex data – normals, UV coordinates, vertex colours – is attached as VertexElement layers.

public class Mesh : Geometry

Inheritance

A3DObjectSceneObjectEntityGeometryMesh


Examples

Build a single triangle mesh from scratch:

using Aspose.ThreeD;
using Aspose.ThreeD.Entities;

// Create the mesh and add three vertex positions
var mesh = new Mesh();
mesh.ControlPoints.Add(new Vector4(0.0, 0.0, 0.0, 1.0));   // vertex 0
mesh.ControlPoints.Add(new Vector4(1.0, 0.0, 0.0, 1.0));   // vertex 1
mesh.ControlPoints.Add(new Vector4(0.5, 1.0, 0.0, 1.0));   // vertex 2

// Define one triangle face using vertex indices
mesh.CreatePolygon(0, 1, 2);

// Attach to a scene and save
var scene = new Scene();
scene.RootNode.CreateChildNode("triangle", mesh);
scene.Save("triangle.stl");

Build from a primitive and inspect:

var sphere = new Sphere(1);
var mesh = sphere.ToMesh();

Console.WriteLine("Vertices: " + mesh.ControlPoints.Count);
Console.WriteLine("Polygons: " + mesh.PolygonCount);

Properties

NameTypeAccessDescription
ControlPointsList<Vector4>getVertex positions in homogeneous coordinates
PolygonCountintgetNumber of polygon faces
Namestringget/setName of the mesh entity

Methods

MethodReturn TypeDescription
CreatePolygon(params int[] indices)voidCreates a polygon face from control-point indices

See Also