The Javadoc comment does say:

* Beware, for performace reasons the ordinate index is not checked, if * it's over dimensions you may not get an exception but a meaningless
    *      value.

I didn't write this code, so I have no idea if the performance is really that much of an issue. I wouldn't have thought so, but it needs testing to be sure.

Paul Austin wrote:
The implementation of the packedCoordinate sequence does not do any
dimension checking on the ordinate argument. Therefore if you say have a
2D coordinate sequence and request the 3 ordinate (z) then you will
actually be returned the value for the x value of the next coordinate.

The implementation to be safe should be something like.

  public double getOrdinate(int index, int ordinate) {
    if (ordinate > dimension) {
      return Double.NaN;
    } else {
      return coords[index * dimension + ordinate];
    }
  }

Paul
_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel


--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to