Closed howardjones closed 3 years ago
Failure is
PHP Fatal error: Uncaught Weathermap\Core\WeathermapInternalFail: ParallelLinesNeverCross in /home/howie/Work/network-weathermap/lib/Weathermap/Core/Line.php:56
While finding $crossingPoint1
, which is where $line1
and $line2
cross - the outside corner of the link as it goes around a VIA corner. This should never be parallel, as the spine is simplified to remove colinear points after it is split into two spines (one for each direction, split at SPLITPOS).
If SPLITPOS is close to one end, you can end up with a spine of only two points after the split is done. Spine::splitAtDistance() needs to interpolate a middle point if there are only two. (Good news is that if there are only two, it'll always be a simple linear interpolation)
Also, when coordinates are large, getTriangleArea() and simplify() start to get too fussy, and not simplify points that they should.
This config crashes weathermap with an exception while trying to find the crossing point of two parallel lines. The same thing does not happen if you move both points 4000 pixels left (X is 370 and 30) instead. It is also fine if SPLITPOS is 50.