On 2015-03-16 Martin Davis wrote:
> On 2015-03-12 Jan Tosovsky wrote:
> >
> > 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)
> > */
> > }
>
> At the moment Linear Referencing doesn't support a precision model, so
> the only way to apply a PrecisionModel is to do it manually on the
> results of operations.
> Ok, no problem. In meantime I stored temporary results in Map<length, Coordinate> and instead of calculating them back just read original coordinates from that map. Anyway, this part has been rewritten so currently I don't need it at all :-) 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
