|
|
Ok, I've been trying to reproduce the stereographic image on:
http://xahlee.info/3d/illus_geometry.html
I got my sphere made up of a grid formed by rings originating at the
"north pole" of the sphere, and radiating outwards from there in 2 fans,
one rotating along the z-axis, and one along the x-axis.
Got my light source near the North pole.
Got my transparent square to fill a space in the grid.
I cannot for the life of me figure out why my cylinders do not line up
with the intersection points on the grid. The farther they're rotated,
the more they are off. I've checked, and double checked, and quintuple
checked, and only rendered parts of the scene, and even switched to an
orthographic camera to eliminate any visual confusion arising from
perspective / optical illusions.
Maybe I'm old, maybe I'm tired, maybe I'm just geometrically incapable.
I dunno.
It seems to me that if I take a box that's centered on the origin,
rotate it, and translate it by y* the radius of the sphere, and then
take a cylinder that originates at the origin and extends downwards, and
perform the same operations, that they should be aligned.
But they are not. And I can't figure out why. :(
SDL:
-----------------------------------------------------------------------
#declare Size = 100;
#declare Height = 100;
#declare Spacing = 300;
#declare Axis = 2;
light_source { < 0, Height + 95, -150>, rgb <1,1,1>}
#declare Axes = union {
cylinder {<0, 0, 0>, <Size, 0, 0>, Axis texture {pigment {color Red}
finish {ambient 0.5} } }
cylinder {<0, 0, 0>, <0, Size, 0>, Axis texture {pigment {color Green}
finish {ambient 0.5} } }
cylinder {<0, 0, 0>, <0, 0, -Size>, Axis texture {pigment {color Yellow}
finish {ambient 0.5} } }
}
camera { orthographic location <0, Height, -500> look_at <0, Height/2,
-50> }
//####################################################################################
#declare WIP = union { //object {Axes}
#declare Radius = 100;
#declare Thickness = 1;
#declare Step = 5;
sphere {<0,0,0>, 100 pigment {rgbf <1, 1, 0, 0.9>} }
/*
// "x axis" grid
#declare Loop = -18;
#while (Loop <= 18 )
intersection {
difference {
sphere {<0,0,0>, Radius }
sphere {<0,0,0>, Radius-Thickness }
}
box { <-Thickness/2, -300, -200>, <Thickness/2, 0, 200> rotate
z*Loop*Step translate y*Radius }
pigment {rgbf <0, 0, 1, 1>}
}
#declare Loop = Loop + 1;
#end
// "z axis" grid
#declare Loop = -18;
#while (Loop <= 18 )
intersection {
difference {
sphere {<0,0,0>, Radius }
sphere {<0,0,0>, Radius-Thickness }
}
box { <-200, -300, -Thickness/2>, <200, 0, Thickness/2> rotate
x*Loop*Step translate y*Radius }
pigment {rgbf <1, 0, 0, 1>}
}
#declare Loop = Loop + 1;
#end
*/
// Lines and transparent square
#declare Color1 = rgb <0, 1, 0>;
#declare Corner1 = 0; // z
#declare Corner2 = 15; // x (+ = toward camera, - = away)
// boxes for comparison
union {
box { <-Thickness/2, -Radius*3, -Radius>, <Thickness/2, Radius*3,
Radius> rotate z* Corner1 *Step translate y*Radius }
box { <-Thickness/2, -Radius*3, -Radius>, <Thickness/2, Radius*3,
Radius> rotate z*(Corner1+1)*Step translate y*Radius }
//box { <-Radius*2, -Radius*3, -Thickness/2>, <Radius*2, Radius*3,
Thickness/2> rotate x* Corner2 *Step translate y*Radius }
//box { <-Radius*2, -Radius*3, -Thickness/2>, <Radius*2, Radius*3,
Thickness/2> rotate x*(Corner2+1)*Step translate y*Radius }
pigment {rgbf <0.9, 0.9, 0.9, 1>}
}
cylinder { <0, 0, 0>, <0, -Radius*2, 0>, Thickness/2 rotate z*
Corner1*Step rotate x* Corner2 *Step translate y*Radius texture
{pigment {Color1} finish {ambient 0.7} } no_shadow}
cylinder { <0, 0, 0>, <0, -Radius*2, 0>, Thickness/2 rotate
z*(Corner1+1)*Step rotate x* Corner2 *Step translate y*Radius texture
{pigment {Color1} finish {ambient 0.7} } no_shadow}
cylinder { <0, 0, 0>, <0, -Radius*2, 0>, Thickness/2 rotate z*
Corner1*Step rotate x*(Corner2+1)*Step translate y*Radius texture
{pigment {Color1} finish {ambient 0.7} } no_shadow}
cylinder { <0, 0, 0>, <0, -Radius*2, 0>, Thickness/2 rotate
z*(Corner1+1)*Step rotate x*(Corner2+1)*Step translate y*Radius texture
{pigment {Color1} finish {ambient 0.7} } no_shadow}
difference {
sphere {<0,0,0>, Radius }
sphere {<0,0,0>, Radius-Thickness }
box { <-Radius*2, -Radius*3, -Radius*2>, <-Thickness/2, Radius*3,
Radius*2> rotate z* Corner1 *Step translate y*Radius }
box { < Radius*2, -Radius*3, -Radius*2>, < Thickness/2, Radius*3,
Radius*2> rotate z*(Corner1+1)*Step translate y*Radius }
box { <-Radius*2, -Radius*3, Radius*2>, <Radius*2, Radius*3,
Thickness/2> rotate x* Corner2 *Step translate y*Radius }
box { <-Radius*2, -Radius*3, -Radius*2>, <Radius*2, Radius*3,
-Thickness/2> rotate x*(Corner2+1)*Step translate y*Radius }
pigment {Color1 filter 1}
}
} // end WIP
//####################################################################################
// Plot objects
object {WIP translate <0, Height, -150> }
Post a reply to this message
|
|