a bounded surface that represents part of the boundary of a solid
| 3267 | |
| 3268 | |
| 3269 | class Face(Shape): |
| 3270 | """ |
| 3271 | a bounded surface that represents part of the boundary of a solid |
| 3272 | """ |
| 3273 | |
| 3274 | wrapped: TopoDS_Face |
| 3275 | |
| 3276 | def _geomAdaptor(self) -> Geom_Surface: |
| 3277 | """ |
| 3278 | Return the underlying geometry |
| 3279 | """ |
| 3280 | return BRep_Tool.Surface_s(self.wrapped) |
| 3281 | |
| 3282 | def _uvBounds(self) -> tuple[float, float, float, float]: |
| 3283 | |
| 3284 | return self.uvBounds() |
| 3285 | |
| 3286 | def uvBounds(self) -> tuple[float, float, float, float]: |
| 3287 | """ |
| 3288 | Parametric bounds (u_min, u_max, v_min, v_max). |
| 3289 | """ |
| 3290 | |
| 3291 | return BRepTools.UVBounds_s(self.wrapped) |
| 3292 | |
| 3293 | def paramAt(self, pt: VectorLike) -> tuple[float, float]: |
| 3294 | """ |
| 3295 | Computes the (u,v) pair closest to a given vector. |
| 3296 | |
| 3297 | :returns: (u, v) tuple |
| 3298 | :param pt: the location to compute the normal at. |
| 3299 | :type pt: a vector that lies on or close to the surface. |
| 3300 | """ |
| 3301 | # get the geometry |
| 3302 | surface = self._geomAdaptor() |
| 3303 | |
| 3304 | # project point on surface |
| 3305 | projector = GeomAPI_ProjectPointOnSurf(Vector(pt).toPnt(), surface) |
| 3306 | |
| 3307 | u, v = projector.LowerDistanceParameters() |
| 3308 | |
| 3309 | return u, v |
| 3310 | |
| 3311 | def params( |
| 3312 | self, pts: Iterable[VectorLike], tol: float = 1e-9 |
| 3313 | ) -> tuple[list[float], list[float]]: |
| 3314 | """ |
| 3315 | Computes (u,v) pairs closest to given vectors. |
| 3316 | |
| 3317 | :returns: list of (u, v) tuples |
| 3318 | :param pts: the points to compute the normals at. |
| 3319 | :type pts: a list of vectors that lie on the surface. |
| 3320 | """ |
| 3321 | |
| 3322 | us = [] |
| 3323 | vs = [] |
| 3324 | |
| 3325 | # get the geometry |
| 3326 | surface = self._geomAdaptor() |
no outgoing calls