POV-Ray : Newsgroups : povray.general : Trace()? : Re: Trace()? Server Time
7 Aug 2024 05:17:09 EDT (-0400)
  Re: Trace()?  
From: Christoph Hormann
Date: 13 Nov 2001 01:52:02
Message: <3BF0C313.DE3D24B8@gmx.de>
Mahalis wrote:
> 
> Could anyone explain to me exactly how one uses the trace() function to
> detect object collisions? The docs say that 'trace() can be used to detect
> the exact point a ray intersects a surface' and then gives a perfectly
> incomprehensible (to me at least) example.
> 

You will find une in the insert menu:

// trace function tests for intersection with a specified object

#declare Obj = sphere { 0, 1 }
#declare Norm = <0, 0, 0>;
#declare Start = <0.5, 0.5, 1>;
#declare Pos = trace (
                  Obj,             // object to test
                  Start,           // starting point
                  -z,              // direction
                  Norm );          // normal

// if intersection is found, normal differs from 0
#if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
 //...
#end

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

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