Revision 1e22c248
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/type/Dynamic1D.java | ||
---|---|---|
341 | 341 |
|
342 | 342 |
if( vn!=null ) vn.removeAllElements(); |
343 | 343 |
} |
344 |
|
|
344 |
|
|
345 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
346 |
/** |
|
347 |
* Sets the 'smoothness' of interpolation. |
|
348 |
* <p> |
|
349 |
* When Noise=0 (the default), we interpolate between our Points through the most smooth path possible. |
|
350 |
* Increasing noise makes the Dynamic increasingly deviate from this path, pseudo-randomly speeding |
|
351 |
* up and slowing down, etc. |
|
352 |
* |
|
353 |
* @param noise The noise level. Permitted range: 0 <= noise <= 1. |
|
354 |
*/ |
|
355 |
|
|
356 |
public synchronized void setNoise(Static1D noise) |
|
357 |
{ |
|
358 |
if( vn==null ) |
|
359 |
{ |
|
360 |
vn = new Vector<>(); |
|
361 |
for(int i=0; i<numPoints; i++) vn.add(new VectorNoise(mDimension)); |
|
362 |
|
|
363 |
if( mDimension>=2 ) |
|
364 |
{ |
|
365 |
mFactor = new float[mDimension-1]; |
|
366 |
} |
|
367 |
|
|
368 |
mNoise = new float[mDimension]; |
|
369 |
} |
|
370 |
|
|
371 |
if( noise.x<0.0f ) noise.x = 0.0f; |
|
372 |
if( noise.x>1.0f ) noise.x = 1.0f; |
|
373 |
|
|
374 |
mNoise[0] = noise.x; |
|
375 |
} |
|
376 |
|
|
345 | 377 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
346 | 378 |
/** |
347 | 379 |
* Writes the results of interpolation between the Points at time 'time' to the passed float buffer. |
Also available in: Unified diff
Fix 4D and 5D noise, make noise N dimensional.