Skip to content

Commit 50bada4

Browse files
Added tests for Face.makeSplineApprox
1 parent 86fe2f3 commit 50bada4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_cadquery.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,6 +4391,7 @@ def test2Dchamfer(self):
43914391
def testSplineApprox(self):
43924392

43934393
from .naca import naca5305
4394+
from math import pi, cos
43944395

43954396
pts = [Vector(e[0], e[1], 0) for e in naca5305]
43964397

@@ -4403,3 +4404,24 @@ def testSplineApprox(self):
44034404

44044405
with raises(ValueError):
44054406
e4 = Edge.makeSplineApprox(pts, 1e-6, maxDeg=3, smoothing=(1, 1, 1.0))
4407+
4408+
N = 40
4409+
T = 20
4410+
A = 5
4411+
4412+
pts = [
4413+
[
4414+
Vector(i, j, A * cos(2 * pi * i / T) * cos(2 * pi * j / T))
4415+
for i in range(N + 1)
4416+
]
4417+
for j in range(N + 1)
4418+
]
4419+
4420+
f1 = Face.makeSplineApprox(pts, smoothing=(1, 1, 1), maxDeg=6)
4421+
f2 = Face.makeSplineApprox(pts)
4422+
4423+
self.assertTrue(f1.isValid())
4424+
self.assertTrue(f2.isValid())
4425+
4426+
with raises(ValueError):
4427+
f3 = Face.makeSplineApprox(pts, smoothing=(1, 1, 1), maxDeg=3)

0 commit comments

Comments
 (0)