Rename gradient functions

This commit is contained in:
Edwin Jakobs
2020-03-12 15:08:28 +01:00
parent eff96bac94
commit 1938cbcce3
2 changed files with 8 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import org.openrndr.math.Vector2
import org.openrndr.math.Vector3 import org.openrndr.math.Vector3
import org.openrndr.math.Vector4 import org.openrndr.math.Vector4
inline fun gradient( inline fun gradient1D(
crossinline noise: (seed: Int, x: Double) -> Double, crossinline noise: (seed: Int, x: Double) -> Double,
seed: Int, seed: Int,
x: Double, x: Double,
@@ -15,7 +15,7 @@ inline fun gradient(
return (xp - xn) / (2.0 * epsilon) return (xp - xn) / (2.0 * epsilon)
} }
inline fun gradient( inline fun gradient2D(
crossinline noise: (seed: Int, x: Double, y: Double) -> Double, crossinline noise: (seed: Int, x: Double, y: Double) -> Double,
seed: Int, seed: Int,
x: Double, x: Double,
@@ -29,7 +29,7 @@ inline fun gradient(
return Vector2((xp - xn) / (2.0 * epsilon), (yp - yn) / (2.0 * epsilon)) return Vector2((xp - xn) / (2.0 * epsilon), (yp - yn) / (2.0 * epsilon))
} }
inline fun gradient( inline fun gradient3D(
crossinline noise: (seed: Int, x: Double, y: Double, z: Double) -> Double, crossinline noise: (seed: Int, x: Double, y: Double, z: Double) -> Double,
seed: Int, seed: Int,
x: Double, x: Double,
@@ -46,7 +46,7 @@ inline fun gradient(
return Vector3((xp - xn) / (2.0 * epsilon), (yp - yn) / (2.0 * epsilon), (zp - zn) / (2.0 * epsilon)) return Vector3((xp - xn) / (2.0 * epsilon), (yp - yn) / (2.0 * epsilon), (zp - zn) / (2.0 * epsilon))
} }
inline fun gradient( inline fun gradient4D(
crossinline noise: (seed: Int, x: Double, y: Double, z: Double, w: Double) -> Double, crossinline noise: (seed: Int, x: Double, y: Double, z: Double, w: Double) -> Double,
seed: Int, seed: Int,
x: Double, x: Double,

View File

@@ -6,28 +6,28 @@ import kotlin.test.assertEquals
object TestGradient : Spek({ object TestGradient : Spek({
describe("Noise") { describe("Noise") {
it("has a gradient") { it("has a gradient") {
gradient(::perlinLinear, 100, 0.1) gradient1D(::perlinLinear, 100, 0.1)
} }
} }
describe("FBM noise func") { describe("FBM noise func") {
it("has a gradient") { it("has a gradient") {
val func = fbmFunc1D(::perlinLinear) val func = fbmFunc1D(::perlinLinear)
gradient(func, 100, 0.1) gradient1D(func, 100, 0.1)
} }
} }
describe("Billow noise func") { describe("Billow noise func") {
it("has a gradient") { it("has a gradient") {
val func = billowFunc1D(::perlinLinear) val func = billowFunc1D(::perlinLinear)
gradient(func, 100, 0.1) gradient1D(func, 100, 0.1)
} }
} }
describe("Rigid noise func") { describe("Rigid noise func") {
it("has a gradient") { it("has a gradient") {
val func = rigidFunc1D(::perlinLinear) val func = rigidFunc1D(::perlinLinear)
gradient(func, 100, 0.1) gradient1D(func, 100, 0.1)
} }
} }
}) })