/////////////////////////////////////////////////////////////// // Reconstruction of the major geometrical // features found in the granite artefact /////////////////////////////////////////////////////////////// // Copyright (C) 2023, Mark Qvist // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see . /////////////////////////////////////////////////////////////// // Parameters & Customiser Configuration /////////////////////////////////////////////////////////////// /* [Output Control] */ Output_Scaling = 1; Main_Primitives = true; Handle_Guides = false; Handles = false; R3_Upper = false; R3_Lower = false; R3_Grid_1 = false; R3_Grid_2 = false; R4_Upper = false; R4_Lower = false; R4_Grid_1 = false; R4_Grid_2 = false; Radial_Traversal_Guide = false; 1_Radian_Arc_Guide = false; 1_Radian_Arc_Top = false; Top_Line = false; /////////////////////////////////////////////////////////////// // Main Setup /////////////////////////////////////////////////////////////// /* [Hidden] */ $fn=164; output_scale = Output_Scaling; radius = 1*output_scale; // Margin of error, default of 75 microns margin_of_error = 0.075; // Primary functions function Rn(r,n) = pow(sqrt(6)/2,n)*r; // Vertical translation between R(3) and R(4) d = 1/2*Rn(radius, 3)+sqrt(3)/2*Rn(radius, 3); // Helpers radian = 1*180/PI; function deg(radian) = (radian)*180/PI; line_width = margin_of_error / 10; /////////////////////////////////////////////////////////////// // Conditional Output /////////////////////////////////////////////////////////////// if (R3_Upper) { translate([0,Rn(radius, 3),0]) c(Rn(radius, 3)); } if (R3_Lower) { c(Rn(radius, 3)); } if (R3_Grid_1) { flower_of_life(Rn(radius, 3),3); } if (R3_Grid_2) { flower_of_life(Rn(radius, 3),5); } if (R4_Upper) { translate([0,d,0]) c(Rn(radius, 4)); } if (R4_Lower) { translate([0,d-Rn(radius, 4),0]) c(Rn(radius, 4)); } if (R4_Grid_1) { translate([0,d,0]) flower_of_life(Rn(radius, 4),3); } if (R4_Grid_2) { translate([0,d,0]) flower_of_life(Rn(radius, 4),5); } if (Radial_Traversal_Guide) { radial_traversal_guide(); } if (1_Radian_Arc_Guide) { radian_arc_guide(); } if (1_Radian_Arc_Top) { radian_arc(); } if (Top_Line) { translate([0,2*Rn(radius, 3),0]) l(); } if (Handle_Guides) { handle_guides(); } if (Handles) { handles(); } if (Main_Primitives) { translate([0,Rn(radius, 3),0]) c(Rn(radius, 3)); c(Rn(radius, 3)); translate([0,d-Rn(radius, 4),0]) c(Rn(radius, 4)); radian_arc(); translate([0,2*Rn(radius, 3),0]) l(); handles(); } /////////////////////////////////////////////////////////////// // Modules /////////////////////////////////////////////////////////////// module c(r) { difference() { circle(r+1/2*line_width); circle(r-1/2*line_width); } } module l(l = 25*radius) { square([l,line_width], center=true); } module flower_of_life(radius,size) { for (i = [1:size]) { translate([0,(size/2-1/2)*radius+radius-i*radius,0]) c(radius); } for (i = [1:size-1]) { for (j = [1:size-i]) { if (i < (size+1)/2) { translate([(i)*(sqrt(3)/2*radius),0,0]) // translate x translate([0,(size/2-1/2)*radius+radius-(1/2*i)*radius-j*radius,0]) c(radius); translate([-(i)*(sqrt(3)/2*radius),0,0]) // translate x translate([0,(size/2-1/2)*radius+radius-(1/2*i)*radius-j*radius,0]) c(radius); } } } } module radial_traversal_guide() { translate([(sqrt(3)/2*Rn(radius, 3))/2,0,0]) translate([0,-(sqrt(3)/2*Rn(radius, 3))/2,0]) translate([0,d,0]) rotate([0,0,-45]) l(sqrt(2)*sqrt(3)/2*Rn(radius, 3)); translate([-(sqrt(3)/2*Rn(radius, 3))/2,0,0]) translate([0,-(sqrt(3)/2*Rn(radius, 3))/2,0]) translate([0,d,0]) rotate([0,0,45]) l(sqrt(2)*sqrt(3)/2*Rn(radius, 3)); translate([0,1/2*Rn(radius, 3),0]) l(sqrt(3)/2*Rn(radius, 3)*2); translate([0,sqrt(3)/2*Rn(radius, 3)*1/2+1/2*Rn(radius, 3),0]) rotate([0,0,90]) l(sqrt(3)/2*Rn(radius, 3)); } module radian_arc_guide() { y = Rn(radius, 3)/sin(radian/2); translate([0,Rn(radius, 3)+1/2*y,0]) rotate([0,0,90]) l(y); translate([0,Rn(radius, 3),0]) translate([sin((PI/2-1/2)*180/PI)*Rn(radius, 3)/2,0,0]) translate([0,cos((PI/2-1/2)*180/PI)*Rn(radius, 3)/2,0]) rotate([0,0,90-(PI/2-1/2)*180/PI]) l(Rn(radius, 3)); } module radian_arc() { y = Rn(radius, 3)/sin(radian/2); translate([0,y+Rn(radius, 3),0]) rotate([0,0,-90+radian/2]) l(); translate([0,y+Rn(radius, 3),0]) rotate([0,0,-90-radian/2]) l(); } module handle_guides() { translate([0,d,0]) c(Rn(radius, 4)); rotate([0,0,radian/2]) l(); rotate([0,0,-radian/2]) l(); y = Rn(radius, 4)/sin(radian/2); translate([0,d-y]) rotate([0,0,-90+radian/2]) l(); translate([0,d-y,0]) rotate([0,0,-90-radian/2]) l(); } module handles() { y = Rn(radius, 4)/sin(radian/2); a = y-d; l1 = (a/sin(deg(PI/2-1)))*sin(deg(PI/2+1/2)); l2 = Rn(radius, -4)/sin(deg(PI/2-1)); l = l1+l2; c_handle = [l*sin(deg(1/2)),d-y+l*cos(deg(1/2)),0]; translate(c_handle) c(Rn(radius, -4)); translate([-(l*sin(deg(1/2))),d-y+l*cos(deg(1/2)),0]) c(Rn(radius, -4)); }