small fixes
This commit is contained in:
parent
463b19cbfb
commit
6c215809fb
1 changed files with 3 additions and 6 deletions
|
|
@ -414,7 +414,7 @@ impl Xenobalanus {
|
||||||
|
|
||||||
impl Xenobalanus {
|
impl Xenobalanus {
|
||||||
|
|
||||||
pub fn delaunay_sub(&mut self, vertices: Vec<usize>) -> Vec<usize> {
|
pub fn delaunay_sub(&self, vertices: Vec<usize>) -> Vec<usize> {
|
||||||
let delaunator_points: Vec<DelaunatorPoint> = vertices.iter()
|
let delaunator_points: Vec<DelaunatorPoint> = vertices.iter()
|
||||||
.map(|vertex| DelaunatorPoint { x: self.point(*vertex).x as f64, y: self.point(*vertex).y as f64 })
|
.map(|vertex| DelaunatorPoint { x: self.point(*vertex).x as f64, y: self.point(*vertex).y as f64 })
|
||||||
.collect();
|
.collect();
|
||||||
|
|
@ -426,7 +426,7 @@ impl Xenobalanus {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculates the concave hull for a subset of vertices indicated by their indices, based on the alpha parameter.
|
/// Calculates the concave hull for a subset of vertices indicated by their indices, based on the alpha parameter.
|
||||||
pub fn concave_hull(&mut self, vertex_indices: Vec<usize>, alpha: f32) -> Result<Vec<Point>, &'static str> {
|
pub fn concave_hull(&self, vertex_indices: Vec<usize>, alpha: f32) -> Result<Vec<usize>, &'static str> {
|
||||||
// Perform Delaunay triangulation on the subset of vertices.
|
// Perform Delaunay triangulation on the subset of vertices.
|
||||||
let triangulation_indices = self.delaunay_sub(vertex_indices.clone());
|
let triangulation_indices = self.delaunay_sub(vertex_indices.clone());
|
||||||
|
|
||||||
|
|
@ -469,10 +469,7 @@ impl Xenobalanus {
|
||||||
// Order the hull edge indices to form a continuous path
|
// Order the hull edge indices to form a continuous path
|
||||||
let ordered_indices = self.order_hull_edges(hull_edge_indices)?;
|
let ordered_indices = self.order_hull_edges(hull_edge_indices)?;
|
||||||
|
|
||||||
// Convert ordered indices to points
|
Ok(ordered_indices)
|
||||||
let ordered_points = ordered_indices.iter().map(|&idx| self.point(idx)).collect();
|
|
||||||
|
|
||||||
Ok(ordered_points)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to order hull edges into a continuous path.
|
/// Attempts to order hull edges into a continuous path.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue