mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-10 12:58:28 +00:00
Add ConnectExt
This commit is contained in:
parent
ef73336cd2
commit
9efd5211c7
13
experiments/2024-12-09/src/topology/connect.rs
Normal file
13
experiments/2024-12-09/src/topology/connect.rs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
use crate::geometry::Handle;
|
||||||
|
|
||||||
|
use super::{face::Face, solid::Solid};
|
||||||
|
|
||||||
|
pub trait ConnectExt {
|
||||||
|
fn connect(self, other: Handle<Face>) -> Solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ConnectExt for Handle<Face> {
|
||||||
|
fn connect(self, other: Handle<Face>) -> Solid {
|
||||||
|
Solid::connect_faces([self, other])
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
pub mod connect;
|
||||||
pub mod face;
|
pub mod face;
|
||||||
pub mod solid;
|
pub mod solid;
|
||||||
pub mod sweep;
|
pub mod sweep;
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
math::Vector,
|
math::Vector,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{face::Face, solid::Solid};
|
use super::{connect::ConnectExt, face::Face, solid::Solid};
|
||||||
|
|
||||||
pub trait SweepExt {
|
pub trait SweepExt {
|
||||||
/// Sweep a face along a path, creating a solid
|
/// Sweep a face along a path, creating a solid
|
||||||
@ -27,7 +27,7 @@ impl SweepExt for Handle<Face> {
|
|||||||
let bottom = self;
|
let bottom = self;
|
||||||
let top = Handle::new(bottom.flip().translate(path));
|
let top = Handle::new(bottom.flip().translate(path));
|
||||||
|
|
||||||
let solid = Solid::connect_faces([top, bottom]);
|
let solid = top.connect(bottom);
|
||||||
|
|
||||||
Sweep { output: solid }
|
Sweep { output: solid }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user