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

Method testSplineWithScaleFalse

tests/test_cadquery.py:808–831  ·  view source on GitHub ↗

Like testSplineWithScaleTrue, but verifies the tangent vector is different when scale=False. The interpolation points and tangent vectors are the same in `testSplineWithScaleTrue`, and `testSplineWithScaleFalse`. A test point is rendered at the same paramete

(self)

Source from the content-addressed store, hash-verified

806 self.assertAlmostEqual((test_point - expected_test_point).Length, 0)
807
808 def testSplineWithScaleFalse(self):
809 """
810 Like testSplineWithScaleTrue, but verifies the tangent vector is
811 different when scale=False.
812
813 The interpolation points and tangent vectors are the same in
814 `testSplineWithScaleTrue`, and `testSplineWithScaleFalse`. A test
815 point is rendered at the same parameter value in both cases, but its
816 coordinates are different in each case.
817 """
818 points = [(0, 0), (1, 1), (2, 0), (1, -1)]
819 tangents = [(0, 1), (1, 0), (0, -1), (-1, 0)]
820 parameters = range(len(points))
821
822 spline = (
823 Workplane("XY")
824 .spline(points, tangents=tangents, parameters=parameters, scale=False)
825 .consolidateWires()
826 )
827
828 test_point = spline.edges().val().positionAt(0.5, mode="parameter")
829 expected_test_point = Vector(0.375, 0.625, 0.0)
830
831 self.assertAlmostEqual((test_point - expected_test_point).Length, 0)
832
833 def testSplineTangentMagnitudeBelowToleranceThrows(self):
834 import OCP

Callers

nothing calls this directly

Calls 7

WorkplaneClass · 0.85
VectorClass · 0.85
consolidateWiresMethod · 0.80
splineMethod · 0.45
positionAtMethod · 0.45
valMethod · 0.45
edgesMethod · 0.45

Tested by

no test coverage detected