mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-23 07:35:50 +00:00
Rewrite tests to approximate HalfEdge
This commit is contained in:
parent
f1fbfa15cd
commit
3e9fe65f0c
@ -80,11 +80,13 @@ mod tests {
|
||||
|
||||
use crate::{
|
||||
algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint},
|
||||
builder::{CurveBuilder, SurfaceBuilder},
|
||||
builder::{CurveBuilder, HalfEdgeBuilder, SurfaceBuilder},
|
||||
geometry::path::GlobalPath,
|
||||
insert::Insert,
|
||||
objects::GlobalCurve,
|
||||
partial::{PartialCurve, PartialObject, PartialSurface},
|
||||
partial::{
|
||||
PartialCurve, PartialHalfEdge, PartialObject, PartialSurface,
|
||||
},
|
||||
services::Services,
|
||||
};
|
||||
|
||||
@ -95,17 +97,20 @@ mod tests {
|
||||
let mut services = Services::new();
|
||||
|
||||
let surface = services.objects.surfaces.xz_plane();
|
||||
let mut curve = PartialCurve::default();
|
||||
curve.update_as_line_from_points([[1., 1.], [2., 1.]]);
|
||||
let curve = curve
|
||||
let half_edge = {
|
||||
let mut half_edge = PartialHalfEdge::default();
|
||||
|
||||
half_edge.update_as_line_segment_from_points([[1., 1.], [2., 1.]]);
|
||||
half_edge.infer_vertex_positions_if_necessary(&surface.geometry());
|
||||
|
||||
half_edge
|
||||
.build(&mut services.objects)
|
||||
.insert(&mut services.objects);
|
||||
let global_curve = GlobalCurve.insert(&mut services.objects);
|
||||
let range = RangeOnPath::from([[0.], [1.]]);
|
||||
.insert(&mut services.objects)
|
||||
};
|
||||
|
||||
let approx = (&curve, surface.deref(), global_curve, range).approx(1.);
|
||||
let approx = (&half_edge, surface.deref()).approx(1.);
|
||||
|
||||
assert_eq!(approx, CurveApprox::empty());
|
||||
assert_eq!(approx.curve_approx, CurveApprox::empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -118,17 +123,20 @@ mod tests {
|
||||
)
|
||||
.build(&mut services.objects)
|
||||
.insert(&mut services.objects);
|
||||
let mut curve = PartialCurve::default();
|
||||
curve.update_as_line_from_points([[1., 1.], [1., 2.]]);
|
||||
let curve = curve
|
||||
let half_edge = {
|
||||
let mut half_edge = PartialHalfEdge::default();
|
||||
|
||||
half_edge.update_as_line_segment_from_points([[1., 1.], [2., 1.]]);
|
||||
half_edge.infer_vertex_positions_if_necessary(&surface.geometry());
|
||||
|
||||
half_edge
|
||||
.build(&mut services.objects)
|
||||
.insert(&mut services.objects);
|
||||
let global_curve = GlobalCurve.insert(&mut services.objects);
|
||||
let range = RangeOnPath::from([[0.], [1.]]);
|
||||
.insert(&mut services.objects)
|
||||
};
|
||||
|
||||
let approx = (&curve, surface.deref(), global_curve, range).approx(1.);
|
||||
let approx = (&half_edge, surface.deref()).approx(1.);
|
||||
|
||||
assert_eq!(approx, CurveApprox::empty());
|
||||
assert_eq!(approx.curve_approx, CurveApprox::empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user