POV-Ray : Newsgroups : povray.advanced-users : Density filling option for polygon Server Time
28 Mar 2024 18:02:09 EDT (-0400)
  Density filling option for polygon (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: Density filling option for polygon
Date: 5 Jun 2018 09:11:08
Message: <5b168bec$1@news.povray.org>
Am 05.06.2018 um 14:20 schrieb William F Pokorny:
> On 06/04/2018 12:27 PM, clipka wrote:
>> Am 04.06.2018 um 17:30 schrieb Le_Forgeron:
>>> Le 04/06/2018 à 04:29, Hedrondude a écrit :
>>>
> ....
>>
> 
> I'd like to suggest, if we are looking at polygon enhancements -
> canonical point ordering for fill options etc, we consider staying
> compatible with packages like:
> 
> https://sourceforge.net/projects/polyclipping/
> 
> even if not looking to support that package specifically - though it
> would be my choice at present.

I'm pretty sure we are /not/ currently compatible with any such package,
so it's not a matter of /staying/ compatible, but /making/ our code
compatible.

Given that our established data structure and algorithm for polygons is
fine enough to accomodate for Density Filling, I see no reason to adapt
our polygon code to any 3rd party package.

Unless of course there is some feature we really can't live without
(hard-coded into POV-Ray, mind you, as opposed to implemented as some
SDL macros) yet can't implement ourselves, but right now I don't see
anything like that on the horizon.


Post a reply to this message

From: Le Forgeron
Subject: Re: Density filling option for polygon
Date: 5 Jun 2018 14:18:07
Message: <5b16d3df$1@news.povray.org>
Le 05/06/2018 à 03:24, Hedrondude a écrit :
> clipka <ano### [at] anonymousorg> wrote:
>> Am 04.06.2018 um 04:29 schrieb Hedrondude:
>>
>>> Another cool feature would be to color polygons according to density or to leave
>>> some densities unfilled.
>>
>> I don't think the former would be possible /per se/ with reasonable
>> effort. The latter would probably be quite easy to implement (and could
>> then be used to emulate the former, by using copies of the polygon with
>> different colours and different density ranges), but we'd need to find a
>> neat syntax for such a feature.
> 
> ideas for syntax:
> 
> binary filling, leave as is:
> 
> polygon {n, v1,v2,v3,...v1}
> 
> density filling:
> 
> polygon {n, v1,v2,v3,...v1 density}
> 
> fill in one particular density
> 
> polygon {m,v1,v2,v3,...v1 density d}
> 
> fill in m particular densities:
> 
> polygon {n, v1,v2,v3,...v1 density {m,d1,d2,d3,..,dn}}
> 
> 
> 


I'd like to remember everyone that shape and pattern are two different
(and independent) items in Povray.
(well, usually... I tried a per-vertex colouring of polygon using
texture_list, with interpolation between vertices)

The shape (polygon) with "density" is actually a simplified polygon
without holes.

Applying a pattern based on polygon and "density" would be a discrete
function used as input of a map (texture_map, pigment_map, color_map, ...).

My main problem is that usual map goes from 0 to 1, but here we would
have integer values (the same issue that hexagon pattern has).
Either there is a user input of the max to reduce to 0..1, or the map is
warped as having entries at (n/n+1)
(density 0 at 0, density 1 at 1/2, density 2 at 2/3 and so on, never
reaching 1.0)


Diverging from general polygon, but probably still relevant for the
original poster: using interunion{} and its range{}
( http://wiki.povray.org/content/User:Le_Forgeron#Interunion )
whose domain is making easy the stellated polyhedron (despite the
default illustration) can be a path to explore.

On the other hand, adding a new object (not distracting the
hyper-optimised code of polygon) which would allow to handle the notion
of selected density as a bitmap, is also a possible path.
(but unlike interunion, negative number cannot be used as shortcut in range)


Post a reply to this message

From: clipka
Subject: Re: Density filling option for polygon
Date: 5 Jun 2018 17:34:00
Message: <5b1701c8$1@news.povray.org>
Am 05.06.2018 um 20:18 schrieb Le_Forgeron:

> The shape (polygon) with "density" is actually a simplified polygon
> without holes.

Actually, no. The effect of "holes" in density filling depends on their
winding order (in relation to the outer polygon's). If the winding order
is "backwards", "holes" will be holes. If the winding order is
"forwards", "holes" will be filled.


Post a reply to this message

From: William F Pokorny
Subject: Re: Density filling option for polygon
Date: 6 Jun 2018 07:56:29
Message: <5b17cbed$1@news.povray.org>
On 06/05/2018 09:11 AM, clipka wrote:
> Am 05.06.2018 um 14:20 schrieb William F Pokorny:
>> On 06/04/2018 12:27 PM, clipka wrote:
>>> Am 04.06.2018 um 17:30 schrieb Le_Forgeron:
>>>> Le 04/06/2018 à 04:29, Hedrondude a écrit :
>>>>
>> ....
>>>
>>
>> I'd like to suggest, if we are looking at polygon enhancements -
>> canonical point ordering for fill options etc, we consider staying
>> compatible with packages like:
>>
>> https://sourceforge.net/projects/polyclipping/
>>
>> even if not looking to support that package specifically - though it
>> would be my choice at present.
> 
> I'm pretty sure we are /not/ currently compatible with any such package,
> so it's not a matter of /staying/ compatible, but /making/ our code
> compatible.

I was thinking up front about point order or winding (cw,ccw) directions 
and what they 'usually' mean - hole or not in the non-POV-Ray world - 
though should have stated that more explicitly. I've not spent time in 
the polygon code, but for prism and text I don't believe our current cw, 
ccw ordering today carries any particular hole, not-hole meaning. We use 
even/odd curve crossing tests to determine insides. If we adopt 
something with respect to ccw/cw point ordering, aligning with the most 
common - or perhaps even standard - definition makes sense(1). To be 
more compatible with external tools if nothing else.

There are filling options in polyclipping I've not really looked over as 
it was not my own up front first interest. Unsure if those follow some 
'standard/usual' approach.

As said above the winding order idea touches prism and text objects too. 
The latter I know from some performance code work I've done doesn't 
today match match all defined font curve overlapping behaviors - because 
we're not working with set cw/ccw winding definitions.

(1) - cw/ccw determination in degenerate polygon (badly defined point 
lists) can be impossible. Usually some polygon check and cleanup pass is 
done on the point list beforehand.

> 
> Given that our established data structure and algorithm for polygons is
> fine enough to accomodate for Density Filling, I see no reason to adapt
> our polygon code to any 3rd party package.
> 

Agree this feature does not drive a requirement for any external library.

> Unless of course there is some feature we really can't live without
> (hard-coded into POV-Ray, mind you, as opposed to implemented as some
> SDL macros) yet can't implement ourselves, but right now I don't see
> anything like that on the horizon.
>


Post a reply to this message

From: clipka
Subject: Re: Density filling option for polygon
Date: 6 Jun 2018 10:12:03
Message: <5b17ebb3@news.povray.org>
Am 06.06.2018 um 13:56 schrieb William F Pokorny:

> I was thinking up front about point order or winding (cw,ccw) directions
> and what they 'usually' mean - hole or not in the non-POV-Ray world -
> though should have stated that more explicitly. I've not spent time in
> the polygon code, but for prism and text I don't believe our current cw,
> ccw ordering today carries any particular hole, not-hole meaning. We use
> even/odd curve crossing tests to determine insides. If we adopt
> something with respect to ccw/cw point ordering, aligning with the most
> common - or perhaps even standard - definition makes sense(1). To be
> more compatible with external tools if nothing else.

POV-Ray's polygons don't have a well-defined winding order because it
depends on how the common plane (the plane on which all the polygon's
vertices lie) is mapped to pure 2D space.

In 2D space, counter-clockwise winding order for outlines and clockwise
winding order for holes is pretty much the one and only standard out
there; but since there is no guaranteed mapping from 3D space to 2D
space, any algorithm we design needs to be effectively symmetric anyway.

> As said above the winding order idea touches prism and text objects too.
> The latter I know from some performance code work I've done doesn't
> today match match all defined font curve overlapping behaviors - because
> we're not working with set cw/ccw winding definitions.

Text objects are a fun topic with respect to filling: Different font
file formats have different standards; IICR TrueType effectively uses
density filling, whereas Type 1 effectively uses binary filling.
(According to the specs that is; POV-Ray's implementation of TrueType
may indeed differ.)


Post a reply to this message

From: Le Forgeron
Subject: Re: Density filling option for polygon
Date: 14 Jun 2018 09:39:18
Message: <5b227006$1@news.povray.org>
Le 03/06/2018 à 05:24, Hedrondude a écrit :
> 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 did an experimentation on
https://github.com/LeForgeron/povray/tree/extension/winding-polyline

#declare A=<0,3,0>;
#declare B=<6,3,0>;
#declare C=<4.5,1,0>;
#declare D=<7,2,0>;
#declare E=<4.5,6,0>;
#declare F=<7,4,0>;
#declare G=<2,4,0>;
#declare H=<4,6,0>;
#declare I=<4,0,0>;
#declare J=<5,0,0>;
#declare K=<5,8,0>;
polyline
{
  A, B, C, D,
  E, F, G, H,
  I, J, K, A
  range { <1,2> }
  texture { pigment { color srgb 0.5 }}
}


Post a reply to this message


Attachments:
Download 'polyline.png' (10 KB)

Preview of image 'polyline.png'
polyline.png


 

From: Hedrondude
Subject: Re: Density filling option for polygon
Date: 7 Sep 2018 16:35:01
Message: <web.5b92e0764a5570bb478b32bb0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 03/06/2018 à 05:24, Hedrondude a écrit :
> > 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 did an experimentation on
> https://github.com/LeForgeron/povray/tree/extension/winding-polyline
>
> #declare A=<0,3,0>;
> #declare B=<6,3,0>;
> #declare C=<4.5,1,0>;
> #declare D=<7,2,0>;
> #declare E=<4.5,6,0>;
> #declare F=<7,4,0>;
> #declare G=<2,4,0>;
> #declare H=<4,6,0>;
> #declare I=<4,0,0>;
> #declare J=<5,0,0>;
> #declare K=<5,8,0>;
> polyline
> {
>   A, B, C, D,
>   E, F, G, H,
>   I, J, K, A
>   range { <1,2> }
>   texture { pigment { color srgb 0.5 }}
> }

Excuse the late reply, I haven't been on the forum in a while.

The experiment looks right.  Is there a way to add this code to POV-Ray before
the next update?


Post a reply to this message

From: Le Forgeron
Subject: Re: Density filling option for polygon
Date: 8 Sep 2018 03:38:41
Message: <5b937c81$1@news.povray.org>
Le 07/09/2018 à 22:32, Hedrondude a écrit :
> Le_Forgeron <jgr### [at] freefr> wrote:
>> Le 03/06/2018 à 05:24, Hedrondude a écrit :
>>> #local obj=polygon {45,v1,v2,v3,......,v44,v1 density}
>>>
>>>
>>
>> I did an experimentation on
>> https://github.com/LeForgeron/povray/tree/extension/winding-polyline
>>

>> polyline
>> {
>>   A, B, C, D,
>>   E, F, G, H,
>>   I, J, K, A
>>   range { <1,2> }
>>   texture { pigment { color srgb 0.5 }}
>> }
> 
> Excuse the late reply, I haven't been on the forum in a while.
> 
> The experiment looks right.  Is there a way to add this code to POV-Ray before
> the next update?
> 

You will have to ask for a pull request from the above URL into official
master branch, and get it approved by the power that be.

But check first with everybody that the syntax is ok.


Post a reply to this message

From: Le Forgeron
Subject: Re: Density filling option for polygon
Date: 8 Sep 2018 05:47:27
Message: <5b939aaf$1@news.povray.org>
Le 08/09/2018 à 09:38, Le_Forgeron a écrit :
> Le 07/09/2018 à 22:32, Hedrondude a écrit :
>> Le_Forgeron <jgr### [at] freefr> wrote:
>>> Le 03/06/2018 à 05:24, Hedrondude a écrit :
>>>> #local obj=polygon {45,v1,v2,v3,......,v44,v1 density}
>>>>
>>>>
>>>
>>> I did an experimentation on
>>> https://github.com/LeForgeron/povray/tree/extension/winding-polyline
>>>
> 
>>> polyline
>>> {
>>>   A, B, C, D,
>>>   E, F, G, H,
>>>   I, J, K, A
>>>   range { <1,2> }
>>>   texture { pigment { color srgb 0.5 }}
>>> }
>>
>> Excuse the late reply, I haven't been on the forum in a while.
>>
>> The experiment looks right.  Is there a way to add this code to POV-Ray before
>> the next update?
>>
> 
> You will have to ask for a pull request from the above URL into official
> master branch, and get it approved by the power that be.
> 
> But check first with everybody that the syntax is ok.
> 

And a bit of documentation too:

http://wiki.povray.org/content/User:Le_Forgeron/polyline


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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