Skip to content

Mesh

Triangulated surface or solid with per-vertex and per-face attributes.

bounds property

bounds

(min, max) corners of the bounding box, None when empty.

column_names property

column_names

Names of the vertex columns, then the face columns.

coords property

coords

(n, 3) vertices.

is_closed property

is_closed

Every edge shared by exactly two non-degenerate triangles.

length_unit property

length_unit

Unit of the coordinates, such as m or ft; None when not declared.

volume property

volume

Enclosed volume of a closed mesh, positive when wound outward.

x property

x

x of each row's coordinates.

y property

y

y of each row's coordinates.

z property

z

z of each row's coordinates.

contains method descriptor

contains(points)

Whether each point is inside, by generalized winding number.

distance method descriptor

distance(points, *, signed=False)

Distance to the surface; signed makes inside points negative.

fill_holes method descriptor

fill_holes()

Closes each hole with a fan of triangles from its first vertex.

Returns:

Type Description
Mesh

A new mesh with the fans appended, wound like the faces around each hole, with null face attributes. A hole is a loop of boundary edges; a loop through a vertex that starts two boundary edges stays open. A fan suits small, nearly planar, convex holes; others can come out folded, so validate the result.

proportion method descriptor

proportion(targets, *, size=None, discretization=Ellipsis)

Proportion of each block inside, from a grid of points per block where the surface may cut it: discretization per axis, or one count for all three. targets is a BlockModel, whose rotation and sub-block extents count, or axis-aligned centroids with a shared size.

repair method descriptor

repair(*, tolerance=0.0)

Weld close vertices, drop degenerate and duplicate triangles, and wind the triangles consistently.

Parameters:

Name Type Description Default
tolerance float

Vertices within this distance of an earlier vertex merge into it; 0 merges exact duplicates only.

0.0

Returns:

Type Description
Mesh

A new mesh without unused vertices, each connected piece wound one way. A closed piece inside an even number of other closed pieces winds outward; inside an odd number it is a cavity and winds inward, so the volume is outer minus cavities. Kept vertices and triangles keep their order and attributes. Repairing it again changes nothing. Crossing faces stay; validate reports them.

to_length_unit method descriptor

to_length_unit(unit, *, crs=None)

A copy with the coordinates converted to unit, the new length unit.

Parameters:

Name Type Description Default
unit str

A length unit, such as m or ft.

required
crs str

The CRS of the converted coordinates; required when the coordinates have a CRS, which a change of unit changes.

None

Raises:

Type Description
InvalidInput

Without a length unit to convert from, or with a CRS and no crs.

validate method descriptor

validate(*, tolerance=0.0)

Everything that keeps the mesh from being a clean closed solid.

Parameters:

Name Type Description Default
tolerance float

A vertex within this distance of an earlier vertex is a duplicate; 0 finds exact duplicates only.

0.0

Returns:

Type Description
MeshReport

Counts in summary and one row per problem in problems. Degenerate faces are left out of the edge, vertex and shell checks.

vertical_distance method descriptor

vertical_distance(points)

Signed vertical distance to a surface such as topography.

Parameters:

Name Type Description Default
points (array_like, PointSet or BlockModel)

(n, 3) points, or the centroids of a point set or block model. Rows with a NaN coordinate are allowed.

required

Returns:

Type Description
ndarray

Point elevation minus surface elevation at the same (x, y): positive above, negative below. NaN where a coordinate is NaN or no triangle covers the point in plan; where the surface overlaps itself, the highest counts.

with_face_column method descriptor

with_face_column(name, values)

New mesh with the per-triangle attribute name added or replaced.

with_vertex_column method descriptor

with_vertex_column(name, values)

New mesh with the per-vertex attribute name added or replaced.

used in