POV-Ray : Newsgroups : povray.newusers : Shoot a ray at a mesh : Re: Shoot a ray at a mesh Server Time
28 Jul 2024 22:23:56 EDT (-0400)
  Re: Shoot a ray at a mesh  
From: Alain
Date: 8 Jun 2008 00:01:22
Message: <484b5992$1@news.povray.org>
Kenneth nous illumina en ce 2008-06-07 13:07 -->
> "Chris B" <nom### [at] nomailcom> wrote:
>> "daviddoria" <nomail@nomail> wrote in message
>> news:web.4849a25ff5d589ac145cec320@news.povray.org...
> 
>> #declare MyStart = <1, 1, 1>;
>> #declare MyDirection =  <0, 0, 0> - MyStart;
> 
> The resulting MyDirection vector in this case would be <-1,-1,-1>...kind of an
> odd direction in which to shoot a trace ray, *assuming* that the mesh occupies
> some area on an x/z plane...i.e., horizontal. Far better would be to shoot the
> trace ray straight 'down.'
> 
> Let's assume that the mesh extends from <0,0,0> to <1,0,1>--like a POV-Ray
> height_field. Would it not be better to say
> #declare MyStart =
> <*some value between 0 and 1*,100,*some value between 0 and 1*>; // y is just an
> // arbitrary large number, to place it well above the mesh
> 
> #declare MyDirection = <0,-1,0>; // pointing straight down
> 
> OR
> #declare MyDirection = <0,0,0> - <0, MyStart.y,0>; // using dot notation to pick
> // one value out of a vector
> 
> OR
> #declare MyDirection = <0, -MyStart.y,0>;
> 
> These three MyDirection's all all equivalent...but <0,-1,0> is far easier to
> write!
> 
> Ken W.
> 
> 
> 
> 
The proposed solution allows you to shoot the ray from some arbitrary location 
toward an object centered around the origin. There is nothing in the original 
post that even remotely suggest that the mesh may be planar.
In fact, Dave question explicitly ask fro a trace from some arbitrary location 
directed at the mesh, without any information about it's location.

If the mesh is NOT around the origin, you can use max_extend(Object) and 
min_extent(object) to get the location of it's bounding box. You can then shoot 
your tracing ray at that bounding box.

-- 
Alain
-------------------------------------------------
Either write something worth reading or do something worth writing.
Benjamin Franklin


Post a reply to this message

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