|
|
I need this for tomorrow, for a speech on computers. I want to have a model
of a mouse for illustrative purposes. I've made a CSG of what it looks like
from above and from the side, and intersected those to form the basic shape.
I want to round the edges of the top part. I've got a while-loop that almost
does it, but for some reason, things don't quite line up. Please help me.
Thanks in advance!
//a computer mouse
//anthony bennett
//december 2, 2001
#default {pigment {rgb 1} finish {ambient 0 diffuse 1}}
#macro SIGN(NUM)
#if (NUM>=0) 1 #else -1 #end
#end
global_settings {ambient_light 0 assumed_gamma 1}
camera {location <1,1,-1>*5 look_at 0}
light_source {<-1,2,-1>*15 1}
sky_sphere {pigment {rgb z}}
#declare X_View =
difference
{
cylinder {-x*2,x*2,2}
plane {y,0.5}
plane {-z,0 translate z*1.0}
plane {z,0 translate -z*1.5}
translate <0,-0.5,0.25>
scale <1.25,1,1/1.25*2.8>
}
#declare Y_View =
union
{
difference
{
cylinder {-y,y*2,1 scale <1.25,1,2.55>}
plane {z,0}
translate z*0.25
}
box {<-1.25,-1,-0.25>,<1.25,2,0.25>}
difference
{
cylinder {-y,y*2,1 scale <1.25,1,2.55>}
plane {-z,0}
translate -z*0.25
}
}
#declare Rounding = 0.1;
#declare Small_Y_View =
union
{
difference
{
cylinder {-y*2,y*3,1 scale <1.25-Rounding,1,2.55-Rounding>}
plane {z,0}
translate z*0.25
}
box {<-1.25+Rounding,-2,-0.25>,<1.25-Rounding,3,0.25>}
difference
{
cylinder {-y*2,y*3,1 scale <1.25-Rounding,1,2.55-Rounding>}
plane {-z,0}
translate -z*0.25
}
}
difference
{
intersection
{
object {X_View}
object {Small_Y_View}
}
object {X_View translate -y*Rounding}
}
#declare Y_R = 2;
#declare Y_Start_Z = 1;
#declare Y_End_Z = -1.5;
#declare Start_Y = sqrt(Y_R^2-Y_Start_Z^2);
#declare End_Y = sqrt(Y_R^2-Y_End_Z^2);
#declare Start_A = -degrees(asin(Start_Y/Y_R));
#declare End_A = degrees(asin(End_Y/Y_R));
union
{
#declare B = Start_A;
#while (B<=End_A)
#declare PosY = (vrotate(y*2,x*B)+<0,-0.5,0.25>)*<1.25,1,1/1.25*2.8>;
#switch(PosY.z)
#range(-2.8,-0.25)
#declare Pos1X = sqrt(1-(PosY.z/2.8)^2)*(1.25-Rounding);
#declare Pos1 = < Pos1X,PosY.y-Rounding,PosY.z-Rounding*SIGN(PosY.z)>;
#declare Pos2 = <-Pos1X,PosY.y-Rounding,PosY.z-Rounding*SIGN(PosY.z)>;
sphere {Pos1,Rounding}
sphere {Pos2,Rounding}
#break
#range(-0.25,0.25)
#declare Pos1 = <
1.25-Rounding,PosY.y-Rounding,PosY.z-Rounding*SIGN(PosY.z)>;
#declare Pos2 =
<-1.25+Rounding,PosY.y-Rounding,PosY.z-Rounding*SIGN(PosY.z)>;
sphere {Pos1,Rounding}
sphere {Pos2,Rounding}
#break
#range(0.25,2.8)
#declare Pos1X = sqrt(1-(PosY.z/2.8)^2)*(1.25-Rounding);
#declare Pos1 = < Pos1X,PosY.y-Rounding,PosY.z-Rounding*SIGN(PosY.z)>;
#declare Pos2 = <-Pos1X,PosY.y-Rounding,PosY.z-Rounding*SIGN(PosY.z)>;
sphere {Pos1,Rounding}
sphere {Pos2,Rounding}
#break
#end
#declare B = B + 0.01;
#end
}
Post a reply to this message
|
|