Meshable extrusions - Part 2 (#13676)
# Objective - Implement `Extrudable` for all meshbuilders of shapes that have been added after #13478 was created ## Solution - Implemented meshing for extrusions of `CircularSector`, `CircularSegment` and `Rhombus` ## Testing - The correctness of these was confirmed visually. ## Additional information Here is an image of what they look like :)  Co-authored-by: Lynn Büttgenbach <62256001+solis-lumine-vorago@users.noreply.github.com>
This commit is contained in:
parent
1fdddf8992
commit
8e4e840a19
@ -213,6 +213,25 @@ impl MeshBuilder for CircularSectorMeshBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Extrudable for CircularSectorMeshBuilder {
|
||||||
|
fn perimeter(&self) -> Vec<PerimeterSegment> {
|
||||||
|
let resolution = self.resolution as u32;
|
||||||
|
let (sin, cos) = self.sector.arc.half_angle.sin_cos();
|
||||||
|
let first_normal = Vec2::new(sin, cos);
|
||||||
|
let last_normal = Vec2::new(-sin, cos);
|
||||||
|
vec![
|
||||||
|
PerimeterSegment::Flat {
|
||||||
|
indices: vec![resolution, 0, 1],
|
||||||
|
},
|
||||||
|
PerimeterSegment::Smooth {
|
||||||
|
first_normal,
|
||||||
|
last_normal,
|
||||||
|
indices: (1..=resolution).collect(),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Meshable for CircularSector {
|
impl Meshable for CircularSector {
|
||||||
type Output = CircularSectorMeshBuilder;
|
type Output = CircularSectorMeshBuilder;
|
||||||
|
|
||||||
@ -340,6 +359,25 @@ impl MeshBuilder for CircularSegmentMeshBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Extrudable for CircularSegmentMeshBuilder {
|
||||||
|
fn perimeter(&self) -> Vec<PerimeterSegment> {
|
||||||
|
let resolution = self.resolution as u32;
|
||||||
|
let (sin, cos) = self.segment.arc.half_angle.sin_cos();
|
||||||
|
let first_normal = Vec2::new(sin, cos);
|
||||||
|
let last_normal = Vec2::new(-sin, cos);
|
||||||
|
vec![
|
||||||
|
PerimeterSegment::Flat {
|
||||||
|
indices: vec![resolution, 0, 1],
|
||||||
|
},
|
||||||
|
PerimeterSegment::Smooth {
|
||||||
|
first_normal,
|
||||||
|
last_normal,
|
||||||
|
indices: (1..=resolution).collect(),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Meshable for CircularSegment {
|
impl Meshable for CircularSegment {
|
||||||
type Output = CircularSegmentMeshBuilder;
|
type Output = CircularSegmentMeshBuilder;
|
||||||
|
|
||||||
@ -662,6 +700,14 @@ impl MeshBuilder for RhombusMeshBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Extrudable for RhombusMeshBuilder {
|
||||||
|
fn perimeter(&self) -> Vec<PerimeterSegment> {
|
||||||
|
vec![PerimeterSegment::Flat {
|
||||||
|
indices: vec![0, 2, 1, 3, 0],
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Meshable for Rhombus {
|
impl Meshable for Rhombus {
|
||||||
type Output = RhombusMeshBuilder;
|
type Output = RhombusMeshBuilder;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user