regular_shapes: Simplify hexagon modules

- Alleviate the hexagon_prism module by letting 'hexagon' do the
selection between the inputs.

 - Aggregate input selection to avoid overwriting other inputs.
This commit is contained in:
Rock Storm 2018-10-18 18:55:32 +01:00
parent 23dc11bc5f
commit 0b34bf6834

View file

@ -43,9 +43,7 @@ module pentagon(radius)
module hexagon(radius, diameter, across_flats) module hexagon(radius, diameter, across_flats)
{ {
r = radius; r = across_flats ? across_flats/2/cos(30) : diameter ? diameter/2 : radius;
r = diameter ? diameter/2 : radius;
r = across_flats ? across_flats/2/cos(30) : radius;
reg_polygon(6,r); reg_polygon(6,r);
} }
@ -159,9 +157,8 @@ module pentagon_tube(height,radius,wall)
module hexagon_prism(height, radius, across_flats) module hexagon_prism(height, radius, across_flats)
{ {
r = radius; linear_extrude(height=height)
r = across_flats ? across_flats/2/cos(30) : radius; hexagon(radius=radius, across_flats=across_flats);
linear_extrude(height=height) hexagon(r);
} }
module hexagon_tube(height,radius,wall) module hexagon_tube(height,radius,wall)