Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] Visual Center of Polygon

I meant the magnitude of the slope is 0.8, not 1.0.

On Thu, Oct 25, 2018 at 6:54 PM Eric Angle <eric.lohner.angle@xxxxxxxxx> wrote:
You're absolutely right. The slope from (5,10) to (10,6) is 0.8 not 1.0.

On Thu, Oct 25, 2018 at 5:27 PM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Ah, and now I see your point.  Yes, it is expected that the computed location is about  (5.276908874511719 4.999961853027344) .  This is in fact the centre of (one of) the Largest Inner Circles.  That's because the "diamond" shapes are not symmetrical about the vertical - they are slightly "larger" where they join.  So the circle centre is displaced towards the centre.  

Another way to see this is to compute:

distance( boundary(DD), (5.276908874511719 4.999961853027344)) = 3.7313447923664707
distance( boundary(DD), (5 5)) = 3.5355339059327378

So the computed point is actually slightly further from the DD boundary, as expected.


On Thu, Oct 25, 2018 at 2:17 PM Eric Angle <eric.lohner.angle@xxxxxxxxx> wrote:
Bouncing back and forth is fine. Either point would be acceptable for my use case.

I see your point that the y coordinate is converging, but the x coordinate is still off by almost 0.3 even when the precision is 0.00001. Is this to be expected?

Thank you,

Eric

On Thu, Oct 25, 2018 at 5:09 PM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Well, that test case is a classic example of a shape that has two locations of Largest Inner Circle (AKA Pole of Inaccessiblity, as the geographers like to call it).  It so happens that the approximation algorithm in PolyLabeller bounces back and forth between them  But it does seem to converge on both of them.  I also get:

PolyLabeller.getPolylabel(p, 0.0001) = (5.276908874511719 4.999961853027344)  
PolyLabeller.getPolylabel(p, 0.00001) = (14.723076820373535 4.999995231628418)    

So the precision is increasing, but the point location is not stable.  Just the way it works, unfortunately. Is this important for your use case? It might be possible to add a weighting to prefer (say) the leftmost one. 

On Thu, Oct 25, 2018 at 1:59 PM Eric Angle <eric.lohner.angle@xxxxxxxxx> wrote:
Hi Martin,
 
I was looking at the testDoubleDiamond() case here
 

Polygon p = (Polygon) reader.read("POLYGON((0 5, 5 10, 10 6, 15 10, 20 5, 15 0, 10 4, 5 0, 0 5))");

and decided to try it out with the jts-ports PolyLabeller.getPolylabel(Geometry polygon, double precision).

Should I expect to get back either (5,5) or (15,5) plus or minus (roughly) precision?

I find

PolyLabeller.getPolylabel(p, 1)     = (5,5)
PolyLabeller.getPolylabel(p, 0.1)   = (14.727,4.961)
PolyLabeller.getPolylabel(p, 0.001) = (5.276,4.999)

In other words, the answer doesn't seem to improve with decreasing precision.

Any thoughts on what could be going on?

Thanks,

Eric

On Thu, Oct 25, 2018 at 12:39 AM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Yes.  And probably best implemented using the orientationIndex predicate.

On Wed, Oct 24, 2018, 8:42 PM Sandro Santilli <strk@xxxxxx> wrote:
On Wed, Oct 24, 2018 at 10:58:08AM -0600, Eric Angle wrote:

> Your suggestion of checking that all interior angles are less than 180
> makes sense to me.

Less than or equal to 180, I guess ?

--strk;
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev

Back to the top