#local _Pi = 3.141592654; #macro involute_point (r_theta) #end #macro make_2d_point (r_theta) #end #macro make_3d_point (r_theta) #end #macro rotate_point (r_theta, _angle) #end #macro find_involute_angle (bc, r) #if (r/bc >= 1) acos(bc/r) #else 0 #end #end #macro find_angle(bc, r) #if (r/bc >= 1) involute_point().v #else 0 #end #end #macro scale_point (r_theta) < (fake_th*(pd+(r_theta.u-pd)*cos(back_cone_angle))) /(th-(r_theta.u-pd)*sin(back_cone_angle)), r_theta.v> #end #local end_angle = (find_involute_angle (1, 1.2)); #local step = end_angle / 10; //#local i = 0; //#while (i <= end_angle) //#local i = i + step; //sphere { make_3d_point(rotate_point(involute_point(<1,i>), 0)), .003 pigment { color rgb < 0, 1, 1> } } //#end camera { // fisheye angle .02 // orthographic // up <0,3,0> // right<0,6,0> location <0, 2000, 1> look_at <0, 0, 1> } light_source { <0, 30, 10> color rgb <1, 1, 1> } #local th = 1; #local quality_involute = 10; #local pa = 14.5; #local pd = 1; #local mdl = 0.0625; #local n = 32; #local bc = pd * cos(pa*_Pi/180); #local od = pd + mdl; #local rd = pd - 1.157*mdl; #local cp = (2*_Pi)/n; #local pd_cone_angle = atan2(pd,th); #local back_cone_angle = (_Pi/2)-pd_cone_angle; #local lrd = rd-pd; #local fake_th = th-lrd*sin(back_cone_angle); #local fake_rd = pd+lrd*cos(back_cone_angle); #local fake_pd = (fake_th*pd)/th; #local fake_od = scale_point().u; #local fake_bc = scale_point().u; #local involute_begin = (find_involute_angle(bc, rd)); #local involute1_offset = (-find_angle(bc, pd)-(cp/4)); #local involute_length = (find_involute_angle(bc, od)); #local circle_offset_val = (find_angle(bc,od)); #local involute_step = ((involute_length-involute_begin)/(quality_involute)); #local involute2_offset = -(involute1_offset); #render concat("\r\n involute_begin: ", str(involute_begin, 5,5), "") #render concat("\r\n involute1_offset: ", str(involute1_offset,5,5), "") #render concat("\r\n involute_length: ", str(involute_length,5,5), "") #render concat("\r\n circle_offset_val: ", str(circle_offset_val,5,5), "") #render concat("\r\n involute_step: ", str(involute_step,5,5), "") #render concat("\r\n involute2_offset: ", str(involute2_offset,5,5), "\r\n") //#declare angle_to_turn = (involute2_offset-(find_angle(bc, pd)))*180/_Pi; prism { linear_spline conic_sweep 0, fake_th, (quality_involute*2+2 +4) #local current_pigment = <0, 0, 1>; #local numbers = (quality_involute*2+2 +4); #local color_offset = <0, (1/numbers), -(1/numbers)> // -------------------- left involute #local i = 0; #while (i < quality_involute) #local i = i + 1; #local theta = i*involute_step;//+involute_begin; #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point(rotate_point(involute_point(), involute1_offset))), //.003 pigment { color rgb current_pigment } } #end // -------------------- outer points #local theta = involute1_offset+circle_offset_val; #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), // .003 pigment { color rgb current_pigment } } #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), // .003 pigment { color rgb current_pigment } } #local theta = -(involute1_offset+circle_offset_val); #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), //.003 pigment { color rgb current_pigment } } // -------------------- right involute #local i = quality_involute; #while (i >= 0) #local theta = i*(involute_step+involute_begin); #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point(rotate_point(involute_point(),involute1_offset)))*<-1,1>, //*<-1,1,1> //.003 pigment { color rgb current_pigment } } #local i = i - 1; #end // -------------------- inside points #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), //.003 pigment { color rgb current_pigment } } #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()) //.003 pigment { color rgb <0,1,0> } translate <0,-.00001,0> } // test //} #local _Pi = 3.141592654; #local scale_factor = 1000; #macro involute_point (r_theta) #end //#macro make_2d_point (r_theta) #end #macro make_2d_point (r_theta) #end //#macro make_3d_point (r_theta) #end #macro make_3d_point (r_theta) #end #macro rotate_point (r_theta, _angle) #end #macro find_involute_angle (bc, r) #if (r/bc >= 1) acos(bc/r) #else 0 #end #end #macro find_angle(bc, r) #if (r/bc >= 1) involute_point().v #else 0 #end #end #macro scale_point (r_theta) < (fake_th*(pd+(r_theta.u-pd)*cos(back_cone_angle))) /(th-(r_theta.u-pd)*sin(back_cone_angle)), r_theta.v> #end #local end_angle = (find_involute_angle (1, 1.2)); #local step = end_angle / 10; //#local i = 0; //#while (i <= end_angle) //#local i = i + step; //sphere { make_3d_point(rotate_point(involute_point(<1,i>), 0)), .003 pigment { color rgb < 0, 1, 1> } } //#end camera { // fisheye angle .02 // orthographic // up <0,3,0> // right<0,6,0> location <0, 2000, 1> look_at <0, 0, 1> } light_source { <0, 30, 10> color rgb <1, 1, 1> } #local th = 1; #local quality_involute = 10; #local pa = 14.5; #local pd = 1; #local mdl = 0.0625; #local n = 32; #local bc = pd * cos(pa*_Pi/180); #local od = pd + mdl; #local rd = pd - 1.157*mdl; #local cp = (2*_Pi)/n; #local pd_cone_angle = atan2(pd,th); #local back_cone_angle = (_Pi/2)-pd_cone_angle; #local lrd = rd-pd; #local fake_th = th-lrd*sin(back_cone_angle); #local fake_rd = pd+lrd*cos(back_cone_angle); #local fake_pd = (fake_th*pd)/th; #local fake_od = scale_point().u; #local fake_bc = scale_point().u; #render concat("\r\n quality_involute: ", str(involute_begin, 5,5), "") #render concat("\r\n pa: ", str(involute1_offset,5,5), "") #render concat("\r\n pd: ", str(involute_length,5,5), "") #render concat("\r\n mdl: ", str(circle_offset_val,5,5), "") #render concat("\r\n n: ", str(involute_step,5,5), "") #render concat("\r\n involute2_offset: ", str(involute2_offset,5,5), "\r\n") #local involute_begin = (find_involute_angle(bc, rd)); #local involute1_offset = (-find_angle(bc, pd)-(cp/4)); #local involute_length = (find_involute_angle(bc, od)); #local circle_offset_val = (find_angle(bc,od)); #local involute_step = ((involute_length-involute_begin)/(quality_involute)); #local involute2_offset = -(involute1_offset); #render concat("\r\n involute_begin: ", str(involute_begin, 5,5), "") #render concat("\r\n involute1_offset: ", str(involute1_offset,5,5), "") #render concat("\r\n involute_length: ", str(involute_length,5,5), "") #render concat("\r\n circle_offset_val: ", str(circle_offset_val,5,5), "") #render concat("\r\n involute_step: ", str(involute_step,5,5), "") #render concat("\r\n involute2_offset: ", str(involute2_offset,5,5), "\r\n") prism { linear_spline linear_sweep 0, fake_th, (quality_involute*2+2 +4) #local current_pigment = <0, 0, 1>; #local numbers = (quality_involute*2+2 +4); #local color_offset = <0, (1/numbers), -(1/numbers)> // -------------------- left involute #local i = 0; #while (i < quality_involute) #local i = i + 1; #local theta = i*involute_step;//+involute_begin; #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point(rotate_point(involute_point(), involute1_offset))), //.003 pigment { color rgb current_pigment } } #end // -------------------- outer points #local theta = involute1_offset+circle_offset_val; #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), // .003 pigment { color rgb current_pigment } } #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), // .003 pigment { color rgb current_pigment } } #local theta = -(involute1_offset+circle_offset_val); #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), //.003 pigment { color rgb current_pigment } } // -------------------- right involute #local i = quality_involute; #while (i >= 0) #local theta = i*(involute_step+involute_begin); #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point(rotate_point(involute_point(),involute1_offset)))*<-1,1>, //*<-1,1,1> //.003 pigment { color rgb current_pigment } } #local i = i - 1; #end // -------------------- inside points #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()), //.003 pigment { color rgb current_pigment } } #local current_pigment = current_pigment + color_offset; //sphere { make_2d_point(scale_point()) //.003 scale <1/scale_factor,1,1/scale_factor> pigment { color rgb <0,0,1> } translate <0,0,0> } // test //} cylinder { <0,0,0>, <0,-.1,0>, make_2d_point(scale_point()).v scale <1/scale_factor,1,1/scale_factor> pigment { color rgb <1, 0, 0> } }