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],
|
pub vertices: [Vertex; 3],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<[Vertex; 3]> for Triangle {
|
impl From<[&Vertex; 3]> for Triangle {
|
||||||
fn from(vertices: [Vertex; 3]) -> Self {
|
fn from(vertices: [&Vertex; 3]) -> Self {
|
||||||
Self { vertices }
|
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());
|
[a, b, c, d, e, f, g, h].map(|vertex| vertex.get());
|
||||||
|
|
||||||
shape
|
shape
|
||||||
.triangle([a, e, g]) // left
|
.triangle([&a, &e, &g]) // left
|
||||||
.triangle([a, g, c])
|
.triangle([&a, &g, &c])
|
||||||
.triangle([b, d, h]) // right
|
.triangle([&b, &d, &h]) // right
|
||||||
.triangle([b, h, f])
|
.triangle([&b, &h, &f])
|
||||||
.triangle([a, b, f]) // front
|
.triangle([&a, &b, &f]) // front
|
||||||
.triangle([a, f, e])
|
.triangle([&a, &f, &e])
|
||||||
.triangle([c, h, d]) // back
|
.triangle([&c, &h, &d]) // back
|
||||||
.triangle([c, g, h])
|
.triangle([&c, &g, &h])
|
||||||
.triangle([a, c, b]) // bottom
|
.triangle([&a, &c, &b]) // bottom
|
||||||
.triangle([b, c, d])
|
.triangle([&b, &c, &d])
|
||||||
.triangle([e, f, h]) // top
|
.triangle([&e, &f, &h]) // top
|
||||||
.triangle([e, h, g]);
|
.triangle([&e, &h, &g]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user