POV-Ray : Newsgroups : povray.advanced-users : Density filling option for polygon : Re: Density filling option for polygon Server Time
18 Apr 2024 20:37:36 EDT (-0400)
  Re: Density filling option for polygon  
From: Hedrondude
Date: 3 Jun 2018 22:30:01
Message: <web.5b14a3df4a5570bb478b32bb0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 03.06.2018 um 05:24 schrieb Hedrondude:
> > I'm using POV-Ray to render cross sections of four and five dimensional uniform
> > polytopes - especially star polytopes.  These renders can be seen on my website
> > http://www.polyope.htm/hedrondude/polychora.htm  I use the polygon keyword quite
> > a bit, but it only renders with the binary filling (all odd density regions gets
> > filled in, even density are left as holes) which forces me to manually fill in
> > all the non-0 even density regions.  This isn't too bad for simple polytopes,
> > but with more complex ones, this gets very tedious.  Is it possible to render
> > polygons with density filling (all non-0 density regions gets filled in - i.e.
> > filled in by the 'winding method') or better yet could this be a feature for
> > POV-Ray 3.8 where there is a density filling option for the polygon keyword.  I
> > would suggest something like this:
> >
> > #local obj=polygon {45,v1,v2,v3,......,v44,v1 density}
>
> I'm not sure I understand how Density Filling is defined; I had a look
> at http://www.polytope.net/hedrondude/fillings.png, but the technical
> terms "density" and "orientable" used in there are greek to me. (Also,
> it certainly doesn't help that it is depicted as giving results
> indentical to Natural Filling).
>
> At the end of the day, we'll need an algorithm to implement, so ideally,
> can you describe how one would test whether a given point (Xp,Yp) is to
> be coloured black or white, based on the list of points (X1,Y1),
> (X2,Y2), ... (Xn,Yn)?
>
> The closer that algorithm is to our current Binary Filling method, the
> easier it would be to implement.
>
> The current algorithm implementing Binary Filling takes each edge
> (Xa,Ya)->(Xb,Yb), tests whether it intersects the ray
> (Xp,Yp)->(+inf,Yp), and keeps track of whether the number of
> intersecting edges is odd or even.
>
> For example, this algorithm would be easy to adapt to Solid Filling, by
> just keeping track of whether the number of intersecting edges is non-zero.
>
>
> I have a hunch that a similar algorithm to implement Density Filling
> would take each edge (Xa,Ya)->(Xb,Yb), test whether it intersects the
> ray (Xp,Yp)->(+inf,Yp), and if so, test whether Ya>Yb -- and then do
> /something/ with the result; compute the difference between the Ya>Yb
> and Ya<Yb intersections, maybe? Or keep tabs on the distances of the
> intersections, and colour the point depending on whether Ya>Yb?


Thanks for the replies everyone.

For density filling, take each edge (Xa,Ya)->(Xb,Yb) and it's direction (if
heading downwards (clockwise) then direction=+1, if heading upwards (counter
clockwise) then direction=-1) and test if it intersects the ray
(Xp,Yp)->(+inf,Yp) - add up all of the direction values to get the density of
the region.  That should do it.

Another cool feature would be to color polygons according to density or to leave
some densities unfilled.


Post a reply to this message

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