(self)
| 760 | self.assertAlmostEqual((test_point - expected_test_point).Length, 0) |
| 761 | |
| 762 | def testSplineSpecifyingParameters(self): |
| 763 | points = [(0, 0), (1, 1), (2, 0), (1, -1)] |
| 764 | tangents = [(0, 1), (1, 0), (0, -1), (-1, 0)] |
| 765 | |
| 766 | spline1 = ( |
| 767 | Workplane("XY") |
| 768 | .spline(points, tangents=tangents, parameters=[0, 1, 2, 3]) |
| 769 | .consolidateWires() |
| 770 | ) |
| 771 | # Multiply all parameter values by 10: |
| 772 | spline2 = ( |
| 773 | Workplane("XY") |
| 774 | .spline(points, tangents=tangents, parameters=[0, 10, 20, 30]) |
| 775 | .consolidateWires() |
| 776 | ) |
| 777 | |
| 778 | # Test point equivalence for parameter, and parameter multiplied by 10: |
| 779 | test_point1 = spline1.edges().val().positionAt(1.5, mode="parameter") |
| 780 | test_point2 = spline2.edges().val().positionAt(15, mode="parameter") |
| 781 | expected_test_point = Vector(1.625, 0.625, 0.0) |
| 782 | |
| 783 | self.assertAlmostEqual((test_point1 - test_point2).Length, 0) |
| 784 | self.assertAlmostEqual((test_point1 - expected_test_point).Length, 0) |
| 785 | |
| 786 | # test periodic with parameters |
| 787 | spline3 = Workplane().spline( |
| 788 | points, periodic=True, parameters=[x for x in range(len(points) + 1)] |
| 789 | ) |
| 790 | self.assertTrue(spline3.val().IsClosed()) |
| 791 | |
| 792 | def testSplineWithScaleTrue(self): |
| 793 | points = [(0, 0), (1, 1), (2, 0), (1, -1)] |
nothing calls this directly
no test coverage detected