Skip to content

Commit 5a7b6db

Browse files
author
Kurt Hutten
committed
Add test geometries
After pr #10, it makes sense to have some test shapes beyond the examples to make sure there aren't regressions in the library, Hopefully we'll add to this with time.
1 parent 6b16407 commit 5a7b6db

File tree

1 file changed

+44
-11
lines changed

1 file changed

+44
-11
lines changed

roundAnythingExamples.scad

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ basicPolyRoundExample();
1212
// radiusExtrudeExample();
1313
// polyRoundExtrudeExample();
1414

15+
16+
// testing
17+
// testGeometries();
18+
1519
module basicPolyRoundExample(){
1620
// polyLine is a dev helper. Aim is to show the points of the polygon and their order before
1721
// you're ready to move on to polyRound and a polygon
@@ -122,8 +126,8 @@ module translateRadiiPointsExample() {
122126

123127
module 2dShellExample(){
124128
radiiPoints=[[-4,0,1],[5,3,1.5],[0,7,0.1],[8,7,10],[20,20,0.8],[10,0,10]];
125-
shell2d(-0.5)polygon(polyRound(radiiPoints,30));
126-
translate([0,-10,0])shell2d(-0.5){
129+
linear_extrude(1)shell2d(-0.5)polygon(polyRound(radiiPoints,30));
130+
translate([0,-10,0])linear_extrude(1)shell2d(-0.5){
127131
polygon(polyRound(radiiPoints,30));
128132
translate([8,8])gridpattern(memberW = 0.3, sqW = 1, iter = 17, r = 0.2);
129133
}
@@ -136,40 +140,40 @@ module beamChainExample(){
136140
translate([0,0,0]){
137141
radiiPoints=beamPoints(0,0);
138142
for(i=[0: len(radiiPoints)-1]){color("red")translate([radiiPoints[i].x,radiiPoints[i].y,0])cylinder(d=0.2, h=1);}
139-
polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));
143+
linear_extrude(1)polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));
140144
}
141145

142146

143147
// Add some radii to the line transitions
144148
translate([0,-7,0]){
145149
radiiPoints=beamPoints(2,1);
146150
for(i=[0: len(radiiPoints)-1]){color("red")translate([radiiPoints[i].x,radiiPoints[i].y,0])cylinder(d=0.2, h=1);}
147-
polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));
151+
linear_extrude(1)polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));
148152
}
149153

150154
// Give make the lines beams with some thickness
151155
translate([0,-7*2,0]){
152156
radiiPoints=beamPoints(2,1);
153-
polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5),20));
157+
linear_extrude(1)polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5),20));
154158
}
155159

156160
// Add an angle to the start of the beam
157161
translate([0,-7*3,0]){
158162
radiiPoints=beamPoints(2,1);
159-
polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5, startAngle=45),20));
163+
linear_extrude(1)polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5, startAngle=45),20));
160164
}
161165

162166
// Put a negative radius at the start for transationing to a flat surface
163167
translate([0,-7*4,0]){
164168
radiiPoints=beamPoints(2,1,rStart=-0.7);
165-
polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5, startAngle=45),20));
169+
linear_extrude(1)polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5, startAngle=45),20));
166170
}
167171

168172
// Define more points for a polygon to be atteched to the end of the beam chain
169173
clipP=[[16,1.2,0],[16,0,0],[16.5,0,0],[16.5,1,0.2],[17.5,1,0.2],[17.5,0,0],[18,0,0],[18,1.2,0]];
170174
translate([-15,-7*5+3,0]){
171175
for(i=[0:len(clipP)-1]){color("red")translate([clipP[i].x,clipP[i].y,0])cylinder(d=0.2, h=1);}
172-
polygon(polyRound(clipP,20));
176+
linear_extrude(1)polygon(polyRound(clipP,20));
173177
}
174178

175179
// Attached to the end of the beam chain by dividing the beam paths in forward and return and
@@ -179,7 +183,7 @@ module beamChainExample(){
179183
forwardPath=beamChain(radiiPoints,offset1=0.5,startAngle=-15,mode=2);
180184
returnPath=revList(beamChain(radiiPoints,offset1=-0.5,startAngle=-15,mode=2));
181185
entirePath=concat(forwardPath,clipP,returnPath);
182-
polygon(polyRound(entirePath,20));
186+
linear_extrude(1)polygon(polyRound(entirePath,20));
183187
}
184188

185189
// Add transitioning radii into the end polygong
@@ -188,13 +192,13 @@ module beamChainExample(){
188192
forwardPath=beamChain(radiiPoints,offset1=0.5,startAngle=-15,mode=2);
189193
returnPath=revList(beamChain(radiiPoints,offset1=-0.5,startAngle=-15,mode=2));
190194
entirePath=concat(forwardPath,clipP,returnPath);
191-
polygon(polyRound(entirePath,20));
195+
linear_extrude(1)polygon(polyRound(entirePath,20));
192196
}
193197

194198
// Define multiple shells from the the one set of points
195199
translate([0,-7*9,0]){
196200
radiiPoints=beamPoints(2,1,rEnd=3);
197-
for(i=[0:2]){polygon(polyRound(beamChain(radiiPoints,offset1=-1+i*0.4, offset2=-1+i*0.4+0.25),20));}
201+
for(i=[0:2]){linear_extrude(1)polygon(polyRound(beamChain(radiiPoints,offset1=-1+i*0.4, offset2=-1+i*0.4+0.25),20));}
198202
}
199203
}
200204

@@ -225,3 +229,32 @@ module gridpattern(memberW = 4, sqW = 12, iter = 5, r = 3){
225229
}
226230
}
227231
}
232+
233+
234+
module testGeometries() {
235+
// Check these shapen preview (plus "thrown together") and render correctly with each PR
236+
points = [
237+
[0, 10, 5],
238+
[10, 0, 5],
239+
[0, -10, 5],
240+
[-10, 0, 5],
241+
];
242+
reversedPoints = [
243+
[-10, 0, 5],
244+
[0, -10, 5],
245+
[10, 0, 5],
246+
[0, 10, 5],
247+
];
248+
polyRoundExtrudeTestShape(points);
249+
translate([0,20,0])polyRoundExtrudeTestShape(reversedPoints);
250+
251+
}
252+
253+
module polyRoundExtrudeTestShape(points) {
254+
// make sure no faces are inverted
255+
difference() {
256+
translate([0, 0, -2.5]) polyRoundExtrude(points,r1=-1,r2=1);
257+
sphere(d=9);
258+
translate([0,0,7])sphere(d=9);
259+
}
260+
}

0 commit comments

Comments
 (0)