|
|
Bald Eagle <cre### [at] netscapenet> wrote:
> 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. :(
No need to lose your mind :)
I didn't try to debug your code, but I do have an alternate solution: use
trace() to project the plane's grid points onto the globe.
// ------- code -------
plane{y, 0 pigment{rgb .5}}
#declare SP = <0, 7, 0>; // sphere position
#declare SS = 4; // sphere size
#declare NP = SP + y*SS; // north pole
#declare TO = sphere{SP, SS}; // globe for rendering and trace()ing
object{TO pigment{rgb .5}}
sphere{NP, .2 pigment{rgb <1, 1, .1>}}
union{
#local GS = 20;
#for(Z, 0, GS-1)
#for(X, 0, GS-1)
#declare GP = <X, 0, Z>; // grid point
#declare GP = GP - (x+z)*(GS-1)/2; // center the grid
#declare TP = trace(TO, GP, NP-GP); // trace point
sphere{GP, .2} // grid spheres on the plane
sphere{TP, .1} // grid spheres on the globe
#end
#end
pigment{rgb <1, 1, .1>}
}
// ------- ~code -------
Hopefully that example is basic enough to make a good starting point, should you
go that route.
Sam
Post a reply to this message
|
|