mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-05 10:28:27 +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)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct Plane {
|
pub struct Plane {
|
||||||
@ -11,4 +11,11 @@ impl Plane {
|
|||||||
let [u, v] = point.into().coords.components;
|
let [u, v] = point.into().coords.components;
|
||||||
self.origin + self.coords.a * u + self.coords.b * v
|
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.]),
|
b: Vector::from([0., 1., 0.]),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let top = Plane {
|
let top = bottom.translate([0., 0., 1.]);
|
||||||
origin: Point::from([0., 0., 0.5]),
|
|
||||||
coords: Bivector {
|
|
||||||
a: Vector::from([1., 0., 0.]),
|
|
||||||
b: Vector::from([0., 1., 0.]),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let (a, b, c, d, e, f, g, h) = shape
|
let (a, b, c, d, e, f, g, h) = shape
|
||||||
.extend_with(&mut vertices)
|
.extend_with(&mut vertices)
|
||||||
|
Loading…
Reference in New Issue
Block a user