Click or drag to resize
AB4D logo

MeshUtilsPolygonIndicesProperty Field

PolygonIndicesProperty is a DependencyProperty that can be set to the MeshGeometry3D object and specifies an Int32Collection with Position indexes that define polygons for the MeshGeometry3D.

Namespace: Ab3d.Utilities
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.2.9104.2045
Syntax
C#
public static readonly DependencyProperty PolygonIndicesProperty

Field Value

DependencyProperty
Remarks

PolygonIndicesProperty is a DependencyProperty that can be set to the MeshGeometry3D object and specifies an Int32Collection with Position indexes that define polygons for the MeshGeometry3D.

MeshGeometry3D defines the 3D object's mesh that is created from triangles. But when the 3D object is defined in some modeling application, the model can be created from quads or polygons.

In such case it is possible to use the PolygonIndicesProperty DependencyProperty to add list of position indexes that define the quads or polygons that were originally used to create the 3D object.

Each polygon is defined with defining indexes of Positions that are used to define the polygon. The polygon is then closed with repeating the first index in the polygon. This draws the last polygon segment to the beginning of the first segment. After that the indexes for the next polygon begins. Polygon can be also completed with specifying -1 as index. This will end the polygon without closing it.

Example of defining a polygon:

The following indexes define a polygon that represents a quad:
0 1 2 3 0
This defines a polygon that goes from positions with indexes 0 to 1, then 2, 3 and finally comes back to the position at index 0. This closes the polygon.

The example represents a quad and a triangle:
0 1 2 3 0 4 5 6 4
The first quad is defined by triangle indexes from 0 to 3 - it is closed by the first triangle index. Then the next polygon is started - it is defined by tree triangle indices - 4, 5 and 6 and then closed by connecting the 6th position to the 4th (the first in this polygon).

The following indexes define one polyline with 4 segments (0,1,2,3) and one line (with 2 segments from index 4 to 5). Note -1 that is used to complete one polygon without closing it:
0 1 2 3 -1 4 5 -1

Support of PolygonIndicesProperty:
- The following extension method are added to MeshGeometry3D class: GetPolygonIndices(MeshGeometry3D), SetPolygonIndices(MeshGeometry3D, Int32Collection) and GetPolygonPositions(MeshGeometry3D, Transform3D),
- Ab3d.Utilities.MeshUtils helper class define 3 overloads of GetPolygonPositions method that help to work with PolygonIndicesProperty,
- AssimpWpfImporter support reading the polygon information and storing it into PolygonIndicesProperty for each MeshGeometry3D (when ReadPolygonIndices property is set to true),
- WireframeVisual3D support showing wireframe 3D lines based on the polygon lines stored in PolygonIndicesProperty (when ShowPolygonLines property is set to true).

See Also