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

Method testSplineWithMultipleTangents

tests/test_cadquery.py:725–744  ·  view source on GitHub ↗

Tests specifying B-spline tangents, besides the start point and end point tangents.

(self)

Source from the content-addressed store, hash-verified

723 self.assertAlmostEqual(path2.val().tangentAt(0).z, 0)
724
725 def testSplineWithMultipleTangents(self):
726 """
727 Tests specifying B-spline tangents, besides the start point and end
728 point tangents.
729 """
730
731 points = [(0, 0), (1, 1), (2, 0), (1, -1)]
732 tangents = [(0, 1), (1, 0), (0, -1), (-1, 0)]
733 parameters = range(len(points))
734
735 spline = (
736 Workplane("XY")
737 .spline(points, tangents=tangents, parameters=parameters)
738 .consolidateWires()
739 )
740
741 test_point = spline.edges().val().positionAt(2.5, mode="parameter")
742 expected_test_point = Vector(1.875, -0.625, 0.0)
743
744 self.assertAlmostEqual((test_point - expected_test_point).Length, 0)
745
746 def testSplineWithSpecifiedAndUnspecifiedTangents(self):
747 points = [(0, 0), (1, 1), (2, 0), (1, -1)]

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