Skip to content

Commit

Permalink
Rewrite conversion function on top of triangle_at
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Aug 13, 2024
1 parent bea80db commit 884c284
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions crates/fj-core/src/geometry/surface.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! 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};

Expand Down Expand Up @@ -137,17 +137,12 @@ impl SurfaceGeom {
pub fn vector_from_surface_coords(
&self,
vector: impl Into<Vector<2>>,
_: impl Into<Tolerance>,
tolerance: impl Into<Tolerance>,
) -> Vector<3> {
let vector = vector.into();
let Self::Basic { u, .. } = self;
u.vector_from_path_coords([vector.u])
+ self.path_to_line().vector_from_line_coords([vector.v])
}

fn path_to_line(&self) -> Line<3> {
let Self::Basic { u, v } = self;
Line::from_origin_and_direction(u.origin(), *v)
let point =
self.point_from_surface_coords(Point { coords: vector }, tolerance);
point - self.origin()
}

/// Transform the surface geometry
Expand Down

0 comments on commit 884c284

Please sign in to comment.