mesh.Mesh.clip_with_plane#
- Mesh.clip_with_plane(p, n, nodes='any', side='+')#
Clip the Mesh with a plane.
Parameters#
- p: float array_like (3,)
A point in the clipping plane.
- n: float array_like (3,)
The normal vector to the clipping plane.
- nodes: int, list of ints or string
Specifies which points of the elements are taken into account in the tests. It should be one of the following:
a single node index (smaller than self.plexitude()),
a list of node indices (all smaller than self.plexitude()),
one of the special strings: ‘all’, ‘any’, ‘none’.
The default (‘any’) will flag the elements that have at least one of their nodes on the specified side of the plane.
- side: ‘+’ | ‘-’
Default (‘+’) is to return the elements at the positive side of the plane, as defined by the normal vector.
Returns#
- Mesh
This method returns the part of the Mesh at one side of the plane (p,n).
Examples#
>>> M = Mesh(eltype='line2').subdivide(4) >>> M_clipped = M.clip_with_plane([0.6,0.0,0.0], [1.0,0.0,0.0]) >>> print(M_clipped) Mesh: n_nodes: 3, n_elems: 2, plexitude: 2, level: 1, eltype: line2 BBox: [0.5 0. 0. ], [1. 0. 0.] Size: [0.5 0. 0. ] Length: 0.5 >>> M_clipped = M.clip_with_plane([0.4,0.0,0.0], [1.0,0.0,0.0], side="-", nodes="all") >>> print(M_clipped) Mesh: n_nodes: 2, n_elems: 1, plexitude: 2, level: 1, eltype: line2 BBox: [0. 0. 0.], [0.25 0. 0. ] Size: [0.25 0. 0. ] Length: 0.25