POV-Ray : Newsgroups : povray.general : The Voronoi function and POVray pigments Server Time
19 Nov 2024 12:52:34 EST (-0500)
  The Voronoi function and POVray pigments (Message 1 to 5 of 5)  
From: Sir Charles W  Shults III
Subject: The Voronoi function and POVray pigments
Date: 27 Mar 2002 04:49:29
Message: <3ca195a9$1@news.povray.org>
I just finished doing a little web research on the Voronoi function because
it seems to be so flexible and powerful for creating "pseudo-random" patterns.
What a fascinating bit a reading!  I suppose that anyone who uses POVray and
reads the documentation has come across the term in the description of how the
patterns are derived.  It was enough to get me to read up on the function and
how it works.
    The description went through Delaunay methods of dividing up a set of points
into triangles based on the closest natural neighbors, and how that leads to the
Voronoi function.    In brief, imagine that you have a set of random (or nearly
so) points on a sheet of paper.  Each point has neighbors, and you can evaluate
them to see which three are closest to some arbitrary starting point, then
create a line to each from your original point.  That is basically the DeLaunay
method of tesselating the plane into triangles.
    Well, Voronoi is similar in that you create a polygon around each point that
contains all the points that are closer to that point than to any other point.
In other words, you fence in the area that is closer to your point.  This can be
done using the DeLaunay method.
    What you end up with is something that looks like the crackle pattern- throw
some random points on a plane, set a boundary condition mathematically, and draw
the polygons.  As the POVray documents state, all the patterns like crackle and
bozo are really one and the same, but you can see that the scale of the data is
different, resulting in sharper or more diffuse boundaries.  Add functions like
turbulence and lambda and you can make rocks, clouds, etc.
    If you extend the idea to 3 dimensional space, you end up with space filling
"polytopes" instead of flat polygons.  All you need is a volume with a
scattering of random points through it and a tesselating algorithm.
    Voronoi diagrams are sometimes called "Dirichlet tesselations"- maybe I have
just rambled on enough, but it seems like a fascinating subject to me.  I guess
it has been brought on it part by the fact that I am playing with patterns and
isosurfaces and functions.  Seeing the methods just makes it all more concrete
for me.
    I may have made some mistakes in my understanding or explanations, but I
hope the POV gods will forgive them due to my enthusiasm.  As a peace offering,
here is a rather outrageous function and color map based on simple trig.  Enjoy
it and wrap it around a few things, and be sure to play with the scale and
translation!

#declare G = pigment { function{tan(x*y*z)} };

#declare TanBow = texture {
  pigment {G
    color_map {
      [0.00 Red]
      [0.33 Green]
      [0.66 Blue]
      [1.00 Red]
    }
} }

Cheers!

Chip Shults
My robotics, space and CGI web page - http://home.cfl.rr.com/aichip

light_source{0#macro k(_)sphere{13*z+i*_.5pigment{agate}finish{phong.3}}#end
1}#macro _(s,i,g)#if(s)k(1)k(-1)_(s-1i+g,g)#end#end _(3x+3*y<2,-2>)_(2x,y)_(
2x-y,x)_(4x*3,-y)_(4<3,1>x)_(2x*6,-y)


Post a reply to this message

From:
Subject: Re: The Voronoi function and POVray pigments
Date: 27 Mar 2002 04:59:55
Message: <ol53au4l5egiirb1atkq5val451df5jdie@4ax.com>
On Wed, 27 Mar 2002 04:49:39 -0500, "Sir Charles W. Shults III"
<aic### [at] cflrrcom> wrote:
> I just finished doing a little web research

My Magic Link Wizard translated your post into
http://www.google.com/search?q=DeLaunay+POV+Ray
http://www.google.com/search?q=Voronoi+POV+Ray
http://www.google.com/search?q=Dirichlet+POV+Ray

ABX


Post a reply to this message

From: Hugo
Subject: Re: The Voronoi function and POVray pigments
Date: 27 Mar 2002 14:44:10
Message: <3ca2210a$1@news.povray.org>
Hi Sir Charles,

I read your post with interest, because I've read about DeLaunay
triangulation myself some half year ago. The reason was my attempt to code
such an algoritm in Pov, to reduce the amount of triangles that does not
significantly add to a 3d shape. I had to give up the idea because I'm too
bad in math, and explanations on the net assumed a higher education. It
seems you understand these things pretty well, and you explained them in a
way that I understand.  ;o)

It would be interesting for me to persue this in a way that improves POVs
abilities to make heightfields. I think, the formulas become too complex
when dealing with true 3d shapes. Heightfields are simpler. Now, I'll read
your post again and try to figure out a plan how to go for this project.
Now, I know there are some people here that I can ask for help ... I hope...
:o)   Thanks, and good luck with your journey in the world of isosurfaces!

Regards,
Hugo


Post a reply to this message

From: Ron Parker
Subject: Re: The Voronoi function and POVray pigments
Date: 27 Mar 2002 17:06:37
Message: <slrnaa4gjg.3b0.ron.parker@fwi.com>
On Wed, 27 Mar 2002 04:49:39 -0500, Sir Charles W. Shults III wrote:
>     What you end up with is something that looks like the crackle pattern- throw
> some random points on a plane, set a boundary condition mathematically, and draw
> the polygons.

I would hope so, as the crackle pattern (using the default form, metric, 
etc.) is exactly that: a Voronoi diagram in 3-space.  

-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbf 1}hollow interior{media{emission 3-T}}}#end 
Z(-x-x.2x)camera{location z*-10rotate x*90normal{bumps.02scale.05}}


Post a reply to this message

From: Sir Charles W  Shults III
Subject: Re: The Voronoi function and POVray pigments
Date: 27 Mar 2002 18:41:57
Message: <3ca258c5$1@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Wed, 27 Mar 2002 04:49:39 -0500, Sir Charles W. Shults III wrote:
> >     What you end up with is something that looks like the crackle pattern-
throw
> > some random points on a plane, set a boundary condition mathematically, and
draw
> > the polygons.
>
> I would hope so, as the crackle pattern (using the default form, metric,
> etc.) is exactly that: a Voronoi diagram in 3-space.

   Yes, that is what the next paragraph in my post says:

    If you extend the idea to 3 dimensional space, you end up with space filling
"polytopes" instead of flat polygons.  All you need is a volume with a
scattering of random points through it and a tessellating algorithm.

Cheers!

Chip Shults
My robotics, space and CGI web page - http://home.cfl.rr.com/aichip

light_source{0#macro k(_)sphere{13*z+i*_.5pigment{agate}finish{phong.3}}#end
1}#macro _(s,i,g)#if(s)k(1)k(-1)_(s-1i+g,g)#end#end _(3x+3*y<2,-2>)_(2x,y)_(
2x-y,x)_(4x*3,-y)_(4<3,1>x)_(2x*6,-y)


Post a reply to this message

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