MCPcopy Index your code
hub / github.com/CadQuery/cadquery / params

Method params

cadquery/occ_impl/shapes.py:3311–3344  ·  view source on GitHub ↗

Computes (u,v) pairs closest to given vectors. :returns: list of (u, v) tuples :param pts: the points to compute the normals at. :type pts: a list of vectors that lie on the surface.

(
        self, pts: Iterable[VectorLike], tol: float = 1e-9
    )

Source from the content-addressed store, hash-verified

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()
3327
3328 # construct the projector
3329 projector = ShapeAnalysis_Surface(surface)
3330
3331 # get the first point
3332 it = iter(pts)
3333 pt = next(it)
3334
3335 uv = projector.ValueOfUV(Vector(pt).toPnt(), tol)
3336 us.append(uv.X())
3337 vs.append(uv.Y())
3338
3339 for pt in it:
3340 uv = projector.NextValueOfUV(uv, Vector(pt).toPnt(), tol)
3341 us.append(uv.X())
3342 vs.append(uv.Y())
3343
3344 return us, vs
3345
3346 def positionAt(self, u: Real, v: Real) -> Vector:
3347 """

Callers 4

test_approximate2DFunction · 0.45
test_face_paramsFunction · 0.45
test_edge_paramsFunction · 0.45

Calls 4

_geomAdaptorMethod · 0.95
VectorClass · 0.85
toPntMethod · 0.80
appendMethod · 0.80

Tested by 4

test_approximate2DFunction · 0.36
test_face_paramsFunction · 0.36
test_edge_paramsFunction · 0.36