mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-01 12:55:54 +00:00
Prepare to refer to Vertex
by Handle
This commit is contained in:
parent
f66603375b
commit
4780753fb6
@ -44,9 +44,11 @@ pub struct Triangle {
|
||||
pub vertices: [Vertex; 3],
|
||||
}
|
||||
|
||||
impl From<[Vertex; 3]> for Triangle {
|
||||
fn from(vertices: [Vertex; 3]) -> Self {
|
||||
Self { vertices }
|
||||
impl From<[&Vertex; 3]> for Triangle {
|
||||
fn from(vertices: [&Vertex; 3]) -> Self {
|
||||
Self {
|
||||
vertices: vertices.map(|vertex| *vertex),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,16 +16,16 @@ pub fn model(shape: &mut Shape) {
|
||||
[a, b, c, d, e, f, g, h].map(|vertex| vertex.get());
|
||||
|
||||
shape
|
||||
.triangle([a, e, g]) // left
|
||||
.triangle([a, g, c])
|
||||
.triangle([b, d, h]) // right
|
||||
.triangle([b, h, f])
|
||||
.triangle([a, b, f]) // front
|
||||
.triangle([a, f, e])
|
||||
.triangle([c, h, d]) // back
|
||||
.triangle([c, g, h])
|
||||
.triangle([a, c, b]) // bottom
|
||||
.triangle([b, c, d])
|
||||
.triangle([e, f, h]) // top
|
||||
.triangle([e, h, g]);
|
||||
.triangle([&a, &e, &g]) // left
|
||||
.triangle([&a, &g, &c])
|
||||
.triangle([&b, &d, &h]) // right
|
||||
.triangle([&b, &h, &f])
|
||||
.triangle([&a, &b, &f]) // front
|
||||
.triangle([&a, &f, &e])
|
||||
.triangle([&c, &h, &d]) // back
|
||||
.triangle([&c, &g, &h])
|
||||
.triangle([&a, &c, &b]) // bottom
|
||||
.triangle([&b, &c, &d])
|
||||
.triangle([&e, &f, &h]) // top
|
||||
.triangle([&e, &h, &g]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user