LoopStructural.datatypes.Surface#

class LoopStructural.datatypes.Surface(vertices: numpy.ndarray = <factory>, triangles: numpy.ndarray = <factory>, colour: Union[str, numpy.ndarray, NoneType] = <factory>, normals: Optional[numpy.ndarray] = None, name: str = 'surface', values: Optional[numpy.ndarray] = None, properties: Optional[dict] = None, cell_properties: Optional[dict] = None)#

Bases: object

__init__(vertices: ~numpy.ndarray = <factory>, triangles: ~numpy.ndarray = <factory>, colour: str | ~numpy.ndarray | None = <factory>, normals: ~numpy.ndarray | None = None, name: str = 'surface', values: ~numpy.ndarray | None = None, properties: dict | None = None, cell_properties: dict | None = None) None#

Methods

__init__([vertices, triangles, colour, ...])

from_dict(d[, flatten])

plot([pyvista_kwargs])

Calls pyvista plot on the vtk object

remove_nan_vertices()

Remove vertices with NaN values from the surface.

save(filename, *[, group, replace_spaces, ext])

to_dict([flatten])

vtk()

Attributes

cell_properties

name

normals

properties

triangle_area

_summary_

triangle_normal

_summary_

values

vertices

triangles

colour

plot(pyvista_kwargs={})#

Calls pyvista plot on the vtk object

Parameters:

pyvista_kwargs (dict, optional) – kwargs passed to pyvista.DataSet.plot(), by default {}

remove_nan_vertices()#

Remove vertices with NaN values from the surface. Also removes any triangles that reference these vertices. This modifies the vertices and triangles in place. Any associated properties are also updated.

property triangle_area#

_summary_

Returns:

_type_ – _description_

Notes

Area of triangle for a 3d triangle with vertices at points A, B, C is given by det([A-C, B-C])**.5

property triangle_normal: ndarray#

_summary_

Returns:

np.ndarray – numpy array of normals N,3 where N is the number of triangles

Notes

The normal of a triangle is given by the cross product of two vectors in the plane of the triangle