Move edges.scad content to attachments.scad

Add subsections to attachments.scad
This commit is contained in:
Adrian Mariano
2021-11-19 22:20:01 -05:00
parent 1ec9faec39
commit e653be471f
6 changed files with 753 additions and 713 deletions

View File

@@ -798,21 +798,56 @@ module test_reindex_polygon() {
module test_align_polygon() {
/*
pentagon = subdivide_path(pentagon(side=2),10);
hexagon = subdivide_path(hexagon(side=2.7),10);
aligned = [[2.7,0],[2.025,-1.16913429511],[1.35,-2.33826859022],
[-1.35,-2.33826859022],[-2.025,-1.16913429511],[-2.7,0],
[-2.025,1.16913429511],[-1.35,2.33826859022],[1.35,2.33826859022],
[2.025,1.16913429511]];
assert_approx(align_polygon(pentagon,hexagon,[0:10:359]), aligned);
aligned2 = [[1.37638192047,0],[1.37638192047,-1],[0.425325404176,-1.30901699437],
[-0.525731112119,-1.61803398875],[-1.11351636441,-0.809016994375],
[-1.7013016167,0],[-1.11351636441,0.809016994375],
[-0.525731112119,1.61803398875],[0.425325404176,1.30901699437],
[1.37638192047,1]];
assert_approx(align_polygon(hexagon,pentagon,[0:10:359]), aligned2);
*/
ellipse = yscale(3,circle(r=10, $fn=32));
tri = move([-50/3,-9],
subdivide_path([[0,0], [50,0], [0,27]], 32));
aligned = align_polygon(ellipse,tri, [0:5:180]);
assert_approx(aligned,
[[8.6933324366, 2.32937140592], [9.77174512453,
-1.69531953695], [10.8501578125, -5.72001047982],
[11.9285705004, -9.74470142269], [13.0069831883,
-13.7693923656], [9.28126928691, -14.7676943967],
[5.55555538551, -15.7659964278], [1.82984148411,
-16.7642984589], [-1.89587241729, -17.76260049],
[-5.62158631869, -18.7609025211], [-9.34730022009,
-19.7592045522], [-13.0730141215, -20.7575065833],
[-12.0623183481, -16.5048600039], [-11.0516225746,
-12.2522134245], [-10.0409268012, -7.99956684512],
[-9.03023102775, -3.74692026572], [-8.01953525431,
0.505726313678], [-7.00883948087, 4.75837289308],
[-5.99814370744, 9.01101947248], [-4.987447934,
13.2636660519], [-3.97675216056, 17.5163126313],
[-2.96605638713, 21.7689592107], [-1.95536061369,
26.0216057901], [-0.944664840253, 30.2742523695],
[0.0660309331843, 34.5268989489], [1.14444362111,
30.502208006], [2.22285630904, 26.4775170631],
[3.30126899697, 22.4528261203], [4.37968168489,
18.4281351774], [5.45809437282, 14.4034442345],
[6.53650706075, 10.3787532917], [7.61491974867,
6.35406234879]]);
ellipse2 = yscale(2,circle(r=10, $fn=32));
tri2 = subdivide_path([[0,0], [27,0], [-7,50]], 32);
T = [for(x=[-10:0], y=[-30:-15]) move([x,y])];
aligned2 = align_polygon(ellipse2,tri2, trans=T);
assert_approx(aligned2,
[[10.5384615385, -3.61538461538], [13.1538461538,
-7.46153846154], [15.7692307692, -11.3076923077],
[18.3846153846, -15.1538461538], [21, -19],
[17.1428571429, -19], [13.2857142857, -19],
[9.42857142857, -19], [5.57142857143, -19],
[1.71428571429, -19], [-2.14285714286, -19], [-6, -19],
[-6.58333333333, -14.8333333333], [-7.16666666667,
-10.6666666667], [-7.75, -6.5], [-8.33333333333,
-2.33333333333], [-8.91666666667, 1.83333333333], [-9.5,
6], [-10.0833333333, 10.1666666667], [-10.6666666667,
14.3333333333], [-11.25, 18.5], [-11.8333333333,
22.6666666667], [-12.4166666667, 26.8333333333], [-13,
31], [-10.3846153846, 27.1538461538], [-7.76923076923,
23.3076923077], [-5.15384615385, 19.4615384615],
[-2.53846153846, 15.6153846154], [0.0769230769231,
11.7692307692], [2.69230769231, 7.92307692308],
[5.30769230769, 4.07692307692], [7.92307692308,
0.230769230769]]);
}
*test_align_polygon();