MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / seedImage

Method seedImage

src/main/java/trace/simulation/GrayScott.kt:145–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 }
144
145 fun seedImage(pixels: IntArray, imgWidth: Int, imgHeight: Int) {
146 var imgWidth = imgWidth
147 var imgHeight = imgHeight
148 val xo = clip((width - imgWidth) / 2, 0, width - 1)
149 val yo = clip((height - imgHeight) / 2, 0, height - 1)
150 imgWidth = min(imgWidth, width)
151 imgHeight = min(imgHeight, height)
152 for (y in 0 until imgHeight) {
153 val i = y * imgWidth
154 for (x in 0 until imgWidth) {
155 if (0 < pixels[i + x] and 0xff) {
156 val idx = (yo + y) * width + xo + x
157 uu[idx] = 0.5f
158 vv[idx] = 0.25f
159 }
160 }
161 }
162 }
163
164 fun setCoefficients(f: Float, k: Float, dU: Float, dV: Float) {
165 this.f = f

Callers

nothing calls this directly

Calls 1

minFunction · 0.85

Tested by

no test coverage detected