Mesh

पैकेज: @aspose/3d (v24.12.0)

Mesh सब‑पाथ इम्पोर्ट के माध्यम से भी उपलब्ध है @aspose/3d/entities.

Mesh प्राथमिक बहुभुज ज्यामिति इकाई है में @aspose/3d. यह vertex positions को control points के रूप में संग्रहीत करता है, vertex index lists द्वारा polygon faces को परिभाषित करता है, और normals और UV coordinates जैसे कई vertex element data layers का समर्थन करता है।.

export class Mesh extends Geometry

ImageRenderOptions

A3DObject ← SceneObject ← Entity ← Geometry ← Mesh

ImageRenderOptions

एकल त्रिकोण मेष बनाएं, उसे दृश्य में संलग्न करें, और GLB में सहेजें।.

import { Scene, Vector4 } from '@aspose/3d';
import { Mesh } from '@aspose/3d/entities';

// Create the mesh and define three control points (vertices)
const mesh = new Mesh();
mesh.controlPoints.push(
  new Vector4(0, 1, 0, 1),   // apex
  new Vector4(-1, 0, 0, 1),  // bottom-left
  new Vector4(1, 0, 0, 1),   // bottom-right
);

// Define one triangular polygon using vertex indices
mesh.createPolygon(0, 1, 2);

// Attach the mesh to the scene and save (extension infers GLB format)
const scene = new Scene();
scene.rootNode.createChildNode('triangle', mesh);
scene.save('triangle.glb');
console.log(`Polygon count: ${mesh.polygonCount}`); // 1

ImageRenderOptions

NameTypeAccessDescription
edgesnumber[]ReadGets the edges.
polygonCountnumberReadGets the polygon count.
polygonsnumber[][]ReadGets the polygons.
deformersany[]ReadGets the deformers.
SignatureDescription
`constructor(name: stringnull, _heightMap: any, _transform: any, _triMesh: boolean
createPolygon()Adds a new polygon to the mesh
getPolygonSize(index: number)numberReturns the number of vertices in the polygon at the given index
toMesh()MeshReturns a Mesh instance representing the current object (identity conversion)
optimize(_vertexElements: boolean, _toleranceControlPoint: number, _toleranceNormal: number, _toleranceUV: number)MeshNot implemented in the FOSS edition — throws at runtime. Reduces mesh complexity using vertex element flag and tolerance values for control points, normals, and UVs
doBoolean(_op: any, _a: Mesh, _transformA: any, _b: Mesh, _transformB: any)MeshNot implemented in the FOSS edition — throws at runtime. Performs a boolean operation defined by _op on meshes _a and _b with respective transforms
isManifold()booleanNot implemented in the FOSS edition — throws at runtime. Returns true if manifold is set.
union(_a: Mesh, _b: Mesh)MeshNot implemented in the FOSS edition — throws at runtime. Returns a new Mesh that is the union of meshes _a and _b
difference(_a: Mesh, _b: Mesh)MeshNot implemented in the FOSS edition — throws at runtime. Returns a new Mesh that is the difference of mesh _a minus mesh _b
intersect(_a: Mesh, _b: Mesh)MeshNot implemented in the FOSS edition — throws at runtime.
triangulate()MeshConverts all polygons in the mesh to triangles and returns the mesh
getBoundingBox()anyReturns the bounding box.
getEntityRendererKey()anyNot implemented in the FOSS edition — throws at runtime. Returns the entity renderer key.

ImageRenderOptions

createPolygon(…indices)

प्रदान किए गए कंट्रोल पॉइंट इंडेक्स का उपयोग करके एक नया पॉलीगॉन फेस परिभाषित करता है। इंडेक्स को वैध स्थितियों को … में संदर्भित करना चाहिए। controlPoints.

createPolygon(...indices: number[]): void

ImageRenderOptions

...indices number[]

तीन या अधिक शून्य-आधारित इंडेक्स … में controlPoints ऐरे में, प्रतिक्लॉकवाइज़ विंडिंग क्रम में।.

ImageRenderOptions

void

ImageRenderOptions

import { Vector4 } from '@aspose/3d';
import { Mesh } from '@aspose/3d/entities';

const mesh = new Mesh();
mesh.controlPoints.push(
  new Vector4(0, 0, 0, 1),
  new Vector4(1, 0, 0, 1),
  new Vector4(1, 1, 0, 1),
  new Vector4(0, 1, 0, 1),
);
// Define a quad as two triangles, or a single quad polygon:
mesh.createPolygon(0, 1, 2, 3);
console.log(`Polygons: ${mesh.polygonCount}`); // 1

triangulate()

इस मेष में सभी गैर‑त्रिकोणीय बहुभुजों को त्रिकोणों में बदलता है। त्रिकोणीकृत मेष को लौटाता है (यह वही इंस्टेंस हो सकता है या नया)।.

triangulate(): Mesh

ImageRenderOptions

Mesh

त्रिकोणीकृत मेष।.

ImageRenderOptions

const mesh = new Mesh(); mesh.controlPoints.push( new Vector4(0, 0, 0, 1), new Vector4(1, 0, 0, 1), new Vector4(1, 1, 0, 1), new Vector4(0, 1, 0, 1), ); mesh.createPolygon(0, 1, 2, 3); // quad const triangulated = mesh.triangulate(); console.log(Polygons after triangulation: ${triangulated.polygonCount}); // 2


---

### toMesh()

मेष को एक ... के रूप में लौटाता है। `Mesh` इंस्टेंस। के लिए `Mesh` objects यह एक पहचान ऑपरेशन है; मेथड प्रिमिटिव जियोमेट्री टाइप्स पर अधिक सार्थक है जो इनहेरिट करते हैं `Geometry`.

```typescript
toMesh(): Mesh

