Skip to content

Commit f1fe21c

Browse files
committed
Revert lib changes
This partially reverts commit 240195f.
1 parent 240195f commit f1fe21c

23 files changed

+713
-996
lines changed

src/bsp.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This module contains the implementation of the [BSP](https://en.wikipedia.org/wiki/Binary_space_partitioning) tree data structure
22
33
use crate::float_types::EPSILON;
4-
use crate::plane::{BACK, COPLANAR, FRONT, Plane, SPANNING};
4+
use crate::plane::{Plane, BACK, FRONT, COPLANAR, SPANNING};
55
use crate::polygon::Polygon;
66
use crate::vertex::Vertex;
77
use std::fmt::Debug;
@@ -15,13 +15,13 @@ pub struct Node<S: Clone> {
1515
/// Splitting plane for this node *or* **None** for a leaf that
1616
/// only stores polygons.
1717
pub plane: Option<Plane>,
18-
18+
1919
/// Polygons in *front* half‑spaces.
2020
pub front: Option<Box<Node<S>>>,
21-
21+
2222
/// Polygons in *back* half‑spaces.
2323
pub back: Option<Box<Node<S>>>,
24-
24+
2525
/// Polygons that lie *exactly* on `plane`
2626
/// (after the node has been built).
2727
pub polygons: Vec<Polygon<S>>,
@@ -55,10 +55,10 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
5555
match (&mut self.front, &mut self.back) {
5656
(Some(front_node), Some(back_node)) => {
5757
join(|| front_node.invert(), || back_node.invert());
58-
},
58+
}
5959
(Some(front_node), None) => front_node.invert(),
6060
(None, Some(back_node)) => back_node.invert(),
61-
(None, None) => {},
61+
(None, None) => {}
6262
}
6363

6464
#[cfg(not(feature = "parallel"))]
@@ -219,10 +219,10 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
219219
match (&mut self.front, &mut self.back) {
220220
(Some(front_node), Some(back_node)) => {
221221
join(|| front_node.clip_to(bsp), || back_node.clip_to(bsp));
222-
},
222+
}
223223
(Some(front_node), None) => front_node.clip_to(bsp),
224224
(None, Some(back_node)) => back_node.clip_to(bsp),
225-
(None, None) => {},
225+
(None, None) => {}
226226
}
227227
}
228228

@@ -329,20 +329,20 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
329329
let front_node = self.front.as_mut().unwrap();
330330
let back_node = self.back.as_mut().unwrap();
331331
join(|| front_node.build(&front), || back_node.build(&back));
332-
},
332+
}
333333
(true, false) => {
334334
if self.front.is_none() {
335335
self.front = Some(Box::new(Node::new(&[])));
336336
}
337337
self.front.as_mut().unwrap().build(&front);
338-
},
338+
}
339339
(false, true) => {
340340
if self.back.is_none() {
341341
self.back = Some(Box::new(Node::new(&[])));
342342
}
343343
self.back.as_mut().unwrap().build(&back);
344-
},
345-
(false, false) => {},
344+
}
345+
(false, false) => {}
346346
}
347347
}
348348

@@ -377,11 +377,11 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
377377
// Depending on normal alignment, it may be “coplanar_front” or “coplanar_back.”
378378
// Usually we don’t care — we just return them as “in the plane.”
379379
coplanar_polygons.push(poly.clone());
380-
},
380+
}
381381

382382
FRONT | BACK => {
383383
// Entirely on one side => no intersection. We skip it.
384-
},
384+
}
385385

386386
SPANNING => {
387387
// The polygon crosses the plane. We'll gather the intersection points
@@ -422,11 +422,11 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
422422
}
423423
// If crossing_points.len() was not a multiple of 2, you can handle leftover
424424
// points or flag them as errors, etc. We'll skip that detail here.
425-
},
425+
}
426426

427427
_ => {
428428
// Shouldn't happen in a typical classification, but we can ignore
429-
},
429+
}
430430
}
431431
}
432432

@@ -463,11 +463,11 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
463463
COPLANAR => {
464464
// Entire polygon in plane
465465
(vec![poly.clone()], Vec::new())
466-
},
466+
}
467467
FRONT | BACK => {
468468
// Entirely on one side => no intersection
469469
(Vec::new(), Vec::new())
470-
},
470+
}
471471
SPANNING => {
472472
// The polygon crosses the plane => gather intersection edges
473473
let mut crossing_points = Vec::new();
@@ -499,7 +499,7 @@ impl<S: Clone + Send + Sync + Debug> Node<S> {
499499
edges.push([chunk[0].clone(), chunk[1].clone()]);
500500
}
501501
(Vec::new(), edges)
502-
},
502+
}
503503
_ => (Vec::new(), Vec::new()),
504504
}
505505
})

src/convex_hull.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ impl<S: Clone + Debug + Send + Sync> CSG<S> {
2424
let points: Vec<Vec<Real>> = self
2525
.polygons
2626
.iter()
27-
.flat_map(|poly| poly.vertices.iter().map(|v| vec![v.pos.x, v.pos.y, v.pos.z]))
27+
.flat_map(|poly| {
28+
poly.vertices
29+
.iter()
30+
.map(|v| vec![v.pos.x, v.pos.y, v.pos.z])
31+
})
2832
.collect();
2933

3034
// Attempt to compute the convex hull using the robust wrapper
@@ -33,7 +37,7 @@ impl<S: Clone + Debug + Send + Sync> CSG<S> {
3337
Err(_) => {
3438
// Fallback to an empty CSG if hull generation fails
3539
return CSG::new();
36-
},
40+
}
3741
};
3842

3943
let (verts, indices) = hull.vertices_indices();

0 commit comments

Comments
 (0)