Skip to main content

find_closest_block

Function find_closest_block 

Source
pub fn find_closest_block(
    blocks: &[Block],
    centroid: [Float; 3],
    direction: &str,
    minvalue: bool,
) -> Option<(usize, Float, Float, Float)>
Expand description

Find the block whose centroid is closest to an extrapolated target.

§Arguments

  • blocks - Candidate blocks.
  • centroid - Reference centroid for the entire assembly.
  • direction - Axis name controlling the search direction.
  • minvalue - When true, search toward the minimum extreme; otherwise the maximum.

§Returns

The selected block index and the target coordinates used for the comparison.