Skip to main content

collect_intersection_segments

Function collect_intersection_segments 

Source
pub fn collect_intersection_segments(
    mesh: &Mesh,
    z: f64,
) -> Vec<(Point2D, Point2D)>
Expand description

Collect all intersection segments from a mesh at a given Z height

This function slices a mesh at a specified Z plane and returns all line segments where triangles intersect the plane.

§Arguments

  • mesh - The mesh to slice
  • z - The Z height of the slicing plane

§Returns

A vector of 2D line segments representing the intersection

§Example

use lib3mf::{Mesh, Vertex, Triangle, mesh_ops::collect_intersection_segments};

let mut mesh = Mesh::new();
// ... add vertices and triangles ...

let segments = collect_intersection_segments(&mesh, 5.0);
println!("Found {} intersection segments", segments.len());