From 86b0415791d1a26664356f80295b359bf8f86d34 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 15 Jan 2025 20:44:55 +0100 Subject: [PATCH] Update name of trait method --- experiments/2024-12-09/src/export.rs | 2 +- experiments/2024-12-09/src/geometry/operation.rs | 6 +++--- experiments/2024-12-09/src/geometry/shape.rs | 10 +++++----- experiments/2024-12-09/src/geometry/triangle.rs | 2 +- experiments/2024-12-09/src/render/geometry.rs | 2 +- experiments/2024-12-09/src/topology/face.rs | 2 +- experiments/2024-12-09/src/topology/vertex.rs | 2 +- experiments/2024-12-09/src/view.rs | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/experiments/2024-12-09/src/export.rs b/experiments/2024-12-09/src/export.rs index 3147e4278..798dadc55 100644 --- a/experiments/2024-12-09/src/export.rs +++ b/experiments/2024-12-09/src/export.rs @@ -3,7 +3,7 @@ use std::{collections::BTreeMap, fs::File}; use crate::geometry::{Operation, Shape}; pub fn export(shape: &Shape) -> anyhow::Result<()> { - let tri_mesh = shape.triangles(); + let tri_mesh = shape.tri_mesh(); let mut indices_by_vertex = BTreeMap::new(); diff --git a/experiments/2024-12-09/src/geometry/operation.rs b/experiments/2024-12-09/src/geometry/operation.rs index 6ec6d1b7a..b89f8734e 100644 --- a/experiments/2024-12-09/src/geometry/operation.rs +++ b/experiments/2024-12-09/src/geometry/operation.rs @@ -3,7 +3,7 @@ use std::{fmt, ops::Deref, rc::Rc}; use super::tri_mesh::TriMesh; pub trait Operation: fmt::Display { - fn triangles(&self) -> TriMesh; + fn tri_mesh(&self) -> TriMesh; fn children(&self) -> Vec; } @@ -68,8 +68,8 @@ impl fmt::Display for AnyOp { } impl Operation for AnyOp { - fn triangles(&self) -> TriMesh { - self.inner.triangles() + fn tri_mesh(&self) -> TriMesh { + self.inner.tri_mesh() } fn children(&self) -> Vec { diff --git a/experiments/2024-12-09/src/geometry/shape.rs b/experiments/2024-12-09/src/geometry/shape.rs index 5cac5b8b2..3ce7c44d0 100644 --- a/experiments/2024-12-09/src/geometry/shape.rs +++ b/experiments/2024-12-09/src/geometry/shape.rs @@ -31,9 +31,9 @@ impl fmt::Display for Shape { } impl Operation for Shape { - fn triangles(&self) -> TriMesh { + fn tri_mesh(&self) -> TriMesh { if let Some(op) = self.sequence.last() { - op.triangles() + op.tri_mesh() } else { TriMesh::new() } @@ -54,14 +54,14 @@ struct OperationInSequence { } impl Operation for OperationInSequence { - fn triangles(&self) -> TriMesh { + fn tri_mesh(&self) -> TriMesh { let mesh = if let Some(op) = &self.previous { - op.triangles() + op.tri_mesh() } else { TriMesh::new() }; - mesh.merge(self.operation.triangles()) + mesh.merge(self.operation.tri_mesh()) } fn children(&self) -> Vec { diff --git a/experiments/2024-12-09/src/geometry/triangle.rs b/experiments/2024-12-09/src/geometry/triangle.rs index 73a92091e..a8265461a 100644 --- a/experiments/2024-12-09/src/geometry/triangle.rs +++ b/experiments/2024-12-09/src/geometry/triangle.rs @@ -27,7 +27,7 @@ impl fmt::Display for Triangle { } impl Operation for Triangle { - fn triangles(&self) -> TriMesh { + fn tri_mesh(&self) -> TriMesh { TriMesh { triangles: vec![self.clone()], } diff --git a/experiments/2024-12-09/src/render/geometry.rs b/experiments/2024-12-09/src/render/geometry.rs index 892d8076a..cfb2e5b44 100644 --- a/experiments/2024-12-09/src/render/geometry.rs +++ b/experiments/2024-12-09/src/render/geometry.rs @@ -13,7 +13,7 @@ pub struct Geometry { impl Geometry { pub fn new(device: &wgpu::Device, operation: &dyn Operation) -> Self { - let tri_mesh = operation.triangles(); + let tri_mesh = operation.tri_mesh(); let mut indices = Vec::new(); let mut vertices = Vec::new(); diff --git a/experiments/2024-12-09/src/topology/face.rs b/experiments/2024-12-09/src/topology/face.rs index c04cd55b6..008564ec8 100644 --- a/experiments/2024-12-09/src/topology/face.rs +++ b/experiments/2024-12-09/src/topology/face.rs @@ -43,7 +43,7 @@ impl fmt::Display for Face { } impl Operation for Face { - fn triangles(&self) -> TriMesh { + fn tri_mesh(&self) -> TriMesh { // This is a placeholder implementation that only supports convex faces. let mut triangulation = diff --git a/experiments/2024-12-09/src/topology/vertex.rs b/experiments/2024-12-09/src/topology/vertex.rs index c39d0785e..2721b3ea6 100644 --- a/experiments/2024-12-09/src/topology/vertex.rs +++ b/experiments/2024-12-09/src/topology/vertex.rs @@ -29,7 +29,7 @@ impl fmt::Display for Vertex { } impl Operation for Vertex { - fn triangles(&self) -> TriMesh { + fn tri_mesh(&self) -> TriMesh { TriMesh::new() } diff --git a/experiments/2024-12-09/src/view.rs b/experiments/2024-12-09/src/view.rs index ce74342be..0a49a7a2c 100644 --- a/experiments/2024-12-09/src/view.rs +++ b/experiments/2024-12-09/src/view.rs @@ -128,8 +128,8 @@ impl fmt::Display for OperationView { } impl Operation for OperationView { - fn triangles(&self) -> TriMesh { - self.operation.triangles() + fn tri_mesh(&self) -> TriMesh { + self.operation.tri_mesh() } fn children(&self) -> Vec {