From 38a21e79cf1f4a4de8a0c955b244164e0d41ddb8 Mon Sep 17 00:00:00 2001 From: Jens Heinrich Date: Sun, 12 May 2019 21:00:09 +0200 Subject: [PATCH] =?UTF-8?q?=09ge=C3=A4ndert:=20=20=20=20=20=20=20polyhaus.?= =?UTF-8?q?scad=20fixed=20trigonometric=20functions=20fixed=20translation?= =?UTF-8?q?=20added=20DEBUG=20statements=20added=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- polyhaus.scad | 187 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 131 insertions(+), 56 deletions(-) diff --git a/polyhaus.scad b/polyhaus.scad index d8b5f73..ae6501c 100644 --- a/polyhaus.scad +++ b/polyhaus.scad @@ -10,6 +10,9 @@ garagediameter=ringdiameter+2000; garageheigth=4000; sides=6; + outer_wall_woodwidth=50; + outer_wall_strawwidth=1000; + // The House Modules module ngon( diameter=5, @@ -45,11 +48,16 @@ module ring( { //do the math for the radii angle=(0.5*360/sides); - radius_in_circle=(asin(angle)*ringdiameter)-wallstrength; - side_length=2*acos(0.5*360/sides)*radius_in_circle; - radius_in_diameter=radius_in_circle/ asin(angle); -# - difference() { + radius_in_circle=(sin(angle)*ringdiameter)-wallstrength; + echo("DEBUG RING radius_in_circle"); + echo(radius_in_circle); + side_length=2*cos(0.5*360/sides)*radius_in_circle; + echo("DEBUG RING side_length"); + echo(side_length); + radius_in_diameter=radius_in_circle/ sin(angle); + echo("DEBUG RING radius_in_diameter"); + echo(radius_in_diameter); + #difference() { ngon( height=ringheigth, diameter=ringdiameter, @@ -74,36 +82,47 @@ module living( { angle=(0.5*360/sides); - radius_in_circle=(asin(angle)*ringdiameter)-wallstrength; - radius_in_diameter=radius_in_circle/ asin(angle); + radius_in_circle=(sin(angle)*ringdiameter)-wallstrength; + radius_in_diameter=radius_in_circle/ sin(angle); side_length=2*acos(0.5*360/sides)*radius_in_circle; -#difference() { + # + difference() { %ring(); + echo("DEBUG LIVING building inner ring"); translate([0,0,+floorstrength]) ring( ringdiameter=radius_in_diameter, ringstrength=ringstrength-2*wallstrength, ringheigth=level-(floorstrength+ceilingstrength)); }; - }; +}; + - outer_wall_woodwidth=50; - outer_wall_strawwidth=1000; module spar( - width, - depth, - height + spar_width, + spar_depth, + spar_height ) { + echo("DEBUG SPAR creating spar"); + echo("DEBUG SPAR spar vars"); + echo( + spar_width, + spar_depth, + spar_height +); + translate( - [0.5*width, - 0.5*depth, + [0.5*spar_width, + 0.5*spar_depth, 0] ) cube( - width, - depth, - height + size=[ + spar_width, + spar_depth, + spar_height + ] ); } @@ -116,41 +135,76 @@ module outer_wall( ) { angle=0.5*360/sides; - radius_in_circle=(asin(angle)*ringdiameter)-wallstrength; - side_length=2*acos(angle)*radius_in_circle; + echo("DEBUG angle"); + echo(angle); + radius_in_circle=floor( + 0.5*(sin(angle)*ringdiameter)- + wallstrength + ); + echo("DEBUG radius_in_circle"); + echo(radius_in_circle); + side_length=round( + 2*cos(angle)*radius_in_circle + ); + echo("DEBUG side_lenght"); + echo(side_length); elements=floor(side_length/(outer_wall_woodwidth+outer_wall_strawwidth)); - for (side=[1:sides] ) + echo("DEBUG elements"); + echo(elements); + for(side=[1:sides] ) { + echo("DEBUG running through sides"); echo(side); rotate( [0,0,2*angle] ) { - if (elements%2==1) - { + echo(" DEBUG OUTER WALL building spars") + if (elements%2==1) + { echo("DEBUG uneven number"); // center the middle modeline for (spar= [0:elements]) { - offset= 0.5* outer_wall_strawwidth + spar*(outer_wall_woodwidth+outer_wall_strawwidth); - translate ( - [ - 0, - radius_in_circle, - offset - ] ) - spar( - width=outer_wall_woodwidth, - depth=wallstrength, - height=level + echo("DEBUG OUTER WALL planking"); + echo("DEBUG OUTER WALL spar"); + echo(spar); + offset = ( + 0.5* outer_wall_strawwidth + + spar*(outer_wall_woodwidth + + outer_wall_strawwidth) + ); + echo("DEBUG OUTER WALL offset for spar"); + echo(offset); + echo("DEBUG OUTER WALL spar vars"); + echo( + outer_wall_woodwidth, + wallstrength, + level ); translate ( [ 0, - radius_in_circle, - -offset + offset, + radius_in_circle ] ) - spar(); + spar( + spar_width=outer_wall_woodwidth, + spar_depth=wallstrength, + spar_height=level + ); + translate ( + [ + 0, + -offset, + radius_in_circle + ] ) + spar( + spar_width=outer_wall_woodwidth, + spar_depth=wallstrength, + spar_height=level + ); + } } if (elements%2==0) @@ -159,31 +213,52 @@ module outer_wall( // center the middle modeline for (spar= [0:elements]) { - offset= 0.5* outer_wall_strawwidth + spar*(outer_wall_woodwidth+outer_wall_strawwidth); - translate ( - [0, - radius_in_circle, - offset] ) - spar( - width=outer_wall_woodwidth, - depth=wallstrength, - height=level + echo("DEBUG OUTER WALL planking"); + echo("DEBUG OUTER WALL spar"); + echo(spar); + offset= (0.5* outer_wall_strawwidth + + spar*(outer_wall_woodwidth+ + outer_wall_strawwidth)); + echo("DEBUG OUTER WALL offset for spar"); + echo(offset); + echo("DEBUG OUTER WALL spar vars"); + echo( + outer_wall_woodwidth, + wallstrength, + level ); + // positive spar translate ( - [0, - radius_in_circle, - -offset + [ + offset, + 0, + radius_in_circle ] ) - spar(); + spar( + spar_width=outer_wall_woodwidth, + spar_depth=wallstrength, + spar_height=level + ); + // negative spar + translate ( + [ + -offset, + 0, + radius_in_circle + ] ) + spar( + spar_width=outer_wall_woodwidth, + spar_depth=wallstrength, + spar_height=level + ); } } } } }; -//living(); -//translate([0,0,level]) living(); -//garage(); +living(); +translate([0,0,level]) living(); +garage(); outer_wall(); - - +//ring();