Rewrite conversion function on top of triangle_at

This commit is contained in:
Hanno Braun 2024-08-13 18:58:04 +02:00
parent bea80db446
commit 884c28416c

View File

@ -1,6 +1,6 @@
//! The geometry that defines a surface //! The geometry that defines a surface
use fj_math::{Line, Point, Scalar, Transform, Triangle, Vector}; use fj_math::{Point, Scalar, Transform, Triangle, Vector};
use crate::algorithms::approx::{PathApproxParams, Tolerance}; use crate::algorithms::approx::{PathApproxParams, Tolerance};
@ -137,17 +137,12 @@ impl SurfaceGeom {
pub fn vector_from_surface_coords( pub fn vector_from_surface_coords(
&self, &self,
vector: impl Into<Vector<2>>, vector: impl Into<Vector<2>>,
_: impl Into<Tolerance>, tolerance: impl Into<Tolerance>,
) -> Vector<3> { ) -> Vector<3> {
let vector = vector.into(); let vector = vector.into();
let Self::Basic { u, .. } = self; let point =
u.vector_from_path_coords([vector.u]) self.point_from_surface_coords(Point { coords: vector }, tolerance);
+ self.path_to_line().vector_from_line_coords([vector.v]) point - self.origin()
}
fn path_to_line(&self) -> Line<3> {
let Self::Basic { u, v } = self;
Line::from_origin_and_direction(u.origin(), *v)
} }
/// Transform the surface geometry /// Transform the surface geometry