Skip to content

Commit

Permalink
Simplify method names
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed May 11, 2022
1 parent 9b4dd4e commit 791745b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
10 changes: 3 additions & 7 deletions crates/fj-kernel/src/algorithms/triangulation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@ pub fn triangulate(
.map(|vertex| {
// Can't panic, unless the approximation wrongfully
// generates points that are not in the surface.
surface.convert_point_to_surface_coords(vertex)
surface.point_to_surface_coords(vertex)
})
.collect();
let face_as_polygon = Polygon::new(surface)
.with_exterior(approx.exterior.points.into_iter().map(
|point| {
// Can't panic, unless the approximation wrongfully
// generates points that are not in the surface.
surface
.convert_point_to_surface_coords(point)
.native()
surface.point_to_surface_coords(point).native()
},
))
.with_interiors(approx.interiors.into_iter().map(
Expand All @@ -51,9 +49,7 @@ pub fn triangulate(
// Can't panic, unless the approximation
// wrongfully generates points that are not in
// the surface.
surface
.convert_point_to_surface_coords(point)
.native()
surface.point_to_surface_coords(point).native()
})
},
));
Expand Down
5 changes: 2 additions & 3 deletions crates/fj-kernel/src/algorithms/triangulation/polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl Polygon {
};

let mut check = TriangleEdgeCheck::new(
self.surface.convert_point_from_surface_coords(ray.origin),
self.surface.point_from_surface_coords(ray.origin),
);

let mut num_hits = 0;
Expand Down Expand Up @@ -201,8 +201,7 @@ impl Polygon {

let edge =
Segment::from_points(edge.points().map(|point| {
self.surface
.convert_point_from_surface_coords(point)
self.surface.point_from_surface_coords(point)
}));
check.hits.push(edge);
}
Expand Down
6 changes: 3 additions & 3 deletions crates/fj-kernel/src/geometry/surfaces/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Surface {
}

/// Convert a point in model coordinates to surface coordinates
pub fn convert_point_to_surface_coords(
pub fn point_to_surface_coords(
&self,
point_3d: impl Into<Point<3>>,
) -> geometry::Point<2> {
Expand All @@ -75,7 +75,7 @@ impl Surface {
}

/// Convert a point in surface coordinates to model coordinates
pub fn convert_point_from_surface_coords(
pub fn point_from_surface_coords(
&self,
point: impl Into<Point<2>>,
) -> Point<3> {
Expand All @@ -87,7 +87,7 @@ impl Surface {
}

/// Convert a vector in surface coordinates to model coordinates
pub fn convert_vector_from_surface_coords(
pub fn vector_from_surface_coords(
&self,
vector: impl Into<Vector<2>>,
) -> Vector<3> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl ToShape for fj::Sketch {
.to_points()
.into_iter()
.map(Point::from)
.map(|point| surface.convert_point_from_surface_coords(point));
.map(|point| surface.point_from_surface_coords(point));

Face::builder(surface, &mut shape)
.with_exterior_polygon(points)
Expand Down

0 comments on commit 791745b

Please sign in to comment.