ImageRenderOptions

Mesh

यह mesh उदाहरण।.


static union(a, b)

NOT IMPLEMENTED. यह मेथड API सतह में परिभाषित है लेकिन अपवाद फेंकता है Error('union is not implemented') रनटाइम पर। प्रोडक्शन कोड में इसे कॉल न करें।.

दो mesh का बूलियन यूनियन करता है। परिणाम दोनों इनपुट्स के संयुक्त आयतन को शामिल करता है।.

static union(a: Mesh, b: Mesh): Mesh

ImageRenderOptions

a Mesh

पहला मेष ऑपरेण्ड।.

b Mesh

दूसरा मेष ऑपरेण्ड।.

ImageRenderOptions

Mesh

एक नया मेष जो … का संघ दर्शाता है a और b.

ImageRenderOptions

import { Mesh } from '@aspose/3d/entities';

// Assumes meshA and meshB are already populated Mesh instances
const combined = Mesh.union(meshA, meshB);
console.log(`Union polygon count: ${combined.polygonCount}`);

static difference(a, b)

NOT IMPLEMENTED. यह मेथड API सतह में परिभाषित है लेकिन अपवाद फेंकता है Error('difference is not implemented') रनटाइम पर। प्रोडक्शन कोड में इसे कॉल न करें।.

बूलियन डिफरेंस करता है, मेष के आयतन को घटाते हुए b मेष से a.

static difference(a: Mesh, b: Mesh): Mesh

ImageRenderOptions

a Mesh

बेस mesh।.

b Mesh

वह मेष जिससे घटाया जाएगा a.

ImageRenderOptions

Mesh

एक नया मेष जो दर्शाता है a माइनस b.

ImageRenderOptions

const result = Mesh.difference(meshA, meshB); console.log(Difference polygon count: ${result.polygonCount});


---

### static intersect(a, b)

**NOT IMPLEMENTED.** यह मेथड API सतह में परिभाषित है लेकिन अपवाद फेंकता है `Error('intersect is not implemented')` रनटाइम पर। प्रोडक्शन कोड में इसे कॉल न करें।.

दो मेषों का बूलियन इंटरसेक्शन करता है। परिणाम में केवल ओवरलैपिंग वॉल्यूम शामिल होता है।.

```typescript
static intersect(a: Mesh, b: Mesh): Mesh

ImageRenderOptions

a Mesh

पहला मेष ऑपरेण्ड।.

b Mesh

दूसरा मेष ऑपरेण्ड।.

ImageRenderOptions

Mesh

एक नया मेष जो … के प्रतिच्छेदन को दर्शाता है a और b.

ImageRenderOptions

const overlap = Mesh.intersect(meshA, meshB); console.log(Intersection polygon count: ${overlap.polygonCount});


---

### createElement(type, mapping?, reference?)

एक नया बनाता है `VertexElement` इस मेष पर कस्टम प्रति-वर्टेक्स एट्रिब्यूट्स के लिए डेटा लेयर।.

```typescript
createElement(
  type: VertexElementType,
  mapping?: MappingMode,
  reference?: ReferenceMode
): VertexElement

ImageRenderOptions

type VertexElementType

बनाने के लिए वर्टेक्स एट्रिब्यूट का प्रकार (उदाहरण के लिए, VertexElementType.Normal).

mapping MappingMode (वैकल्पिक)

एलिमेंट डेटा को मेष टोपोलॉजी पर कैसे मैप किया जाता है। डिफ़ॉल्ट रूप से MappingMode.ControlPoint.

reference ReferenceMode (वैकल्पिक)

एलिमेंट इंडेक्स डेटा एरे को कैसे संदर्भित करते हैं। डिफ़ॉल्ट रूप से ReferenceMode.Direct.

ImageRenderOptions

VertexElement

नया बनाया गया वर्टेक्स एलेमेंट लेयर।.


createElementUV(mapping, mappingMode?, referenceMode?)

इस मेष पर एक UV कॉर्डिनेट लेयर बनाता है।.

createElementUV(
  mapping: TextureMapping,
  mappingMode?: MappingMode,
  referenceMode?: ReferenceMode
): VertexElementUV

ImageRenderOptions

mapping TextureMapping

बनाने के लिए UV चैनल (उदाहरण के लिए, TextureMapping.Diffuse).

mappingMode MappingMode (वैकल्पिक)

UV कॉर्डिनेट्स को वर्टिसेज़ पर कैसे मैप किया जाता है।.

referenceMode ReferenceMode (वैकल्पिक)

UV इंडेक्स डेटा UV एरे को कैसे संदर्भित करता है।.

ImageRenderOptions

VertexElementUV

नया बनाया गया UV तत्व लेयर।.

ImageRenderOptions

import { Mesh } from '@aspose/3d/entities';
import { TextureMapping } from '@aspose/3d';

const mesh = new Mesh();
// ... define control points and polygons ...
const uvLayer = mesh.createElementUV(TextureMapping.Diffuse);
console.log(`UV element created: ${uvLayer !== undefined}`);
 हिन्दी