Project

General

Profile

« Previous | Next » 

Revision 7fd5a84a

Added by Leszek Koltunski 3 days ago

  • ID 7fd5a84abee0530d4db8971b59a592a5c6883abb
  • Parent 0bff60a4

minor

View differences:

src/main/java/org/distorted/library/type/Dynamic.kt
21 21
package org.distorted.library.type
22 22

  
23 23
import org.distorted.library.main.DistortedLibrary
24
import java.util.Random
24
import kotlin.random.Random
25 25
import java.util.Vector
26 26
import kotlin.math.sqrt
27 27

  
......
113 113
        // remember this many 'points' inside the Cache for each segment.
114 114
        protected val mTmpRatio: FloatArray = FloatArray(NUM_RATIO)
115 115

  
116
        private val mRnd = Random()
116
        private val mRnd = Random(17)   // why not?
117 117
        private const val NUM_NOISE = 5 // used iff mNoise>0.0. Number of intermediary points between each pair of adjacent vectors
118 118
        private var mPausedTime: Long = 0
119 119

  
src/main/java/org/distorted/library/type/Dynamic1D.kt
187 187
        if (v!=null)
188 188
        {
189 189
            vv.add(v)
190

  
191
            if (vn!=null) vn!!.add(VectorNoise())
190
            vn?.add(VectorNoise())
192 191

  
193 192
            when (numPoints)
194 193
            {
......
224 223
        if (v!=null)
225 224
        {
226 225
            vv.add(index,v)
227

  
228
            if (vn!=null) vn!!.add(VectorNoise())
226
            vn?.add(VectorNoise())
229 227

  
230 228
            when (numPoints)
231 229
            {
......
264 262
        while (n>=0)
265 263
        {
266 264
            vv.removeAt(n)
267

  
268
            if (vn!=null) vn!!.removeAt(0)
265
            vn?.removeAt(0)
269 266

  
270 267
            when (numPoints)
271 268
            {
......
298 295
        if (index in 0..<numPoints)
299 296
        {
300 297
            vv.removeElementAt(index)
301

  
302
            if (vn!=null) vn!!.removeAt(0)
298
            vn?.removeAt(0)
303 299

  
304 300
            when (numPoints)
305 301
            {
......
326 322
        vv.removeAllElements()
327 323
        vc!!.removeAllElements()
328 324
        cacheDirty = false
329
        if (vn!=null) vn!!.removeAllElements()
325
        vn?.removeAllElements()
330 326
    }
331 327

  
332 328
    ///////////////////////////////////////////////////////////////////////////////////////////////
......
409 405
                            if (cache.cached[0]!=next.x) recomputeCache()
410 406
                        }
411 407

  
412
                        if (mSegment != mTmpSeg && vn != null) vn!!.elementAt(mTmpVec).computeNoise()
408
                        if (mSegment != mTmpSeg ) vn?.elementAt(mTmpVec)?.computeNoise()
413 409

  
414 410
                        mSegment = mTmpSeg
415 411
                        time = mTmpTime - mTmpVec
src/main/java/org/distorted/library/type/Dynamic2D.kt
222 222
        if (v!=null)
223 223
        {
224 224
            vv.add(v)
225

  
226
            if (vn!=null) vn!!.add(VectorNoise())
225
            vn?.add(VectorNoise())
227 226

  
228 227
            when (numPoints)
229 228
            {
......
255 254
        if (v != null)
256 255
        {
257 256
            vv.add(index,v)
258

  
259
            if (vn!=null) vn!!.add(VectorNoise())
257
            vn?.add(VectorNoise())
260 258

  
261 259
            when (numPoints)
262 260
            {
......
291 289
        while (n>=0)
292 290
        {
293 291
            vv.removeAt(n)
294

  
295
            if (vn!=null) vn!!.removeAt(0)
292
            vn?.removeAt(0)
296 293

  
297 294
            when (numPoints)
298 295
            {
......
323 320
        if (index in 0..<numPoints)
324 321
        {
325 322
            vv.removeElementAt(index)
326
            if (vn!=null) vn!!.removeAt(0)
323
            vn?.removeAt(0)
327 324

  
328 325
            when (numPoints)
329 326
            {
......
350 347
        vv.removeAllElements()
351 348
        vc!!.removeAllElements()
352 349
        cacheDirty = false
353

  
354
        if (vn!=null) vn!!.removeAllElements()
350
        vn?.removeAllElements()
355 351
    }
356 352

  
357 353
    ///////////////////////////////////////////////////////////////////////////////////////////////
......
451 447
                            if (cache.cached[0]!=next.x || cache.cached[1]!=next.y) recomputeCache()
452 448
                        }
453 449

  
454
                    if (mSegment!=mTmpSeg && vn!=null) vn!!.elementAt(mTmpVec).computeNoise()
450
                    if( mSegment!=mTmpSeg ) vn?.elementAt(mTmpVec)?.computeNoise()
455 451

  
456 452
                    mSegment = mTmpSeg
457 453
                    time = mTmpTime - mTmpVec
src/main/java/org/distorted/library/type/Dynamic3D.kt
244 244
        if (v != null)
245 245
        {
246 246
            vv.add(v)
247
            if (vn!=null) vn!!.add(VectorNoise())
247
            vn?.add(VectorNoise())
248 248

  
249 249
            when (numPoints)
250 250
            {
......
276 276
        if (v != null)
277 277
        {
278 278
            vv.add(index,v)
279

  
280
            if (vn!=null) vn!!.add(VectorNoise())
279
            vn?.add(VectorNoise())
281 280

  
282 281
            when (numPoints)
283 282
            {
......
312 311
        while (n >= 0)
313 312
        {
314 313
            vv.removeAt(n)
315
            if (vn != null) vn!!.removeAt(0)
314
            vn?.removeAt(0)
316 315

  
317 316
            when (numPoints)
318 317
            {
......
347 346
        if (index in 0..<numPoints)
348 347
        {
349 348
            vv.removeElementAt(index)
350

  
351
            if (vn!=null) vn!!.removeAt(0)
349
            vn?.removeAt(0)
352 350

  
353 351
            when (numPoints)
354 352
            {
......
379 377
        vv.removeAllElements()
380 378
        vc!!.removeAllElements()
381 379
        cacheDirty = false
382
        if (vn!=null) vn!!.removeAllElements()
380
        vn?.removeAllElements()
383 381
    }
384 382

  
385 383
    ///////////////////////////////////////////////////////////////////////////////////////////////
......
479 477
                            if (cache.cached[0]!=next.x || cache.cached[1]!=next.y || cache.cached[2]!=next.z) recomputeCache()
480 478
                        }
481 479

  
482
                        if (mSegment!=mTmpSeg && vn!=null) vn!!.elementAt(mTmpVec).computeNoise()
480
                        if( mSegment!=mTmpSeg ) vn?.elementAt(mTmpVec)?.computeNoise()
483 481

  
484 482
                        mSegment = mTmpSeg
485 483
                        time = mTmpTime - mTmpVec
src/main/java/org/distorted/library/type/Dynamic4D.kt
267 267
        if (v!=null)
268 268
        {
269 269
            vv.add(v)
270

  
271
            if (vn!=null) vn!!.add(VectorNoise())
270
            vn?.add(VectorNoise())
272 271

  
273 272
            when (numPoints)
274 273
            {
......
299 298
        if (v != null)
300 299
        {
301 300
            vv.add(index,v)
302
            if (vn!=null) vn!!.add(VectorNoise())
301
            vn?.add(VectorNoise())
303 302

  
304 303
            when (numPoints)
305 304
            {
......
333 332
        while (n >= 0)
334 333
        {
335 334
            vv.removeAt(n)
336
            if (vn!=null) vn!!.removeAt(0)
335
            vn?.removeAt(0)
337 336

  
338 337
            when (numPoints)
339 338
            {
......
367 366
        if (index in 0..<numPoints)
368 367
        {
369 368
            vv.removeElementAt(index)
370
            if (vn!=null) vn!!.removeAt(0)
369
            vn?.removeAt(0)
371 370

  
372 371
            when (numPoints)
373 372
            {
......
398 397
        vv.removeAllElements()
399 398
        vc!!.removeAllElements()
400 399
        cacheDirty = false
401
        if (vn != null) vn!!.removeAllElements()
400
        vn?.removeAllElements()
402 401
    }
403 402

  
404 403
    ///////////////////////////////////////////////////////////////////////////////////////////////
......
505 504
                            if (cache.cached[0]!=next.x || cache.cached[1]!=next.y || cache.cached[2]!=next.z || cache.cached[3]!=next.w) recomputeCache()
506 505
                        }
507 506

  
508
                        if (mSegment!=mTmpSeg && vn!=null) vn!!.elementAt(mTmpVec).computeNoise()
507
                        if( mSegment!=mTmpSeg ) vn?.elementAt(mTmpVec)?.computeNoise()
509 508

  
510 509
                        mSegment = mTmpSeg
511 510
                        time = mTmpTime - mTmpVec
src/main/java/org/distorted/library/type/Dynamic5D.kt
290 290
        if (v != null)
291 291
        {
292 292
            vv.add(v)
293
            if (vn!=null) vn!!.add(VectorNoise())
293
            vn?.add(VectorNoise())
294 294

  
295 295
            when (numPoints)
296 296
            {
......
321 321
        if (v!=null)
322 322
        {
323 323
            vv.add(index,v)
324
            if (vn!=null) vn!!.add(VectorNoise())
324
            vn?.add(VectorNoise())
325 325

  
326 326
            when (numPoints)
327 327
            {
......
355 355
        while (n>=0)
356 356
        {
357 357
            vv.removeAt(n)
358
            if (vn!=null) vn!!.removeAt(0)
358
            vn?.removeAt(0)
359 359

  
360 360
            when (numPoints)
361 361
            {
......
389 389
        if (index in 0..<numPoints)
390 390
        {
391 391
            vv.removeElementAt(index)
392
            if (vn!=null) vn!!.removeAt(0)
392
            vn?.removeAt(0)
393 393

  
394 394
            when (numPoints)
395 395
            {
......
419 419
        vv.removeAllElements()
420 420
        vc!!.removeAllElements()
421 421
        cacheDirty = false
422
        if (vn != null) vn!!.removeAllElements()
422
        vn?.removeAllElements()
423 423
    }
424 424

  
425 425
    ///////////////////////////////////////////////////////////////////////////////////////////////
......
534 534
                            if (cache.cached[0]!=next.x || cache.cached[1]!=next.y || cache.cached[2]!=next.z || cache.cached[3]!=next.w || cache.cached[4]!=next.v) recomputeCache()
535 535
                        }
536 536

  
537
                        if (mSegment!=mTmpSeg && vn!=null) vn!!.elementAt(mTmpVec).computeNoise()
537
                        if( mSegment!=mTmpSeg ) vn?.elementAt(mTmpVec)?.computeNoise()
538 538

  
539 539
                        mSegment = mTmpSeg
540 540
                        time = mTmpTime - mTmpVec

Also available in: Unified diff