Skip to main content

split

Function split 

Source
pub fn split(
    topo: &mut Topology,
    solid: SolidId,
    plane_point: Point3,
    plane_normal: Vec3,
) -> Result<SplitResult, OperationsError>
Expand description

Split a solid into two halves along a plane.

The cutting plane is defined by a point and a normal. The positive half contains geometry on the side the normal points toward; the negative half contains the rest.

§Algorithm

For each face of the solid:

  1. Classify vertices as above (+), below (-), or on the plane
  2. Faces entirely on one side go to that half
  3. Faces straddling the plane are clipped into two fragments
  4. A cap face (the cross-section) is added to close each half

§Errors

Returns an error if the plane doesn’t intersect the solid, any face is NURBS, or the result cannot be assembled.