0

I'm currently implementing a sweep-line-like algorithm and need to find the intersection point if 2 line segments (defined by endpoints) are intersected and almost parallel. Since a small error in the endpoints may bring a large move to the intersection point, I wonder what is the best way to find it, is there any precise algorithms?

  • 1
    Sweep-line algorith is not needed to find *two* segments intersection. But problem of precision loosing is fundamental ([example](http://www.cs.cmu.edu/~quake/robust.html) of developing special arthmetics to solve some geometric problems) – MBo Jul 13 '23 at 06:59
  • First watch the desired precision. You can use Windows Calculator, as it uses a large number of digits. Now, if 'double' type is not enough you may use [Arbitrary-precision arithmetic](https://stackoverflow.com/q/1218149/3871028) or special code, as MBo told – Ripi2 Jul 13 '23 at 19:26
  • You will probably need to use an exact number type. – lrineau Jul 17 '23 at 07:56

0 Answers0