Skip to content

Commit

Permalink
Start curve approximation test suite
Browse files Browse the repository at this point in the history
It's just a single, simple test so far. I had planned to add more, but
it turns out that they aren't easy to write, due to bugs and
inconsistencies:
#1079 (comment)

This is going to be much easier to fix, once #1079 is addressed, so I'm
just going ahead with that instead.
  • Loading branch information
hannobraun committed Sep 16, 2022
1 parent 9217761 commit 14c0785
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions crates/fj-kernel/src/algorithms/approx/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,27 @@ pub struct GlobalCurveApprox {
/// The points that approximate the curve
pub points: Vec<ApproxPoint<1>>,
}

#[cfg(test)]
mod tests {

use crate::{
algorithms::approx::{path::RangeOnPath, Approx},
objects::{Curve, Surface},
path::GlobalPath,
};

use super::CurveApprox;

#[test]
fn approx_line_on_flat_surface() {
let surface = Surface::new(GlobalPath::x_axis(), [0., 0., 1.]);
let curve =
Curve::build(surface).line_from_points([[1., 1.], [2., 1.]]);
let range = RangeOnPath::from([[0.], [1.]]);

let approx = (&curve, range).approx(1.);

assert_eq!(approx, CurveApprox::empty())
}
}

0 comments on commit 14c0785

Please sign in to comment.