ChrisVilches / Algorithms

Solutions for competitive programming problems in various online judges such as Kattis, SPOJ, URI Online Judge, etc.
5 stars 0 forks source link

Polygonal Puzzle issue #31

Open ChrisVilches opened 1 year ago

ChrisVilches commented 1 year ago

Polygon intersection is incorrect.

It was fixed in the Rust repository here: https://github.com/ChrisVilches/Polygonal-Puzzle/blob/main/src/shapes/polygon.rs

One of the lines that looked like this (there were two):

if th2 > EPS && th2 < th - EPS {

was changed to:

if th2 >= 0_f64 && th2 < th - EPS {

And then it worked.

In the C++ solution in this repository, I still haven't updated the code.

Despite the intersection being wrong, the result was the same, because the polygon was very symmetric.

Correct result (before updating the line, one polygon was on top of the other one, intersecting at some vertices):

08