Skip to content
Snippets Groups Projects

Intuitive erasing

Merged
Iurii Maksymetsrequested to merge
intuitive-erasing into master
1 open thread
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -19,9 +19,9 @@ function cap01(x) {
}
function distToSegmentSquared(lineStart, lineEnd, point) {
var l2 = distanceSquared(lineStart, lineEnd)
const l2 = distanceSquared(lineStart, lineEnd)
if (l2 === 0) return distanceSquared(point, lineStart)
var t =
let t =
((point[0] - lineStart[0]) * (lineEnd[0] - lineStart[0]) +
(point[1] - lineStart[1]) * (lineEnd[1] - lineStart[1])) /
l2
@@ -100,7 +100,7 @@ function mergeIntervals(...intervals) {
if (!intervals.length) return []
const sorted = intervals.sort(([a], [b]) => a > b)
let stack = [sorted[0]]
const stack = [sorted[0]]
sorted.forEach((x) => {
const top = stack[stack.length - 1]
if (overlaps(x, top)) {
Loading