It's pretty unlikely for a point to lie exactly on a line segment where the
endpoints have that much precision. Why do you think it does?
Instead, consider using a small tolerance value when using the
distancePointLine test (following the same principle often used when
testing FP numbers for "equality":
http://floating-point-gui.de/errors/comparison/)
On Mon, Dec 8, 2014 at 12:38 PM, Jik Le Shoog <[email protected]> wrote:
> I must do something wrong or there is a bug in JTS:
>
> I have a point that falls with a segment 100%, it does not overlap any
> segment vertice.
>
> //Sample points that cause failure
>
> //point.getGeometry().toText(): POINT (1189813.2298558373 1282137.
> 5104076413)
> //line.getGeometry().toText(): LINESTRING (1190117.3577566557
> 1282021.6521597095, 1189478.994760329 1282264.8380630743)
>
> //point.getGeometry().toText(): POINT (1189518.6390980254
> 1282448.001756093)
> //line.getGeometry().toText(): LINESTRING (1189426.304481268
> 1282287.1301042158, 1189622.879753152 1282629.6169181187)
>
> Java code:
>
> Coordinate pointCoord = point.getGeometry().getCoordinate();
> Coordinate[] lineCoords = line.getGeometry().getCoordinates();
>
> Any of the following if-s evaluate their condition to false, when I
> expected true:
>
>
> LineSegment lineSegment = new LineSegment(lineCoords[0], lineCoords[1]);
> if (lineSegment.distance(pointCoord) == 0) {
>
> if (CGAlgorithms.distancePointLine(pointCoord, lineCoords[0],
> lineCoords[1]) == 0) {
>
> if (CGAlgorithms.isOnLine(pointCoord, lineCoords)) {
>
>
> Any help, please? I consider all those 3 methods would be appropriate for
> determining if point within segment.
>
>
> thank you.
>
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Jts-topo-suite-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user