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 : GeometryInheritance
A3DObject → SceneObject → Entity → Geometry → Mesh
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
| Name | Type | Access | Description |
|---|---|---|---|
ControlPoints | List<Vector4> | get | Vertex positions in homogeneous coordinates |
PolygonCount | int | get | Number of polygon faces |
Name | string | get/set | Name of the mesh entity |
Methods
| Method | Return Type | Description |
|---|---|---|
CreatePolygon(params int[] indices) | void | Creates a polygon face from control-point indices |