Update coordination system of bottom surface

Previously, it had the same coordinate system as the top one, meaning an
automated triangulization of both would come up with faces that have the
same normal. But obviously, the normals need to be inverse.

This change updates the bottom surface, preparing for the automated
triangulatization.
This commit is contained in:
Hanno Braun 2025-01-10 18:51:37 +01:00
parent dc904e3bc1
commit b1f718a705
2 changed files with 18 additions and 11 deletions

View File

@ -40,6 +40,7 @@ impl Plane {
Point::from([u, v])
}
#[allow(unused)] // fell out of use, but will need again soon
pub fn translate(self, offset: impl Into<Vector<3>>) -> Self {
Self {
origin: self.origin + offset,

View File

@ -12,12 +12,18 @@ pub fn model(shape: &mut Shape) {
let bottom = surfaces.insert(Plane {
origin: Point::from([0., 0., -0.5]),
coords: Bivector {
a: Vector::from([1., 0., 0.]),
b: Vector::from([0., -1., 0.]),
},
});
let top = surfaces.insert(Plane {
origin: Point::from([0., 0., 0.5]),
coords: Bivector {
a: Vector::from([1., 0., 0.]),
b: Vector::from([0., 1., 0.]),
},
});
let top = surfaces.insert(bottom.translate([0., 0., 1.]));
let sketch =
Sketch::from([[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]]);
@ -39,16 +45,16 @@ pub fn model(shape: &mut Shape) {
shape
.extend_with(&mut triangles)
.add([a, e, h]) // left
.add([a, h, d])
.add([b, c, g]) // right
.add([b, g, f])
.add([a, b, f]) // front
.add([a, f, e])
.add([d, g, c]) // back
.add([d, h, g])
.add([a, d, b]) // bottom
.add([b, d, c])
.add([d, e, h]) // left
.add([d, h, a])
.add([c, b, g]) // right
.add([c, g, f])
.add([d, c, f]) // front
.add([d, f, e])
.add([a, g, b]) // back
.add([a, h, g])
.add([d, a, c]) // bottom
.add([c, a, b])
.add([e, f, g]) // top
.add([e, g, h]);
}