Fix SurfaceVertex duplication in test code

This commit is contained in:
Hanno Braun 2022-10-13 17:08:09 +02:00
parent 76d4ccc882
commit f1fabce5da

View File

@ -181,8 +181,9 @@ mod tests {
use crate::{ use crate::{
algorithms::{reverse::Reverse, sweep::Sweep}, algorithms::{reverse::Reverse, sweep::Sweep},
objects::{Cycle, Face, HalfEdge, Objects}, objects::{Cycle, Face, HalfEdge, Objects, SurfaceVertex, Vertex},
partial::HasPartial, partial::HasPartial,
storage::Handle,
}; };
#[test] #[test]
@ -205,16 +206,40 @@ mod tests {
.build(&objects); .build(&objects);
let side_up = HalfEdge::partial() let side_up = HalfEdge::partial()
.with_surface(Some(surface.clone())) .with_surface(Some(surface.clone()))
.as_line_segment_from_points([[1., 0.], [1., 1.]]) .with_back_vertex(Some(Vertex::partial().with_surface_form(
Some(bottom.front().surface_form().clone()),
)))
.with_front_vertex(Some(
Vertex::partial().with_surface_form(Some(
Handle::<SurfaceVertex>::partial()
.with_position(Some([1., 1.])),
)),
))
.as_line_segment()
.build(&objects); .build(&objects);
let top = HalfEdge::partial() let top = HalfEdge::partial()
.with_surface(Some(surface.clone())) .with_surface(Some(surface.clone()))
.as_line_segment_from_points([[0., 1.], [1., 1.]]) .with_back_vertex(Some(
Vertex::partial().with_surface_form(Some(
Handle::<SurfaceVertex>::partial()
.with_position(Some([0., 1.])),
)),
))
.with_front_vertex(Some(Vertex::partial().with_surface_form(
Some(side_up.front().surface_form().clone()),
)))
.as_line_segment()
.build(&objects) .build(&objects)
.reverse(); .reverse();
let side_down = HalfEdge::partial() let side_down = HalfEdge::partial()
.with_surface(Some(surface.clone())) .with_surface(Some(surface.clone()))
.as_line_segment_from_points([[0., 0.], [0., 1.]]) .with_back_vertex(Some(Vertex::partial().with_surface_form(
Some(bottom.back().surface_form().clone()),
)))
.with_front_vertex(Some(Vertex::partial().with_surface_form(
Some(top.front().surface_form().clone()),
)))
.as_line_segment()
.build(&objects) .build(&objects)
.reverse(); .reverse();