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::{
|
use crate::{
|
||||||
algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint},
|
algorithms::approx::{path::RangeOnPath, Approx, ApproxPoint},
|
||||||
builder::{CurveBuilder, SurfaceBuilder},
|
builder::{CurveBuilder, HalfEdgeBuilder, SurfaceBuilder},
|
||||||
geometry::path::GlobalPath,
|
geometry::path::GlobalPath,
|
||||||
insert::Insert,
|
insert::Insert,
|
||||||
objects::GlobalCurve,
|
objects::GlobalCurve,
|
||||||
partial::{PartialCurve, PartialObject, PartialSurface},
|
partial::{
|
||||||
|
PartialCurve, PartialHalfEdge, PartialObject, PartialSurface,
|
||||||
|
},
|
||||||
services::Services,
|
services::Services,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,17 +97,20 @@ mod tests {
|
|||||||
let mut services = Services::new();
|
let mut services = Services::new();
|
||||||
|
|
||||||
let surface = services.objects.surfaces.xz_plane();
|
let surface = services.objects.surfaces.xz_plane();
|
||||||
let mut curve = PartialCurve::default();
|
let half_edge = {
|
||||||
curve.update_as_line_from_points([[1., 1.], [2., 1.]]);
|
let mut half_edge = PartialHalfEdge::default();
|
||||||
let curve = curve
|
|
||||||
.build(&mut services.objects)
|
|
||||||
.insert(&mut services.objects);
|
|
||||||
let global_curve = GlobalCurve.insert(&mut services.objects);
|
|
||||||
let range = RangeOnPath::from([[0.], [1.]]);
|
|
||||||
|
|
||||||
let approx = (&curve, surface.deref(), global_curve, range).approx(1.);
|
half_edge.update_as_line_segment_from_points([[1., 1.], [2., 1.]]);
|
||||||
|
half_edge.infer_vertex_positions_if_necessary(&surface.geometry());
|
||||||
|
|
||||||
assert_eq!(approx, CurveApprox::empty());
|
half_edge
|
||||||
|
.build(&mut services.objects)
|
||||||
|
.insert(&mut services.objects)
|
||||||
|
};
|
||||||
|
|
||||||
|
let approx = (&half_edge, surface.deref()).approx(1.);
|
||||||
|
|
||||||
|
assert_eq!(approx.curve_approx, CurveApprox::empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -118,17 +123,20 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.build(&mut services.objects)
|
.build(&mut services.objects)
|
||||||
.insert(&mut services.objects);
|
.insert(&mut services.objects);
|
||||||
let mut curve = PartialCurve::default();
|
let half_edge = {
|
||||||
curve.update_as_line_from_points([[1., 1.], [1., 2.]]);
|
let mut half_edge = PartialHalfEdge::default();
|
||||||
let curve = curve
|
|
||||||
.build(&mut services.objects)
|
|
||||||
.insert(&mut services.objects);
|
|
||||||
let global_curve = GlobalCurve.insert(&mut services.objects);
|
|
||||||
let range = RangeOnPath::from([[0.], [1.]]);
|
|
||||||
|
|
||||||
let approx = (&curve, surface.deref(), global_curve, range).approx(1.);
|
half_edge.update_as_line_segment_from_points([[1., 1.], [2., 1.]]);
|
||||||
|
half_edge.infer_vertex_positions_if_necessary(&surface.geometry());
|
||||||
|
|
||||||
assert_eq!(approx, CurveApprox::empty());
|
half_edge
|
||||||
|
.build(&mut services.objects)
|
||||||
|
.insert(&mut services.objects)
|
||||||
|
};
|
||||||
|
|
||||||
|
let approx = (&half_edge, surface.deref()).approx(1.);
|
||||||
|
|
||||||
|
assert_eq!(approx.curve_approx, CurveApprox::empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user