10.12. polygonMesh#
- class itom.polygonMesh(mesh=None, polygons=None)#
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 parameterpolygons
, are taken. In this case, the containing cloud is reduced and no longer organized (height = 1
,dense = False
).- Parameters:
- mesh
polygonMesh
,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 typeuint32
. This polygon mesh is then created from the givenmesh
with the polygons only, whose index is contained in thispolygons
sequence.
- mesh
- Raises:
RuntimeError
if
polygons
is given, butmesh
isNone
. 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:
- cloud
pointCloud
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 aboutM
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.
- cloud
- 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 givencloud
. This is done by this method.- Parameters:
- cloud
pointCloud
is the input point cloud (must be organized, see attribute
organized
).- triangulationType
int
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.
- cloud
- Returns:
polygonMesh
is the newly created
polygonMesh
from the given organized cloud.
- Raises:
RuntimeError
if
cloud
is not organized (seeorganized
).
- 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:
- topography
dataObject
the topography data object. The grid of the data object, defined by its size, the
axisScales
andaxisOffsets
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
).- triangulationType
int
,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.
- topography
- Returns:
polygonMesh
is the newly created
polygonMesh
from thetopography
object.
See also
- 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 orpoint.PointInvalid
, the type of the internalpointCloud
is guessed with respect to available types.- Parameters:
- newPointType
int
,optional
the point type value of the desired type, the point cloud should be converted too (default: point.PointInvalid)
- newPointType
- getPolygons() dataObject #
Returns a dataObject with the relevant information of the polygons in this mesh.
- Returns:
polygons
is a
M x N
int32dataObject
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.