示例#1
0
 def normal(self, surface_point: tuple) -> tuple:
     on_surf, surf_indexes = on_aabb_surface(self._size, surface_point,  atol=2*EPS_ZERO)
     if not on_surf:
         raise GeometryError(
             "Point is not on surface.",
             {"point": surface_point, "geometry": self}
         )
     if len(surf_indexes) != 1:
         raise GeometryError(
             "Point is on multiple surfaces.",
             {"point": surface_point, "geometry": self}
         )
     idx = surf_indexes[0]
     # normal vector in the local frame
     return NORMALS[idx]
示例#2
0
 def is_on_surface(self, point):
     on_surf, _ = on_aabb_surface(self._size, point, atol=2 * EPS_ZERO)
     return on_surf