Dear All,

in the following code I would expect to get the same coords as original ones
before processing. But there are rounding errors. Is there any way to get
rid of this? Is there any way to apply precission model here?


    @Test
    public void testConversion() {

        Coordinate[] corners = new Coordinate[]{
            new Coordinate(0.0, 0.0),
            new Coordinate(5.0, 0.0),
            new Coordinate(5.0, 4.0),
            new Coordinate(0.0, 4.0),
            new Coordinate(0.0, 0.0)};

        Geometry borderGeometry = new
GeometryFactory().createLineString(corners);
        LengthIndexedLine lengthIndexedLine = new
LengthIndexedLine(borderGeometry);

        Coordinate coordinateOriginal = new Coordinate(0,
0.41278619766154856);
        
        double distance = lengthIndexedLine.indexOf(coordinateOriginal);
        
        Coordinate coordinateNew = lengthIndexedLine.extractPoint(distance);
        
        System.out.println(coordinateOriginal.toString());
        System.out.println(coordinateNew.toString());

        /*
        (0.0, 0.41278619766154856, NaN)
        (0.0, 0.4127861976615499, NaN)
        */
    }

Thanks, Jan

<<attachment: winmail.dat>>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jts-topo-suite-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user

Reply via email to