| 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 | |