From 01e6d46da606c20bbcf4d45e6d6b96a8cf7d4e3f Mon Sep 17 00:00:00 2001 From: gumyr Date: Tue, 20 Jun 2023 09:37:27 -0400 Subject: [PATCH] Added Face.position_at(u,v) --- src/build123d/topology.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/build123d/topology.py b/src/build123d/topology.py index fe43951..02f45a3 100644 --- a/src/build123d/topology.py +++ b/src/build123d/topology.py @@ -4317,7 +4317,31 @@ class Face(Shape): return Vector(normal) - def center(self, center_of=CenterOf.GEOMETRY): + def position_at(self, u: float, v: float) -> Vector: + """position_at + + Computes a point on the Face given u, v coordinates. + + Args: + u (float): the horizontal coordinate in the parameter space of the Face, + between 0.0 and 1.0 + v (float): the vertical coordinate in the parameter space of the Face, + between 0.0 and 1.0 + + Returns: + Vector: point on Face + """ + u_val0, u_val1, v_val0, v_val1 = self._uv_bounds() + u_val = u * (u_val0 + u_val1) + v_val = v * (v_val0 + v_val1) + + gp_pnt = gp_Pnt() + normal = gp_Vec() + BRepGProp_Face(self.wrapped).Normal(u_val, v_val, gp_pnt, normal) + + return Vector(gp_pnt) + + def center(self, center_of=CenterOf.GEOMETRY) -> Vector: """Center of Face Return the center based on center_of