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

Method paramAt

cadquery/occ_impl/shapes.py:2150–2171  ·  view source on GitHub ↗

Compute parameter value at the specified normalized distance or a point. :param d: normalized distance [0, 1] or a point :return: parameter value

(self: Mixin1DProtocol, d: Real | Vector)

Source from the content-addressed store, hash-verified

2148 return rv
2149
2150 def paramAt(self: Mixin1DProtocol, d: Real | Vector) -> float:
2151 """
2152 Compute parameter value at the specified normalized distance or a point.
2153
2154 :param d: normalized distance [0, 1] or a point
2155 :return: parameter value
2156 """
2157
2158 curve = self._geomAdaptor()
2159
2160 if isinstance(d, Vector):
2161 curve_ = self._curve()
2162
2163 rv = GeomAPI_ProjectPointOnCurve(
2164 d.toPnt(), curve_, curve.FirstParameter(), curve.LastParameter(),
2165 ).LowerDistanceParameter()
2166
2167 else:
2168 l = GCPnts_AbscissaPoint.Length_s(curve)
2169 rv = GCPnts_AbscissaPoint(curve, l * d, curve.FirstParameter()).Parameter()
2170
2171 return rv
2172
2173 def params(
2174 self: Mixin1DProtocol, pts: Iterable[Vector], tol: float = 1e-6

Callers 2

tangentAtMethod · 0.95
_curve_and_paramMethod · 0.95

Calls 3

_curveMethod · 0.95
toPntMethod · 0.80
_geomAdaptorMethod · 0.45

Tested by

no test coverage detected