Skip to content

RobustLineIntersector defensive copyWithZ check to avoid exception with CoordinateXY or CoordinateXYM - #1071

Merged
jodygarnett merged 1 commit into
locationtech:masterfrom
jodygarnett:copyWithZ_check
Aug 23, 2024
Merged

RobustLineIntersector defensive copyWithZ check to avoid exception with CoordinateXY or CoordinateXYM#1071
jodygarnett merged 1 commit into
locationtech:masterfrom
jodygarnett:copyWithZ_check

Conversation

@jodygarnett

Copy link
Copy Markdown
Contributor

Defensive check prevents copyWithZ, copyWithZInterpolate methods from throwing an exception when the target coordinate is CoordinateXY or CoordinateXYM.

This is in addition to the existing defensive check to avoid doing anything if the z vale was Double.NaN.

This mitigates but does not solve #375 which is due to the intermixing of Coordinate and CoordinateXY values in GeoTools clipping code.

@jodygarnettjodygarnett added this to the 1.20.0 milestone Aug 23, 2024
@jodygarnett
jodygarnettforce-pushed the copyWithZ_check branch 2 times, most recently from dc8f9f5 to 234dbf0CompareAugust 23, 2024 22:37
Defensive check prevents copyWithZ, copyWithZInterpolate methods from throwing an exception when the target coordinate is CoordinateXY or CoordinateXYM.
This is in addition to the existing defensive check to avoid doing anything if the z vale was Double.NaN.
@jodygarnett

Copy link
Copy Markdown
ContributorAuthor

This is minimal change to avoid exception.

I looked at "casting" coordinates to solve #375 but am uncomfortable doing so in performance sensitive code.

@dr-jts

Copy link
Copy Markdown
Contributor

Looks good to me.

@jodygarnettjodygarnett changed the title RobustLineIntersector defensive copyWithZ check before calling Coordinate.setZ(value)RobustLineIntersector defensive copyWithZ check to avoid exception with CoordinateXY or CoordinateXYMAug 23, 2024
@jodygarnett
jodygarnett merged commit b99f94e into locationtech:masterAug 23, 2024
@jodygarnett
jodygarnett deleted the copyWithZ_check branch August 23, 2024 22:53
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@jodygarnett@dr-jts