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

Method testTangengAt

tests/test_cadquery.py:4977–4997  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4975 assert p1.toTuple() == approx((-1.0, 0.0, 0.0))
4976
4977 def testTangengAt(self):
4978
4979 pts = [(0, 0), (-1, 1), (-2, 0), (-1, 0)]
4980
4981 path = Workplane("XZ").spline(pts, tangents=((0, 1), (1, 0))).val()
4982
4983 self.assertTrue(
4984 path.tangentAt(0.0, mode="parameter") == path.tangentAt(0.0, mode="length")
4985 )
4986 self.assertFalse(
4987 path.tangentAt(0.5, mode="parameter") == path.tangentAt(0.5, mode="length")
4988 )
4989
4990 arc = Workplane().radiusArc((2, 0), 1).val()
4991
4992 self.assertTupleAlmostEquals(
4993 arc.tangentAt(math.pi / 2, "parameter").toTuple(), (1, 0, 0), 6
4994 )
4995 self.assertTupleAlmostEquals(
4996 arc.tangentAt(0.5, "length").toTuple(), (1, 0, 0), 6
4997 )
4998
4999 def testEnd(self):
5000

Callers

nothing calls this directly

Calls 7

WorkplaneClass · 0.85
radiusArcMethod · 0.80
valMethod · 0.45
splineMethod · 0.45
tangentAtMethod · 0.45
toTupleMethod · 0.45

Tested by

no test coverage detected