|
|
I have read and expperimented and read and experimented before, buit I just
can't get thie one. I am using trace to locate an object on the surface of
another. no problem there. However, I can't figure out how to reorient the
object on the surface so that it aligns with the surface normal at the
point of intersection.
Could somebody shopw me a snippet of code that will do this? Somethin simple
like positioning a box on the surface of a sphere will do. I can take it
from there.
Thanks,
Tim
Post a reply to this message
|
|
|
|
If Norm is your normal vector, you have to rotate your traced object like
this in order to orient it:
rotate <degrees (atan2 (Norm.z,Norm.y)), 0, -degrees (atan2
(Norm.x,Norm.y))>
Norbert Kern
Post a reply to this message
|
|
|
|
Norbert Werner Kern wrote:
> If Norm is your normal vector, you have to rotate your traced object like
> this in order to orient it:
>
> rotate <degrees (atan2 (Norm.z,Norm.y)), 0, -degrees (atan2
> (Norm.x,Norm.y))>
>
>
> Norbert Kern
>
>
Personally, I'd let POV do the work.
#include "Transforms.inc"
#include "maths.inc"
#declare N = <0,0,0> // Initial Normal Vector
#declare S = some_location // The initial position of the object to drop
trace(ENV, S, -y, N)
#if(vlength(N)!= 0)
object {
YourObject
texture { whatever }
Reorient_Trans(y,N)
translate S
}
#end
Here's a good tutorial http://povray.tirnalong.com/ow.asp?DropOnSurface
And I'd be glad to post my macro, simple though it is, upon request.
Regards,
A.D.B
Post a reply to this message
|
|