Mesh — Aspose.3D FOSS for .NET
Namensraum: Aspose.ThreeD.Entities (Aspose.3D.Converter 1.0.0)
Mesh speichert Polygongeometrie als eine Liste von Kontrollpunkten (vertex positions) und eine Liste von Polygonflächen. Jede Polygonfläche ist eine Liste von nullbasierten Indizes in das Kontrollpunkte‑Array. Zusätzliche per-vertex Daten – normals, UV coordinates, vertex colours – wird angehängt als VertexElement Schichten.
public class Mesh : GeometryMethods
A3DObject → SceneObject → Entity → Geometry → Mesh
Methods
Erstelle ein einzelnes Dreiecks‑Mesh von Grund auf:
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");Aus einem Primitive erstellen und inspizieren:
var sphere = new Sphere(1);
var mesh = sphere.ToMesh();
Console.WriteLine("Vertices: " + mesh.ControlPoints.Count);
Console.WriteLine("Polygons: " + mesh.PolygonCount);Methods
| Methods | Methods | Methods | Methods |
|---|---|---|---|
ControlPoints | List<Vector4> | bekommen | Vertex-Positionen in homogenen Koordinaten |
PolygonCount | int | get | Anzahl der Polygonflächen |
Name | string | get/set | Name der Mesh-Entität |
Methods
| Methods | Rückgabetyp | Methods |
|---|---|---|
CreatePolygon(params int[] indices) | void | Erstellt eine Polygonfläche aus Kontrollpunkt‑Indizes |