Skip to content

Commit

Permalink
Merge pull request #720 from hannobraun/approx
Browse files Browse the repository at this point in the history
Make minor cleanups in approximation code
  • Loading branch information
hannobraun authored Jun 23, 2022
2 parents cfa05e1 + f65cc47 commit 8574252
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/fj-kernel/src/algorithms/approx/cycles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use fj_math::Segment;

use crate::{geometry, objects::Cycle};

use super::{curves::approx_curve, edges::approximate_edge, Tolerance};
use super::{curves::approx_curve, edges::approx_edge, Tolerance};

/// An approximation of a [`Cycle`]
#[derive(Debug, Eq, PartialEq, Hash)]
Expand All @@ -22,7 +22,7 @@ impl CycleApprox {
for edge in cycle.edges() {
let mut edge_points = Vec::new();
approx_curve(&edge.curve(), tolerance, &mut edge_points);
approximate_edge(edge.vertices, &mut edge_points);
approx_edge(edge.vertices, &mut edge_points);

points.extend(edge_points);
}
Expand Down
8 changes: 4 additions & 4 deletions crates/fj-kernel/src/algorithms/approx/edges.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{geometry, objects::VerticesOfEdge};

pub fn approximate_edge(
pub fn approx_edge(
vertices: VerticesOfEdge,
points: &mut Vec<geometry::Point<1, 3>>,
) {
Expand Down Expand Up @@ -41,7 +41,7 @@ mod test {
};

#[test]
fn approximate_edge() {
fn approx_edge() {
let mut shape = Shape::new();

let a = Point::from([1., 2., 3.]);
Expand All @@ -64,12 +64,12 @@ mod test {

// Regular edge
let mut points = vec![b, c];
super::approximate_edge(vertices, &mut points);
super::approx_edge(vertices, &mut points);
assert_eq!(points, vec![a, b, c, d]);

// Continuous edge
let mut points = vec![b, c];
super::approximate_edge(VerticesOfEdge::none(), &mut points);
super::approx_edge(VerticesOfEdge::none(), &mut points);
assert_eq!(points, vec![b, c, b]);
}
}

0 comments on commit 8574252

Please sign in to comment.