mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-05 02:18:28 +00:00
Add Plane::translate
This commit is contained in:
parent
50d5703399
commit
9985efaf40
@ -1,4 +1,4 @@
|
||||
use super::{Bivector, Point};
|
||||
use super::{Bivector, Point, Vector};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct Plane {
|
||||
@ -11,4 +11,11 @@ impl Plane {
|
||||
let [u, v] = point.into().coords.components;
|
||||
self.origin + self.coords.a * u + self.coords.b * v
|
||||
}
|
||||
|
||||
pub fn translate(self, offset: impl Into<Vector<3>>) -> Self {
|
||||
Self {
|
||||
origin: self.origin + offset,
|
||||
coords: self.coords,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,7 @@ pub fn model(shape: &mut Shape) {
|
||||
b: Vector::from([0., 1., 0.]),
|
||||
},
|
||||
};
|
||||
let top = Plane {
|
||||
origin: Point::from([0., 0., 0.5]),
|
||||
coords: Bivector {
|
||||
a: Vector::from([1., 0., 0.]),
|
||||
b: Vector::from([0., 1., 0.]),
|
||||
},
|
||||
};
|
||||
let top = bottom.translate([0., 0., 1.]);
|
||||
|
||||
let (a, b, c, d, e, f, g, h) = shape
|
||||
.extend_with(&mut vertices)
|
||||
|
Loading…
Reference in New Issue
Block a user