Function find_mesh_intersections_with_plane

Source
pub fn find_mesh_intersections_with_plane(
    nodes: &[[f64; 3]],
    cells: &[[usize; 3]],
    origin: [f64; 3],
    normal: [f64; 3],
) -> Option<Vec<[f64; 3]>>
Expand description

Finds the intersection points of a mesh with a slicing plane.

§Arguments

  • nodes: Nodes of the mesh.
  • cells: Cells of the mesh.
  • origin: A 3D point [x, y, z] representing a point through which the slice plane passes.
  • normal: A 3D vector [x, y, z] representing the normal to the slice plane.

§Returns

Returns a Vec<[f64; 3]> containing the intersection points of the mesh with the slice plane. Each intersection point is represented as a 3D point [x, y, z].

§Example

let nodes = vec![
    [0.0, 0.0, 0.0],
    [1.0, 0.0, 0.0],
    [0.0, 1.0, 0.0],
    [0.0, 0.0, 1.0],
];
let cells = vec![[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]];
let mesh = Mesh { nodes, cells };

let origin = [0.5, 0.5, 0.5];
let normal = [0.0, 0.0, 1.0];

let result = find_intersections_with_slice_plane(mesh, origin, normal);