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 (
meshparameter 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
ofintor array_like,optional If given,
polygonsmust 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 givenmeshwith the polygons only, whose index is contained in thispolygonssequence.
- mesh
- Raises:
RuntimeErrorif
polygonsis given, butmeshisNone. 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 Nint32 array-like array with the indices of the polygons. The array contains information aboutMpolygons. 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:
polygonMeshis the newly created
polygonMeshfrom the point cloud and the polygons.
- static fromOrganizedCloud(cloud, triangulationType=1) polygonMesh#
Creates a polygon mesh from an organized cloud.
Since the input
cloudis 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:
polygonMeshis the newly created
polygonMeshfrom the given organized cloud.
- Raises:
RuntimeErrorif
cloudis not organized (seeorganized).
- static fromTopography(topography, triangulationType=1) polygonMesh#
Creates a polygon mesh from a
topographydataObject 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
axisScalesandaxisOffsetsvalues 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:
polygonMeshis the newly created
polygonMeshfrom thetopographyobject.
See also
- getCloud(newPointType=point.PointInvalid) pointCloud#
Returns the point cloud of this polygon mesh converted to the desired type
newPointType.If the
newPointTypeis not given orpoint.PointInvalid, the type of the internalpointCloudis 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:
polygonsis a
M x Nint32dataObjectwith the description of the polygons.Mis the number of polygons,Nthe biggest number of vertices. Hence, each polygon is passed in one row of this object. The point indices (vertices), that describe this polygon.