mirror of
https://github.com/hannobraun/Fornjot
synced 2025-08-10 11:16:10 +00:00
Define side walls as faces
This commit is contained in:
parent
d7cf92c597
commit
9eecc85c94
@ -1,7 +1,7 @@
|
|||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::{Shape, Sketch, Triangle},
|
geometry::{Shape, Sketch},
|
||||||
math::{Bivector, Plane, Point, Vector},
|
math::{Bivector, Plane, Point, Vector},
|
||||||
storage::Stores,
|
storage::Stores,
|
||||||
topology::Face,
|
topology::Face,
|
||||||
@ -35,17 +35,20 @@ pub fn model(shape: &mut Shape) {
|
|||||||
let [a, b, c, d] = bottom.vertices().collect_array().unwrap();
|
let [a, b, c, d] = bottom.vertices().collect_array().unwrap();
|
||||||
let [e, f, g, h] = top.vertices().collect_array().unwrap();
|
let [e, f, g, h] = top.vertices().collect_array().unwrap();
|
||||||
|
|
||||||
let [a, b, c, d, e, f, g, h] =
|
let [left, right, front, back] =
|
||||||
[a, b, c, d, e, f, g, h].map(|vertex| vertex.point);
|
[[a, e, h, d], [b, c, g, f], [a, b, f, e], [c, d, h, g]].map(
|
||||||
|
|[q, r, s, t]| {
|
||||||
|
let surface = stores.get().insert(Plane::from_points(
|
||||||
|
[q, r, s].map(|vertex| vertex.point),
|
||||||
|
));
|
||||||
|
Face::new(surface, [q, r, s, t].map(|vertex| vertex.clone()))
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
shape
|
shape
|
||||||
.extend_with(stores.get::<Triangle>())
|
.extend_with(stores.get::<Face>())
|
||||||
.add([a, e, h]) // left
|
.add(left)
|
||||||
.add([a, h, d])
|
.add(right)
|
||||||
.add([b, c, g]) // right
|
.add(front)
|
||||||
.add([b, g, f])
|
.add(back);
|
||||||
.add([a, b, f]) // front
|
|
||||||
.add([a, f, e])
|
|
||||||
.add([d, g, c]) // back
|
|
||||||
.add([d, h, g]);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user