MCPcopy
hub / github.com/CadQuery/cadquery / params

Method params

cadquery/occ_impl/shapes.py:2173–2205  ·  view source on GitHub ↗

Computes u values closest to given vectors. :param pts: the points to compute the parameters at. :return: list of u values.

(
        self: Mixin1DProtocol, pts: Iterable[Vector], tol: float = 1e-6
    )

Source from the content-addressed store, hash-verified

2171 return rv
2172
2173 def params(
2174 self: Mixin1DProtocol, pts: Iterable[Vector], tol: float = 1e-6
2175 ) -> list[float]:
2176 """
2177 Computes u values closest to given vectors.
2178
2179 :param pts: the points to compute the parameters at.
2180 :return: list of u values.
2181 """
2182
2183 us = []
2184
2185 curve = self._geomAdaptor()
2186 curve_ = self._curve()
2187 umin = curve.FirstParameter()
2188 umax = curve.LastParameter()
2189
2190 # get the first point
2191 it = iter(pts)
2192 pt = next(it)
2193
2194 proj = GeomAPI_ProjectPointOnCurve(pt.toPnt(), curve_, umin, umax)
2195
2196 u = proj.LowerDistanceParameter()
2197 us.append(u)
2198
2199 for pt in it:
2200 proj.Perform(pt.toPnt())
2201 u = proj.LowerDistanceParameter()
2202
2203 us.append(u)
2204
2205 return us
2206
2207 def paramsLength(self: Mixin1DProtocol, locations: Iterable[float]) -> list[float]:
2208 """

Callers

nothing calls this directly

Calls 4

_curveMethod · 0.95
toPntMethod · 0.80
appendMethod · 0.80
_geomAdaptorMethod · 0.45

Tested by

no test coverage detected