You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two instances of Position are considered equal when their Latitude, Longitude and Altitude are approximately equal using a DoubleComparer.
LineString.IsClosed considers an instance to be closed if Latitude, Longitude and Altitude of its first and last IPosition coordinate are exactly equals.
This seems to be potential inconsistent when constructing a LineString with Position as IPosition.
Is that intended behavior?
The text was updated successfully, but these errors were encountered:
Well it's a dilema here. I don't know what was the intended behavior when the project was initiated.
It may be for that reason : when LineStrings are not closed, this will break some systems (SQL Server is strict on that for instance).
But comparing until the 10th decimal digit (as DoubleComparer does) is fair enough to state it's the same coordinate. We are talking about micrometers here.
More over equality with double is something variable upon where the code is executed and strict equality should be replaced by difference is below double.Epsilon. So the DoubleComparer is a good choice here, as it checks for equality for acceptable ranges.
So I think we could remove this strict equality check and prefer the DoubleComparer.
We then may add candies for strict closeness such as EnsureIsClosed() which can replace last position by exactly the start position only if DoubleComparer states that they are equal.
If anyone watching this thinks it's a bad idea please comment down here.
And by the way, thanks for your implication @jnyrup !
Two instances of
Position
are considered equal when theirLatitude
,Longitude
andAltitude
are approximately equal using aDoubleComparer
.LineString.IsClosed
considers an instance to be closed ifLatitude
,Longitude
andAltitude
of its first and lastIPosition
coordinate are exactly equals.This seems to be potential inconsistent when constructing a
LineString
withPosition
asIPosition
.Is that intended behavior?
The text was updated successfully, but these errors were encountered: