#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 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.03125; #local n = 64; #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 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 texture { pigment { color rgb <0,0,1> } finish { ambient .6 } } translate <0,0,0> } // test //} #local _Pi = 3.141592654; #macro involute_point (_r_theta) <_r_theta.u/cos(_r_theta.v), tan(_r_theta.v)-_r_theta.v> #end #macro make_2d_point (_r_theta) <_r_theta.u*sin(_r_theta.v), _r_theta.u*cos(_r_theta.v)> #end #macro make_3d_point (_r_theta) <_r_theta.u*sin(_r_theta.v), 0, _r_theta.u*cos(_r_theta.v)> #end #macro rotate_point (_r_theta, _angle) <_r_theta.u, _r_theta.v + _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(<_bc, acos(_bc/_r)>).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 #local _th = 1; #local _quality_involute = 10; #local _pa = 14.5; #local _pd = 1; #local _mdl = 0.03125; #local _n = 64; #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(<_od,0>).u; #local _fake_bc = scale_point(<_bc,0>).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(<_bc,_theta>), _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(<_od,_theta>)), // .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(<_od,_theta>)), //.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(<_bc,_theta>),_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(<_rd,_involute2_offset>)), //.003 pigment { color rgb current_pigment } } #local _current_pigment = _current_pigment + _color_offset; //sphere { make_2d_point(scale_point(<_rd,_involute1_offset>)) //.003 texture { pigment { color rgb <0,1,0> } finish { ambient .6 } } //scale <.9513525,1,.9513525> translate <0,-0.000001,0> } // test //} //scale_point(, 100 pigment { color rgb <1, 1, 1> } } camera { // fisheye angle .03 // location <2000, 1, 1> // location <0, 2000, 1> // // location <0, 2000, 1> // look_at <0,0,0> location make_3d_point()+<0,2000,0> look_at make_3d_point() }