trim module

Package for dealing with trimming the AmpObject mesh Copyright: Joshua Steer 2020, Joshua.Steer@soton.ac.uk

class trimMixin

Bases: object

Methods for trimming the AmpObject mesh

dynamicTrim(s, maxdist=20)

This function trims vertices and faces from the AmpObject. It calculates the distance between the AmpObject mesh centroids and their nearest neighbour on the s mesh. If this distance is more than maxdist, the face is removed, and subsequently the vertices no longer connected to a face.

Parameters
  • s (AmpObject) – The target object

  • maxdist (float) – The threshold distance. Faces on the m mesh that have a higher distance with their nearest neighbour on the s mesh than maxdist will be removed, as will the vertices no longer connected to a face afterwards.

planarTrim(height, plane=2, above=True)

Trim the vertices using a flat plane, all vertices above plane will be trimmed

Parameters
  • height (float) – Trim height, values above this will be deleted

  • plane (int, default 2) – plane for slicing

Examples

>>> from ampscan import AmpObject
>>> amp = AmpObject(filename)
>>> amp.planarTrim(100, 2)
threePointTrim(p0, p1, p2, above=True)

Trim the vertices using a plane defined by three points. By default, all points above the plane are deleted.

Parameters
  • p0 (array_like) – The co-ordinates of the first point to define the plane

  • p1 (array_like) – The co-ordinates of the second point to define the plane

  • p2 (array_like) – The co-ordinates of the third point to define the plane

Examples

>>> from ampscan import AmpObject
>>> amp = AmpObject(filename)
>>> p0 = [50, 50, 0]
>>> p1 = [50, -50, -40]
>>> p2 = [-50, 50, 10]
>>> amp.threePointTrim(p0, p1, p2)