9.12. polygonMesh

class itom.polygonMesh(mesh=None, polygons=None)polygonMesh

Constructor for a polygon mesh.

This constructor either creates an empty polygon mesh, a shallow copy of another polygon mesh (mesh parameter only) or a deep copy of another polygon mesh where only the polygons, given by the list of indices in the parameter polygons, are taken. In this case, the containing cloud is reduced and no longer organized (height = 1, dense = False).

Parameters
meshpolygonMesh, optional

another polygon mesh instance (shallow or deep copy depending on argument polygons).

polygonssequence of int or array_like, optional

If given, polygons must be any object, that can be converted to an one-dimensional array-like structure with a data type uint32. This polygon mesh is then created from the given mesh with the polygons only, whose index is contained in this polygons sequence.

Raises
RuntimeError

if polygons is given, but mesh is None. This is not possible.

data()

Prints out data of this mesh to the command line.

static fromCloudAndPolygons(cloud, polygons)polygonMesh

Creates a polygon mesh from a given cloud and polygons.

Parameters
cloudpointCloud

is the input point cloud.

polygonsarray_like or dataObject

is an M x N int32 array-like array with the indices of the polygons. The array contains information about M polygons. Every row gives the indices of the vertices of the cloud belonging to this polygon (usually in counter-clockwise order, if one looks on the polygon from outside.

Returns
polygonMesh

is the newly created polygonMesh from the point cloud and the polygons.

static fromOrganizedCloud(cloud, triangulationType=1)polygonMesh

Creates a polygon mesh from an organized cloud.

Since the input cloud is organized, the neighbouring points in space are known in all directions. This allows automatically defining the vertices for polygons, such that a closed polygon mesh can be created, that is the hull of this given cloud. This is done by this method.

Parameters
cloudpointCloud

is the input point cloud (must be organized, see attribute organized).

triangulationTypeint

is the type of the mesh triangulation: 0: each polygon consists of quads (four corner points), 1: each polygon is described by a triangle and three corner points.

Returns
polygonMesh

is the newly created polygonMesh from the given organized cloud.

Raises
RuntimeError

if cloud is not organized (see organized).

static fromTopography(topography, triangulationType=1)polygonMesh

Creates a polygon mesh from a topography dataObject whose values are the z-components.

The polygons are created either as rectangles (quads) or triangles. However, some mesh processing methods only support meshes with triangles.

This method is the same than calling polygonMesh.fromOrganizedCloud(pointCloud.fromTopography(topography)).

Parameters
topographydataObject

the topography data object. The grid of the data object, defined by its size, the axisScales and axisOffsets values indicate the x- and y-coordinates of each point, while the z-coordinate is given by the corresponding value of this object. This polygon mesh is then created based on these points by adding polygons between either 3 neighbouring points (triangulationType = 1), or four points (triangulationType = 0).

triangulationTypeint, optional

is the type of the mesh triangulation: 0: each polygon consists of quads (four corner points), 1: each polygon is described by a triangle and three corner points.

Returns
polygonMesh

is the newly created polygonMesh from the topography object.

getCloud(newPointType=point.PointInvalid)pointCloud

Returns the point cloud of this polygon mesh converted to the desired type newPointType.

If the newPointType is not given or point.PointInvalid, the type of the internal pointCloud is guessed with respect to available types.

Parameters
newPointTypeint, optional

the point type value of the desired type, the point cloud should be converted too (default: point.PointInvalid)

getPolygons()dataObject

Returns a dataObject with the relevant information of the polygons in this mesh.

Returns
polygons

is a M x N int32 dataObject with the description of the polygons. M is the number of polygons, N the biggest number of vertices. Hence, each polygon is passed in one row of this object. The point indices (vertices), that describe this polygon.

name()str

Returns the name of this object.

Returns
str

the name of this object: PolygonMesh.

nrOfPolygons

int : Gets the number of polygons in this mesh.