POV-Ray : Newsgroups : povray.pov4.discussion.general : Next Generation SDL Brainstorming : Re: Next Generation SDL Brainstorming Server Time
1 Jun 2024 10:38:09 EDT (-0400)
  Re: Next Generation SDL Brainstorming  
From: clipka
Date: 9 Apr 2009 06:30:01
Message: <web.49ddcdbcad594047b06defeb0@news.povray.org>
Chambers <ben### [at] pacificwebguycom> wrote:
> #declare my_obj = object { ... }
> #declare v_orig = <...>;
> #declare v_dir = <...>;
> #declare intersection = <0,0,0>;
> #declare norm = <0,0,0>;
> #declare intersection = trace(my_obj, v_orig, v_dir, norm)
>
> #declare hit = false;
> #if (intersection.x != 0) #declare hit = true; #end
> #if (intersection.y != 0) #declare hit = true; #end
> #if (intersection.z != 0) #declare hit = true; #end

Why not instead use

  #declare hit = (vlength(intersection) > 0);

Or, as we're being on it, do the proper thing and test for the normal instead of
the intersection point (which *could* happen to be <0,0,0> after all):

  #declare hit = (vlength(norm) > 0);


Post a reply to this message

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