Skip to content

Commit e00b4ad

Browse files
jacobrkerstetterpyansys-ci-botpre-commit-ci[bot]
authored
test: nurbs length test (#2142)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 75b497c commit e00b4ad

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

doc/changelog.d/2142.test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Nurbs length test

tests/test_primitives.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,3 +1583,16 @@ def test_nurbs_curve_contains_point_not_implemented():
15831583
# Assert that contains_point raises NotImplementedError
15841584
with pytest.raises(NotImplementedError, match="contains_point\\(\\) is not implemented."):
15851585
nurbs_curve.contains_point(point)
1586+
1587+
1588+
def test_nurbs_length_calculation():
1589+
"""Test the length calculation of a NURBS curve."""
1590+
points = [Point3D([0, 0, 0]), Point3D([2, 2, 0]), Point3D([-2, 4, 0]), Point3D([2, 6, 0])]
1591+
degree = 3
1592+
nurbs_curve = NURBSCurve.fit_curve_from_points(points, degree)
1593+
1594+
# Calculate the length of the NURBS curve
1595+
length = nurbs_curve.length()
1596+
1597+
# Verify that the length is calculated correctly
1598+
assert np.isclose(length, 13.3012277924)

0 commit comments

Comments
 (0)