Skip to content

Commit

Permalink
CLEANUP: find_geometric_center is now just centroid
Browse files Browse the repository at this point in the history
  • Loading branch information
magicaldave committed Oct 16, 2024
1 parent 43fc462 commit 1294e8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/brush_ni_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
4 changes: 2 additions & 2 deletions src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -92,7 +92,7 @@ impl Mesh {
let _ = self.stream.save_path(name);
}

pub fn find_geometric_center(vertices: &Vec<SV3>) -> SV3 {
pub fn centroid(vertices: &Vec<SV3>) -> SV3 {
// Calculate the sum of all dimensions using fold
vertices
.iter()
Expand Down

0 comments on commit 1294e8d

Please sign in to comment.