POV-Ray : Newsgroups : povray.general : distance pattern ? : Re: distance pattern ? Server Time
18 Nov 2024 21:22:17 EST (-0500)
  Re: distance pattern ?  
From: Rafal 'Raf256' Maj
Date: 9 Jul 2002 23:01:00
Message: <Xns92473277261A7raf256com@204.213.191.226>
Warp <war### [at] tagpovrayorg> wrote in news:3d2b8f5f@news.povray.org:

>> realy couldn't find one thing in manual... there AFAIR was some
>> pattern (used i.e. in media) that value in <x,y,z> was equal to
>> distance beetwen <x,y,z> and some object
>   If there would be a fast way of determining the distance of a point
>   from 
> the surface of an object, that would be more or less a holy grail of
> raytracing. (Among other things it would allow you to create an
> isosurface identical to any given object and then just transform it
> non-linearly.) 
 
>   The sad fact is that there's no generic way of calculating this
>   distance 
> fast and accurately for any given object.
>   The patch you are referring to _approximated_ the distance by
>   shooting 

is this future available in Pov 3.5 and what is it's name ?

> many rays towards the object and taking the one which hit the object
> at closest distance. Of course this has two drawbacks: It's not very
> accurate (usually introduces bad graininess) and it's very slow.

Well - it should be easy to optimize it :) 
if you do NOT need information about normal of object, but only of 
distance, why not add future like

pixelized {
  object ...
  100,100,100
}

that will create 100x100x100 bits arrar - informing is some point inside 
object or not. In addition - it will be very fast to use, and object size 
(maybe speed) can be optimized using binary trees (or something simmilar).

For 'pixelized' object (as well as for some primitives) functions 
returining distance from <x,y,z> to object will be very fast.

I can implement it, in fact I would be heapy to, but I need little help - I 
realy do NOT like modyfing somones other code, especialy when its so big 
and complex as Pov's source. So I will write individual program realizating  
this algorith and if You will like it - maybe somebody will actualy use it 
in Pov.

How code should look to be easy to link with Pov ? 
My suggestion - program wil
Use functions of PovRay :
bool Inside(int x,int y,in z); // is point inside of some object

Give functions 
void BuildTab(); // build i.e. 100x100x100 array
void FreeTab(); // free
double Distance(float x,float y,float z); // distance from point to
  // object

I can alsow ofcourse implement above for sphere,box,cone,torus and maybe 
few other primitives


-- 


Post a reply to this message

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