private bool AreNormalsEquivalent(ClipperLib.DoublePoint n0, ClipperLib.DoublePoint n1) { const double epsilon = 1.0f / 1024.0f; double ax = Math.Abs(n0.X - n1.X); double ay = Math.Abs(n0.Y - n1.Y); return((ax < epsilon) && (ay < epsilon)); }
private List <ClipperLib.IntPoint> RemovePointsOnLine(List <ClipperLib.IntPoint> points) { int index = 0; while (index < points.Count - 2) { ClipperLib.DoublePoint normal0 = ClipperLib.ClipperOffset.GetUnitNormal(points[index], points[index + 1]); ClipperLib.DoublePoint normal1 = ClipperLib.ClipperOffset.GetUnitNormal(points[index], points[index + 2]); if (AreNormalsEquivalent(normal0, normal1)) { points.RemoveAt(index + 1); } else { index++; } } return(points); }