Computes the normal vector at the desired location on the face. :returns: a vector representing the direction :param locationVector: the location to compute the normal at. If none, the center of the face is used. :type locationVector: a vector that lies on the surfa
(self, locationVector: VectorLike | None = None)
| 3393 | |
| 3394 | @multimethod |
| 3395 | def normalAt(self, locationVector: VectorLike | None = None) -> Vector: |
| 3396 | """ |
| 3397 | Computes the normal vector at the desired location on the face. |
| 3398 | |
| 3399 | :returns: a vector representing the direction |
| 3400 | :param locationVector: the location to compute the normal at. If none, the center of the face is used. |
| 3401 | :type locationVector: a vector that lies on the surface. |
| 3402 | """ |
| 3403 | # get the geometry |
| 3404 | surface = self._geomAdaptor() |
| 3405 | |
| 3406 | if locationVector is None: |
| 3407 | u0, u1, v0, v1 = self._uvBounds() |
| 3408 | u = 0.5 * (u0 + u1) |
| 3409 | v = 0.5 * (v0 + v1) |
| 3410 | else: |
| 3411 | # project point on surface |
| 3412 | projector = GeomAPI_ProjectPointOnSurf( |
| 3413 | Vector(locationVector).toPnt(), surface |
| 3414 | ) |
| 3415 | |
| 3416 | u, v = projector.LowerDistanceParameters() |
| 3417 | |
| 3418 | p = gp_Pnt() |
| 3419 | vn = gp_Vec() |
| 3420 | BRepGProp_Face(self.wrapped).Normal(u, v, p, vn) |
| 3421 | |
| 3422 | return Vector(vn).normalized() |
| 3423 | |
| 3424 | @multimethod |
| 3425 | def normalAt(self, u: Real, v: Real) -> tuple[Vector, Vector]: |