From 1294e8d4805ad78d2bc29389d783d1e1015f77d2 Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Wed, 16 Oct 2024 00:17:12 -0700 Subject: [PATCH] CLEANUP: `find_geometric_center` is now just `centroid` --- src/brush_ni_node.rs | 2 +- src/main.rs | 3 +-- src/mesh.rs | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/brush_ni_node.rs b/src/brush_ni_node.rs index b9c8977..2995b83 100644 --- a/src/brush_ni_node.rs +++ b/src/brush_ni_node.rs @@ -184,7 +184,7 @@ impl BrushNiNode { fn collect(&mut self) { if self.vis_verts.len() > 0 { - self.distance_from_origin = Mesh::find_geometric_center(&self.vis_verts) + self.distance_from_origin = Mesh::centroid(&self.vis_verts) } Self::to_nif_format(&mut self.vis_data, &self.vis_verts, &self.vis_tris); diff --git a/src/main.rs b/src/main.rs index a0878de..05c2732 100644 --- a/src/main.rs +++ b/src/main.rs @@ -230,8 +230,7 @@ fn main() { None => {} } - let mesh_distance: SV3 = - Mesh::find_geometric_center(&mesh.node_distances) * (*scale_mode as f32); + let mesh_distance: SV3 = Mesh::centroid(&mesh.node_distances) * (*scale_mode as f32); mesh.final_distance = mesh_distance; mesh.mangle = match get_prop("mangle", &prop_map) { mangle if mangle.is_empty() => *get_rotation(&"0 0 0".to_string()), diff --git a/src/mesh.rs b/src/mesh.rs index 4bf20fa..05f146c 100644 --- a/src/mesh.rs +++ b/src/mesh.rs @@ -58,7 +58,7 @@ impl Mesh { } pub fn align_to_center(&mut self) { - let center = Mesh::find_geometric_center(&self.node_distances); + let center = Mesh::centroid(&self.node_distances); let rotation = Rotation3::new(Vector3::new( -self.mangle[0], -self.mangle[1], @@ -92,7 +92,7 @@ impl Mesh { let _ = self.stream.save_path(name); } - pub fn find_geometric_center(vertices: &Vec) -> SV3 { + pub fn centroid(vertices: &Vec) -> SV3 { // Calculate the sum of all dimensions using fold vertices .iter()