[orx-triangulation] Add smoothScatter

This commit is contained in:
Edwin Jakobs
2022-10-28 08:52:36 +02:00
parent 0a77411406
commit 0a7b4b7add
8 changed files with 283 additions and 112 deletions

View File

@@ -1,6 +1,6 @@
package org.openrndr.extra.triangulation
internal fun orient2d(bx: Double, by: Double, ax: Double, ay: Double, cx: Double, cy: Double): Double {
fun orient2d(bx: Double, by: Double, ax: Double, ay: Double, cx: Double, cy: Double): Double {
// (ax,ay) (bx,by) are swapped such that the sign of the determinant is flipped. which is what Delaunator.kt expects.
/*
@@ -8,12 +8,12 @@ internal fun orient2d(bx: Double, by: Double, ax: Double, ay: Double, cx: Double
| c d | | bx - cx by - cy |
*/
val a = ax - cx
val b = ay - cy
val c = bx - cx
val d = by - cy
val a = twoDiff(ax, cx)
val b = twoDiff(ay, cy)
val c = twoDiff(bx, cx)
val d = twoDiff(by, cy)
val determinant = ddDiffDd(twoProduct(a, d), twoProduct(b, c))
val determinant = ddDiffDd(ddMultDd(a, d), ddMultDd(b, c))
return determinant[1]
}