|
|
On Mon, 30 Oct 2000 08:18:34 +0200, Peter Popov <pet### [at] usanet>
wrote:
>>Now, I keep tripping over these silly little spheres and boxes.
>
>Try using arrows made of cylinders and cones. I think there's a sample
>scene included with POV-Ray and/or an item in the Insert menu in the
>Windows version.
Unfortunately, this method leads to the same problem as the spheres
and boxes. It creates shapes that distract from the object I'm
working on...
>
>>Now, I'm trying to do this with text. (I find the little Xs, Ys and
>>Zs less distracting...) Unfortunately, the letters are just a bit
>>hard to read except from directly in front or back. I've managed to
>>find a little macro using atan() that allows me to aim objects at a
>>focal point. (Someone on the POV-Ray Study Forum at Delphi worked it
>>out for aiming eyeballs...) Problem is that it doesn't work if the
>>camera (and focal point) are on the Z plane and things seem to forget
>>where to look if I get near the Y axis.
>>
>>Anybody got ideas?
>
>Try using John VanSickle's Reorient macro, part of his Throroughly
>Useful Macros package. There's a link to his site on the povray.org
>link section.
This method still requires that I work out the axes to point the
letters along. I think I've got this worked out now. But I keep
finding that things like to point the wrong way. I'm starting to
think that, maybe, there's a bug someplace in PoV...
I've created a little sample scene to test the algorithm and it's
giving me odd results.
The following bit of code draws the axes and places a little yellow
ball at the position indicated by HereItIs. Then it draws a line
starting at the origin and running through HereItIs. I haven't quite
worked out how to deal with the ball sitting on the X, Y or Z axis,
but it tells me the angles are right for all other cases. Just
doesn't seem to draw the line there...
-------------------------------------------------
example code:
-------------------------------------------------
#include "colors.inc"
#include "macs.inc"
#declare ViewPoint = <50, -50, -50> ;
camera { location ViewPoint look_at <0, 0, 0> }
////////////////////// Draw the axes /////////////////////
sphere {<0,0,0>,1
pigment { White } finish { ambient 1 } }
cylinder {<-49,0,0>,<49,0,0>,.05
pigment { Red } finish { ambient 1 } }
cylinder {<0,-49,0>,<0,49,0>,.05
pigment { Green } finish { ambient 1 } }
cylinder {<0,0,-49>,<0,0,49>,.05
pigment { Blue } finish { ambient 1 } }
//////////////////////////////////////////////////////////////////
#macro LookHere(from_pos, to_pos)
#local Dx = to_pos.x - from_pos.x * sgn(to_pos.x) ;
#local Dy = to_pos.y - from_pos.y * sgn(to_pos.y) ;
#local Dz = to_pos.z - from_pos.z * sgn(to_pos.z) ;
#if (Dy)
#local Ax = degrees(atan2(Dz,Dy)) ;
#else
#local Ax = 0 ;
#end
#if (Dz)
#local Ay = degrees(atan2(Dx,Dz)) ;
#else
#local Ay = 0 ;
#end
#if (Dx)
#local Az = degrees(atan2(Dy,Dx)) ;
#else
#local Az = 0 ;
#end
#render concat("Dx: ",str(Dx, 5, 2),"\n",
"Dy: ",str(Dy, 5, 2),"\n",
"Dz: ",str(Dz, 5, 2),"\n")
#render concat("Ax: ",str(Ax, 10, 7),"\n",
"Ay: ",str(Ay, 10, 7),"\n",
"Az: ",str(Az, 10, 7),"\n\n")
Reorient(y,<Ax,Ay,Az>)
#end
#declare HereItIs = <10,15,10> ;
sphere {HereItIs,1 pigment { Yellow } finish { ambient 1 } }
cylinder {<0,0,0>,<0,45,0>.1
pigment { Orange } finish { ambient 1 }
LookHere(<0,0,0>,HereItIs) }
Post a reply to this message
|
|