POV-Ray : Newsgroups : povray.unofficial.patches : Photons and Laser Beams : Re: Photons and Laser Beams Server Time
2 Sep 2024 22:17:37 EDT (-0400)
  Re: Photons and Laser Beams  
From: Ron Parker
Date: 9 Jun 1999 13:18:03
Message: <375ea1cb@news.povray.org>
On Wed, 09 Jun 1999 07:30:49 -0700, Ken wrote:
>  Thanks for the tip. I doubt I will use the "Super Patch" as the new version
>is still unavailable and my need for completing this in a timely manner is
>great. My much older (12/98), outdated, and inefficient version of the "Super
>Patch" is corrupt so no longer works plus it is not available anywhere on the
>net for download. I asked yesterday when I could have a copy of the new version
>of the "Super Patch" and was told to "bugger off" (so to speak :).

You were not.  I was joking, as I thought you were.  Furrfu.  I really
don't know when it will be online, it depends heavily on what else is 
going on in my life.  Nevertheless, every time I mention it I get asked
when it's going to be back online, despite the fact that I've said more
than once that I really don't know. 

If you're intersecting a ray with a planar mirror, trace isn't really 
necessary because the operation is so simple.  Here's a macro to find 
it, borrowed somewhat from the POV source.

#macro IntersectPlane( _PlaneNormal, PlaneOffset, RayInitial, _RayDirection )
  #local PlaneNormal=vnormalize(_PlaneNormal+<0,0,0>);
  #local RayDirection=vnormalize(_RayDirection+<0,0,0>);
  #local NormalDotDirection = vdot(RayDirection, PlaneNormal);
  #if ( abs(NormalDotDirection) < 0.00001 )
    #error "Ray parallel to mirror"
  #end
  #local NormalDotOrigin = vdot( RayInitial, PlaneNormal );
  #local Depth=(PlaneOffset - NormalDotOrigin) / NormalDotDirection;
  RayInitial+Depth*RayDirection
#end

Of course, this assumes you haven't done anything with the mirror, like
rotating or scaling it.  If you've done that, you'll have to fix the 
normal and offset appropriately.

Translate is 
  #declare Offset=Offset+(Normal*Translation);

Rotate is trickier - you have to multiply the normal vector by the 
transpose of the rotation matrix.  If you rotate before you translate, 
though (and you probably will) you can no doubt find an easier way to
find the new normal.  Hope this all helps.


Post a reply to this message

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