POV-Ray : Newsgroups : povray.general : Re orientation help request Server Time
29 Nov 2024 11:42:06 EST (-0500)
  Re orientation help request (Message 1 to 3 of 3)  
From: Tim McMurdo
Subject: Re orientation help request
Date: 4 Nov 2005 15:40:00
Message: <web.436bc70ea9abf7dacb32c570@news.povray.org>
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

From: Norbert Werner Kern
Subject: Re: Re orientation help request
Date: 4 Nov 2005 16:09:14
Message: <436bcdfa@news.povray.org>
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

From: Anthony D  Baye
Subject: Re: Re orientation help request
Date: 5 Nov 2005 02:33:54
Message: <436c6062$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.