POV-Ray : Newsgroups : povray.programming : Which code evaluate Math functions (ie: isosurfaces) ? : Re: Which code evaluate Math functions (ie: isosurfaces) ? Server Time
27 Apr 2024 08:19:50 EDT (-0400)
  Re: Which code evaluate Math functions (ie: isosurfaces) ?  
From: virtualmeet
Date: 15 Feb 2007 01:20:00
Message: <web.45d3fa8ff1edfe3e237102430@news.povray.org>
Ben Chambers <ben### [at] pacificwebguycom> wrote:
> I agree, using all applicable knowledge of a shape can lead to amazing
> speed improvements.  However, it's not the kind of thing which has been
> traditionally possible to teach a computer to do, as each situation is
> highly unique.  And your voxel array certainly doesn't add anything in
> terms of geometric analysis, other than approximation.
Hi,
I confirm you that I'm not doing any approximation and that teaching
computer to take advantage from the geometrical shape is much more easy
than it looks like...
Take an object in 3D space, we have three axes X,Y and Z.
Imagine that for every axe, we can make another one parallel to it (say X1,
Y1 and Z1), that holds vules from an UNARY fct g :
g : X[] ==> X1[]
     x  ==> x' = g(x)

g : Y[] ==> Y1[]
     y  ==> y' = g(y)

g : Z[] ==> Z1[]
     z  ==> z' = g(z)

suppose now that we have to compute an isosurface f(x,y,z) = cos(x) + cos(y)
+ cos(z).
If we define g(u) = cos(u), then our isosurface f can be changed to this :
F(x, y, z, x', z', z') = x' + y' + z'.

Isosurfaces f and F are exactly the same and have the same final shape and
there is no approximation in the final shape made by F. However, F is much
more faster to compute than f because it's only made by 2 additions of 3
varibles where f is  a dumb calculation of 3 cosinus and 2 additions for
the ENTIRE 3D grid.
As you can see, all unary defined fct can be changed to a new variables and
used as this by the new parser.
In the same way, Binary fcts are changed to variables defined in "a plan"
rather than a simple axe : Binary fcts are more demanding in term of memory
requirements but they still computed as fast as unary fcts by the new
parser.

Example :
  f(x,y,z) = x*exp(-x^2-y^2) -z

  Changed to :

   g : X[]*Y[] ===> XY[]
          (x,y)===> v = x*exp(-x^2-y^2)

 finally, now we have "only" to compute : F(x,y,z,v) = v -z

All this variables changes are made possible for use by the parser because
of it's ability to exploit the geometry of the object it's using: That's
why I'm calling it the "geometrical parser".
If you think that it's use is very limited, then think about it again...
I'm now using an implementation that let you define up to 3 unary fcts and
up to 3 binary fcts: That's more than what I need to accelerate
calculations of 100% of my examples.
I hope that I made myself clear to you and in any ways thanks for your
comments and suggestions.
Cheers,
Taha


Post a reply to this message

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