POV-Ray : Newsgroups : povray.general : Shooting rays Server Time
29 Jul 2024 04:17:24 EDT (-0400)
  Shooting rays (Message 1 to 4 of 4)  
From: Thomas de Groot
Subject: Shooting rays
Date: 9 Mar 2013 08:11:35
Message: <513b3507@news.povray.org>
I have a container A (not at the origin) and, inside this container, an 
object B at a random location. Using trace() I want to determine what is 
the closest distance between B and the boundary of A in the X-Z plane, 
and use the normal of A at that (approximate) location to 
Reorient_Trans() B.

My main problem is shooting rays around from B as I have trouble 
rotating the ray direction vector around the local Y-axis. I experiment 
with vaxis_rotate() but do not get consistent results as it seems that 
the axis (always?) passes through the origin.

How should I write this code?

Thanks!

Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: Shooting rays
Date: 9 Mar 2013 10:20:53
Message: <513b5355$1@news.povray.org>
I may have found the solution. See sample file in p.b.s-f

Thomas


Post a reply to this message

From: scott
Subject: Re: Shooting rays
Date: 11 Mar 2013 04:15:08
Message: <513d928c@news.povray.org>
> I have a container A (not at the origin) and, inside this container, an
> object B at a random location.

Are there any limitations on the shape of A and B, or could they be 
anything?

> Using trace() I want to determine what is
> the closest distance between B and the boundary of A in the X-Z plane,

Do you mean from some centre point of B, or from the surface of B? What 
I think you want is the shortest line connecting the surface of A and B 
that is in a plane parallel to the XZ plane? Is that right? That doesn't 
sound trivial to me.

> My main problem is shooting rays around from B as I have trouble
> rotating the ray direction vector around the local Y-axis. I experiment
> with vaxis_rotate() but do not get consistent results as it seems that
> the axis (always?) passes through the origin.

I'm not sure exactly what you're trying (haven't analysed your code) but 
you can always translate to the origin, rotate, then translate back 
again to rotate around a specific axis.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Shooting rays
Date: 11 Mar 2013 04:57:58
Message: <513d9c96@news.povray.org>
On 11-3-2013 9:15, scott wrote:
> Are there any limitations on the shape of A and B, or could they be
> anything?

They can be anything.

> I'm not sure exactly what you're trying (haven't analysed your code) but
> you can always translate to the origin, rotate, then translate back
> again to rotate around a specific axis.
>

In fact, as the code in p.b.s-f shows, I solved the problem to my 
satisfaction as further tests have shown me. Implementation is in a new 
Urbanism scene. Thanks for you comments though :-)

Thomas


Post a reply to this message

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