mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-22 07:05:53 +00:00
Accept Vec<Face>
as source in sweep
This commit is contained in:
parent
e75e2e636a
commit
4ad8e50fc8
@ -12,7 +12,7 @@ use super::{CycleApprox, Tolerance};
|
|||||||
|
|
||||||
/// Create a solid by sweeping a sketch
|
/// Create a solid by sweeping a sketch
|
||||||
pub fn sweep(
|
pub fn sweep(
|
||||||
source: Shape,
|
source: Vec<Face>,
|
||||||
path: impl Into<Vector<3>>,
|
path: impl Into<Vector<3>>,
|
||||||
tolerance: Tolerance,
|
tolerance: Tolerance,
|
||||||
color: [u8; 4],
|
color: [u8; 4],
|
||||||
@ -455,11 +455,13 @@ mod tests {
|
|||||||
|
|
||||||
let mut shape = Shape::new();
|
let mut shape = Shape::new();
|
||||||
|
|
||||||
let _sketch = Face::builder(Surface::xy_plane(), &mut shape)
|
let sketch = Face::builder(Surface::xy_plane(), &mut shape)
|
||||||
.with_exterior_polygon([[0., 0.], [1., 0.], [0., 1.]])
|
.with_exterior_polygon([[0., 0.], [1., 0.], [0., 1.]])
|
||||||
.build();
|
.build()
|
||||||
|
.get();
|
||||||
|
|
||||||
let solid = super::sweep(shape, direction, tolerance, [255, 0, 0, 255]);
|
let solid =
|
||||||
|
super::sweep(vec![sketch], direction, tolerance, [255, 0, 0, 255]);
|
||||||
|
|
||||||
let expected_vertices: Vec<_> = expected_vertices
|
let expected_vertices: Vec<_> = expected_vertices
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use fj_interop::debug::DebugInfo;
|
use fj_interop::debug::DebugInfo;
|
||||||
use fj_kernel::{
|
use fj_kernel::{
|
||||||
algorithms::{sweep, Tolerance},
|
algorithms::{sweep, Tolerance},
|
||||||
|
iter::ObjectIters,
|
||||||
shape::Shape,
|
shape::Shape,
|
||||||
validation::{validate, Validated, ValidationConfig, ValidationError},
|
validation::{validate, Validated, ValidationConfig, ValidationError},
|
||||||
};
|
};
|
||||||
@ -19,7 +20,8 @@ impl ToShape for fj::Sweep {
|
|||||||
let path = Vector::from(self.path());
|
let path = Vector::from(self.path());
|
||||||
let color = self.shape().color();
|
let color = self.shape().color();
|
||||||
|
|
||||||
let swept = sweep(shape.into_inner(), path, tolerance, color);
|
let shape = shape.face_iter().collect::<Vec<_>>();
|
||||||
|
let swept = sweep(shape, path, tolerance, color);
|
||||||
let swept = validate(swept, config)?;
|
let swept = validate(swept, config)?;
|
||||||
|
|
||||||
Ok(swept)
|
Ok(swept)
|
||||||
|
Loading…
Reference in New Issue
Block a user