Skip to content

Commit

Permalink
Fix find method (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardomatias authored Feb 11, 2021
1 parent 8cc54dc commit 2fb83dc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions orx-triangulation/src/main/kotlin/Delaunay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,12 @@ class Delaunay(val points: DoubleArray) {
}

fun find(x: Double, y: Double, i: Int = 0): Int {
val x0 = +x
val y0 = +y
var i0 = i

if ((x0 != x) || (y0 != y)) return -1

val i1 = i0
var c = step(i0, x, y)
var i1 = i
var c = step(i, x, y)

while (c >= 0 && c != i && c != i1) {
i0 = c
c = step(i0, x, y)
i1 = c
c = step(i1, x, y)
}
return c
}
Expand Down

0 comments on commit 2fb83dc

Please sign in to comment.