test_contours.scad
1 use <unittest.scad> 2 use <contours.scad> 3 4 module test_contours() { 5 echo("==== test_contours ===="); 6 7 min_value = 1; 8 max_value = 360; 9 resolution = 10; 10 11 function f(x, y) = sin(x) * cos(y) * 30; 12 13 points = [ 14 for(y = [min_value:resolution:max_value]) 15 [ 16 for(x = [min_value:resolution:max_value]) 17 [x, y, f(x, y)] 18 ] 19 ]; 20 21 assertEqualPoints([[21, 89.9963, 0], [31, 89.9963, 0]], contours(points, 0)[10]); 22 assertEqualPoints( [[11, 31], [11, 41], [1, 41], [1, 31]], contours(points, [0, 5])[10]); 23 } 24 25 test_contours();