mathnet-spatial icon indicating copy to clipboard operation
mathnet-spatial copied to clipboard

Fix Line2D.TryIntersect to pass nullable Point2D

Open f-frhs opened this issue 4 years ago • 0 comments

This pull-request is asking for help to solve #178.

The problem is that LineSegment2D.TryIntersect() always passes by reference Point2D of intersection, regardless of whether the two LineSegment2D actually have a valid intersection or not.

In my fix, LineSegment2D.TryIntersect() passes by ref Point2D?, which can indicate that there is no intersection. My fix used #111 as reference.

I'm not sure that this breaking change is acceptable or not. If there is another way to solve this, I'm happy to learn it.

I considered these fix-plans:

  1. Leave it as it is
  2. Pass by ref default(Point2D)
  3. Pass by ref Nullable<Point2D>
  4. Pass by ref Point2D.Null (kinda)
  5. Return Nullable<Point2D> instead of bool

f-frhs avatar Apr 29 '21 07:04 f-frhs