pub fn orient3d_in(
scratch: &mut Scratch<'_>,
a: &impl Point,
b: &impl Point,
c: &impl Point,
d: &impl Point,
) -> Result<Option<Sign>, ScratchExhausted>Expand description
orient3d with the arena scratch for the exact coordinates of
implicit points, instead of the arena of the thread: the same result,
or an error if scratch runs out of room. Available without std.
scratch is left as it was, on success and on error. It is not used
when the filter decides, nor when every point is explicit. With implicit
points the exact stages may need several thousand f64; an arena made
with Scratch::growable (with the alloc feature of
implicit-predicates-core) never runs out.
§Errors
ScratchExhausted if scratch runs out of room; a larger arena then
gives the result.
§Examples
use implicit_predicates::{Lnc, Scratch, Sign, orient3d_in};
let (a, b, c) = ([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]);
let m = Lnc::new(a, b, 0.1)?;
let mut buf = vec![0.0; 4096];
let mut scratch = Scratch::borrowed(&mut buf);
assert_eq!(orient3d_in(&mut scratch, &a, &b, &c, &m), Ok(Some(Sign::Zero)));
assert_eq!(scratch.used(), 0);
// An arena too small is reported.
let mut small = [0.0; 8];
assert!(orient3d_in(&mut Scratch::borrowed(&mut small), &a, &b, &c, &m).is_err());