Martin Desruisseaux wrote:
>Graham Davis a écrit :
>
>
>>I think that we should consider positions with similar NaN ordinates to
>>be equal. (...snip...)
>>
>>So, I think I should leave this last part of the DirectPosition equals
>>method the same. What do you think?
>>
>>
>
>It depends what we want to do:
>
>The current code will consider 2 points as equals if at least one point have
>NaN
>value, even if the other point has valid value. For example (2,5,8) and
>(2,NaN,8) are considered equals.
>
>With the proposed code change, (2,5,8) and (2,NaN,8) are considered different
>but (2,NaN,8) and (2,NaN,8) would be considered different as well.
>
>If the goal is "(2,5,8) and (2,NaN,8) are different" but (2,NaN,8) and
>(2,NaN,8)
>are equals", then a possible approach (admitly harder to read) is:
>
>double a = position.getOrdinate(i);
>double b = this.getOrdinate(i);
>if (!(abs(a - b) <= tol) && (!Double.isNaN(a) || !Double.isNaN(b))) {
> return false;
>}
>
>Whatever policy is choosen regarding NaN, it is probably worth to put a javadoc
>comment or a comment in the code...
>
> Martin
>
>
Agreed, and that's what I've done. I've taken an approach similar to
the one you listed above, where (2,5,8) and (2,NaN,8) are different,
but (2,NaN,8) and (2,NaN,8)are equal. I've added a comment to explain
that as well.
--
Graham Davis
Refractions Research Inc.
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel