pub fn closest_segments3(
first_start: Vec3,
first_end: Vec3,
second_start: Vec3,
second_end: Vec3,
) -> Result<ClosestPoints<3>, SegmentError>Expand description
Finds closest points on two finite ordered 3D segments, including skew and point segments. No normalization or minimum-length threshold is required.
use ferravex_math::vec3;
use ferravex_math::segments::closest_segments3;
let hit = closest_segments3(
vec3(-1., 0., 0.), vec3(1., 0., 0.),
vec3(0., -1., 3.), vec3(0., 1., 3.),
)?;
assert_eq!(hit.first, [0., 0., 0.]);
assert_eq!(hit.second, [0., 0., 3.]);
assert_eq!(hit.distance, 3.);