POV-Ray : Newsgroups : povray.newusers : TRACE returns a unit-length NORMAL vector : Re: TRACE returns a unit-length NORMAL vector Server Time
29 Jul 2024 14:11:20 EDT (-0400)
  Re: TRACE returns a unit-length NORMAL vector  
From: Skip Talbot
Date: 5 Oct 2005 01:24:28
Message: <4343638c$1@news.povray.org>
Kenneth, doesn't it seem logical, and wouldn't you assume that the 
vectore returned by trace would indeed be a unit length vector?  What 
else would it possibly be?  Although the docs don't specifically mention 
its one unit in length, the sample code demonstrates it quite well. 
Below is the code right out of the docs with a camera and light added. 
You can see that the sphere has a radius of 1, and that just by 
eyeballing it, you can confirm that the trace result is a unit vector by 
seeing that cylinder (the trace normal) appears equal in length to the 
sphere's radius:

#declare MySphere = sphere { <0, 0, 0>, 1 }
#declare Norm = <0, 0, 0>;
#declare Start = <1, 1, 1>;
#declare Inter=
   trace ( MySphere, Start, <0, 0, 0>-Start, Norm );
   object {
     MySphere
     texture {
       pigment { rgb 1}
     }
   }
   #if (vlength(Norm)!=0)
   cylinder {
     Inter, Inter+Norm, .1
     texture {
       pigment {color red 1}
     }
   }
  #end


// create a regular point light source
light_source {
   0*x                  // light's position (translated below)
   color rgb <1,1,1>    // light's color
   translate <-20, 40, -20>
}

// perspective (default) camera
camera {
   location  <3.0, 0.0, -3.0>
   look_at   <0.0, 0.0,  0.0>
   right     x*image_width/image_height
}


Post a reply to this message

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