POV-Ray : Newsgroups : povray.newusers : Access to height field data : Re: Access to height field data Server Time
28 Jul 2024 20:27:41 EDT (-0400)
  Re: Access to height field data  
From: Alain
Date: 18 Oct 2008 11:14:41
Message: <48f9fd61$1@news.povray.org>
Kenneth nous illumina en ce 2008-10-15 00:35 -->
> Warp <war### [at] tagpovrayorg> wrote:
>> jan dvorak <jan### [at] centrumcz> wrote:
>>> What if the trace misses the object?
>>   The returned normal vector will be zero.
>>
>> --
>>                                                           - Warp
> 
> .......and your traced-on object will be placed at <0,0,0> by default. Without
> some kind of 'escape' mechanism, you might end up with *lots* of objects there.
> The standard way to keep that from happening is to do this before actually
> making or calling an object:
> 
> #if(vlength(norm) != 0) // that's "not equal to zero"
> object{my_object translate <...the traced location...>}
> #else
> // DON'T make an object
> #end
> 
> If the trace 'ray' goes off your height_field (or whatever), norm will be
> <0,0,0> -- and vlength of that will be zero. Very handy!
> 
> KW
> 
> 
> 
> 
> 
> 
> I prefer to simply use:
#if(vlength(Norm))
...
#end

Any non-zero value evaluate as true.
No need for the empty #else.

-- 
Alain
-------------------------------------------------
To the world you may be one person, but to one person you may be the world.


Post a reply to this message

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