From: makc on
I have specified point inside polygon, and - well - polygon. I want to
paint the point white, and polygon perimiter black, and then smooth
gradient inbeween.

For convex polygon, I would split it in a fan of triangles and
gradient-fill them, but for concave polygons this will not work
because of self-intersections. If I try to extend this algorithm by
dropping lots of points inside and applying delaunay triangulation, it
is not clear to me how to assign colors to vertices :(

So, I was thinking maybe someone on the internet knows how to do it in
general case? you know, just for the sake of solution' completeness?
Everything goes - pathfinding, flood-fills, etc - as long as you have
an idea how to come from particular known algorithm to this specific
application, please post it.
From: Dave Eberly on
"makc" <makc.the.great(a)gmail.com> wrote in message
news:73b7a581-124f-4c0a-ae46-f19933900647(a)y17g2000yqd.googlegroups.com...
> I have specified point inside polygon, and - well - polygon. I want to
> paint the point white, and polygon perimiter black, and then smooth
> gradient inbeween.
>
> For convex polygon, I would split it in a fan of triangles and
> gradient-fill them, but for concave polygons this will not work
> because of self-intersections. If I try to extend this algorithm by
> dropping lots of points inside and applying delaunay triangulation, it
> is not clear to me how to assign colors to vertices :(

This image has a question for you. Ignoring the problems with
self-intersection, a concave polygon can have a complicated shape. It is
not clear what you have in mind for coloring such shapes.

http://www.geometrictools.com/Temp/GradFillConcave.png

--
Dave Eberly
http://www.geometrictools.com





From: Kaba on
makc wrote:
> I have specified point inside polygon, and - well - polygon. I want to
> paint the point white, and polygon perimiter black, and then smooth
> gradient inbeween.

I'm just linking this site and paper here.

"Diffusion Curves: A Vector Representation for Smooth-Shaded Images"

http://artis.imag.fr/Publications/2008/OBWBTS08/

Look at the video, its nice:) Just some food for thought, maybe you get
some ideas from that. I haven't looked into the paper too detailedly.

--
http://kaba.hilvi.org
From: Pascal J. Bourguignon on
makc <makc.the.great(a)gmail.com> writes:

> I have specified point inside polygon, and - well - polygon. I want to
> paint the point white, and polygon perimiter black, and then smooth
> gradient inbeween.
>
> For convex polygon, I would split it in a fan of triangles and
> gradient-fill them, but for concave polygons this will not work
> because of self-intersections. If I try to extend this algorithm by
> dropping lots of points inside and applying delaunay triangulation, it
> is not clear to me how to assign colors to vertices :(
>
> So, I was thinking maybe someone on the internet knows how to do it in
> general case? you know, just for the sake of solution' completeness?
> Everything goes - pathfinding, flood-fills, etc - as long as you have
> an idea how to come from particular known algorithm to this specific
> application, please post it.


Consider your polygon is a circle. Then your gradient is just the
distance from the center divided by the radius of the circle.

Now the question is how you transform a circle with all its radiuses
into a polygon, with the corresponding lines.

First, you may easily transform the circle in an irregular but convex
polygon with the same side number and lengths.

Then you must morph the vertexes from the circle to their position in
the concave polygon. This transformation should keep the "radiuses"
separate (radiuses don't intersect). You could choose any curve for
them:

- broken lines (adding dots in the radiuses to be able to bend them).

- various classes of curve lines, as long as the "radiuses" don't
intersect. You would have to study the properties of various kind of
curves to find the adequate ones.


One thing is that the density of the radiuses will change when you bend
the sides. Perhaps you'd wan to change the gradient in function of this
density? Or you could just keep the orignal definition, as curve
distance from the "center".


--
__Pascal Bourguignon__
http://www.informatimago.com
From: Pascal J. Bourguignon on
makc <makc.the.great(a)gmail.com> writes:

> I have specified point inside polygon, and - well - polygon. I want to
> paint the point white, and polygon perimiter black, and then smooth
> gradient inbeween.
>
> For convex polygon, I would split it in a fan of triangles and
> gradient-fill them, but for concave polygons this will not work
> because of self-intersections. If I try to extend this algorithm by
> dropping lots of points inside and applying delaunay triangulation, it
> is not clear to me how to assign colors to vertices :(
>
> So, I was thinking maybe someone on the internet knows how to do it in
> general case? you know, just for the sake of solution' completeness?
> Everything goes - pathfinding, flood-fills, etc - as long as you have
> an idea how to come from particular known algorithm to this specific
> application, please post it.


Consider your polygon is a circle. Then your gradient is just the
distance from the center divided by the radius of the circle.

Now the question is how you transform a circle with all its radiuses
into a polygon, with the corresponding lines.

First, you may easily transform the circle in an irregular but convex
polygon with the same side number and lengths.

Then you must morph the vertexes from the circle to their position in
the concave polygon. This transformation should keep the "radiuses"
separate (radiuses don't intersect). You could choose any curve for
them:

- broken lines (adding dots in the radiuses to be able to bend them).

- various classes of curve lines, as long as the "radiuses" don't
intersect. You would have to study the properties of various kind of
curves to find the adequate ones.


One thing is that the density of the radiuses will change when you bend
the sides. Perhaps you'd wan to change the gradient in function of this
density? Or you could just keep the orignal definition, as curve
distance from the "center".


--
__Pascal Bourguignon__
http://www.informatimago.com