POV-Ray : Newsgroups : povray.advanced-users : Density filling option for polygon : Re: Density filling option for polygon Server Time
25 Apr 2024 23:51:58 EDT (-0400)
  Re: Density filling option for polygon  
From: clipka
Date: 4 Jun 2018 12:27:33
Message: <5b156875@news.povray.org>
Am 04.06.2018 um 17:30 schrieb Le_Forgeron:
> Le 04/06/2018 à 04:29, Hedrondude a écrit :
> 
>> 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.
> 
> After thought, I'm afraid there is a big problem: in Povray, polygon
> (and actually triangle too) are not oriented. This is basically the root
> of the non-handness commitment.
> 
> As long as "density" would need an orientation to work correctly, it
> would be not-compatible with the parsing of polygon using 3D vectors.

That would only be true if the algorithm would be asymmetric with
respect to winding order.

Note that, in the above algorithm, reversing the definition of "positive
direction" will only affect the /sign/ of the computed "direction sum",
while the magnitude will remain unaffected; and it's only the magnitude
that matters in the "in" vs. "out" test (specifically whether that
magnitude is non-zero).

So no, there's nothing "not-compatible" about density filling; it only
adds one requirement that the user must pay attention to: They must use
a /consistent/ winding order for all "sub-polygons" of any /one/ polygon
primitive (with "holes" using the "reverse" of that winding order).
Whether that winding order is left- or right-handed from any given
perspective is entirely irrelevant. It may even differ between polygons
on the very same plane, provided they reside in separate primitives.


Post a reply to this message

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