Skip to main content

slice_hex

Function slice_hex 

Source
pub fn slice_hex(
    vertices: [Vec3; 8],
    plane_origin: Vec3,
    plane_normal: Vec3,
) -> CellSliceResult
Expand description

Slice a hexahedron by decomposing into 5 tetrahedra.

Hexahedra are sliced by treating them as 5 tetrahedra (using the standard symmetric decomposition), then merging the resulting polygons.

§Arguments

  • vertices - The 8 vertices of the hexahedron in standard ordering
  • plane_origin - A point on the plane
  • plane_normal - The plane normal (points toward kept geometry)

§Returns

A CellSliceResult containing 0, 3-6 vertices depending on the intersection.