mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-06 19:08:28 +00:00
Inline redundant method
This commit is contained in:
parent
be9634bb67
commit
57060be1ed
@ -4,7 +4,6 @@ use fj_math::{Aabb, Point, Scalar, Transform, Triangle, Vector};
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
traits::{GenPolyline, GenTriMesh},
|
traits::{GenPolyline, GenTriMesh},
|
||||||
util::tri_mesh::convert_vector_surface_to_global,
|
|
||||||
Path, Tolerance,
|
Path, Tolerance,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -19,15 +18,6 @@ pub struct SweptCurve {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SweptCurve {
|
impl SweptCurve {
|
||||||
/// Convert a vector in surface coordinates to model coordinates
|
|
||||||
pub fn vector_from_surface_coords(
|
|
||||||
&self,
|
|
||||||
vector: impl Into<Vector<2>>,
|
|
||||||
tolerance: impl Into<Tolerance>,
|
|
||||||
) -> Vector<3> {
|
|
||||||
convert_vector_surface_to_global(self, vector, tolerance)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Transform the surface geometry
|
/// Transform the surface geometry
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn transform(self, transform: &Transform) -> Self {
|
pub fn transform(self, transform: &Transform) -> Self {
|
||||||
|
@ -36,8 +36,10 @@ mod tests {
|
|||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
|
|
||||||
use crate::geometry::{
|
use crate::geometry::{
|
||||||
util::tri_mesh::convert_point_surface_to_global, Path, SweptCurve,
|
util::tri_mesh::{
|
||||||
Tolerance,
|
convert_point_surface_to_global, convert_vector_surface_to_global,
|
||||||
|
},
|
||||||
|
Path, SweptCurve, Tolerance,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -73,7 +75,7 @@ mod tests {
|
|||||||
let tolerance = Tolerance::from_scalar(1.).unwrap();
|
let tolerance = Tolerance::from_scalar(1.).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
surface.vector_from_surface_coords([2., 4.], tolerance),
|
convert_vector_surface_to_global(&surface, [2., 4.], tolerance),
|
||||||
Vector::from([0., 4., 8.]),
|
Vector::from([0., 4., 8.]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,10 @@ use fj_math::{Circle, Line, Vector};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::{
|
geometry::{
|
||||||
util::tri_mesh::convert_point_surface_to_global, Path, SweptCurve,
|
util::tri_mesh::{
|
||||||
|
convert_point_surface_to_global, convert_vector_surface_to_global,
|
||||||
|
},
|
||||||
|
Path, SweptCurve,
|
||||||
},
|
},
|
||||||
operations::build::BuildSurface,
|
operations::build::BuildSurface,
|
||||||
storage::Handle,
|
storage::Handle,
|
||||||
@ -73,10 +76,16 @@ impl SweepSurfacePath for Path<2> {
|
|||||||
circle.center(),
|
circle.center(),
|
||||||
core.tolerance(),
|
core.tolerance(),
|
||||||
);
|
);
|
||||||
let a = surface
|
let a = convert_vector_surface_to_global(
|
||||||
.vector_from_surface_coords(circle.a(), core.tolerance());
|
surface,
|
||||||
let b = surface
|
circle.a(),
|
||||||
.vector_from_surface_coords(circle.b(), core.tolerance());
|
core.tolerance(),
|
||||||
|
);
|
||||||
|
let b = convert_vector_surface_to_global(
|
||||||
|
surface,
|
||||||
|
circle.b(),
|
||||||
|
core.tolerance(),
|
||||||
|
);
|
||||||
|
|
||||||
let circle = Circle::new(center, a, b);
|
let circle = Circle::new(center, a, b);
|
||||||
|
|
||||||
@ -88,7 +97,8 @@ impl SweepSurfacePath for Path<2> {
|
|||||||
line.origin(),
|
line.origin(),
|
||||||
core.tolerance(),
|
core.tolerance(),
|
||||||
);
|
);
|
||||||
let direction = surface.vector_from_surface_coords(
|
let direction = convert_vector_surface_to_global(
|
||||||
|
surface,
|
||||||
line.direction(),
|
line.direction(),
|
||||||
core.tolerance(),
|
core.tolerance(),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user