-
-
Notifications
You must be signed in to change notification settings - Fork 119
/
lib.rs
30 lines (25 loc) · 848 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use fj::core::{
operations::{
split::SplitFace, sweep::SweepFaceOfShell, update::UpdateSolid,
},
topology::Solid,
};
pub fn model(size: f64, split_pos: f64, core: &mut fj::core::Core) -> Solid {
let cuboid = cuboid::model([size, size, size], core);
cuboid.update_shell(
cuboid.shells().only(),
|shell, core| {
let face = shell.faces().first();
let cycle = face.region().exterior();
let line = [
(cycle.half_edges().nth(0).unwrap(), [split_pos]),
(cycle.half_edges().nth(2).unwrap(), [split_pos]),
];
let (shell, [face, _]) = shell.split_face(face, line, core);
[shell
.sweep_face_of_shell(face, [0., 0., size / 2.], core)
.shell]
},
core,
)
}