Class ZSlicer


  • public class ZSlicer
    extends Object
    Slice a mesh by a Z plane. Only works for meshes that are two-manifold (otherwise contours are not closed).

    Round vertices positions and plane position to even and odd multiples of a small fraction of the mesh size, so that they don't intersect. Build contours by iterating from an intersecting edge to the adjacent one, with a determined orientation (CCW for interior contours). The contours returned "know" whether they limit the interior or exterior of the mesh.

    Inspired from https://github.com/rminetto/slicing/blob/main/code-python/slicer.py#L377

    Author:
    Jean-Yves Tinevez
    • Constructor Detail

      • ZSlicer

        public ZSlicer()
    • Method Detail

      • slices

        public static List<Slice> slices​(Mesh mesh,
                                         double[] zs,
                                         double zScale)
      • slice

        public static Slice slice​(Mesh mesh,
                                  double z,
                                  double zScale)
        Slice a mesh by a Z-plane.
        Parameters:
        mesh - the mesh to slice. Not modified.
        z - The Z position of the XY plane to slice through.
        zScale - some scale in Z (such as the pixel size in Z), used to shift the vertices and Z-plane position by a small fraction of this size.
        Returns:
        the section of the mesh at the specified Z position, returned as a collection of Contour objects.