public abstract class AbstractKernel
extends com.amd.aparapi.Kernel
Kernel
class that adds additional features.
The features added are the following:
PI
com.amd.aparapi.Kernel.Constant, com.amd.aparapi.Kernel.Entry, com.amd.aparapi.Kernel.EXECUTION_MODE, com.amd.aparapi.Kernel.KernelState, com.amd.aparapi.Kernel.Local, com.amd.aparapi.Kernel.NoCL, com.amd.aparapi.Kernel.OpenCLDelegate, com.amd.aparapi.Kernel.OpenCLMapping, com.amd.aparapi.Kernel.PrivateMemorySpace
Modifier and Type | Field and Description |
---|---|
protected float |
amplitude
The global amplitude.
|
protected float[] |
cosTable
The cosine table (array) used by this
AbstractKernel instance. |
static float |
EPSILON
A very small number.
|
protected float |
frequency
The global frequency.
|
protected float |
gain
The global gain.
|
static float |
INFINITY
A very large number.
|
protected float |
lacunarity
The global lacunarity.
|
protected int |
octaves
The global octaves.
|
protected int[] |
permutations
A permutations array used by the Perlin- and Simplex noise algorithms.
|
protected int[] |
permutationsModulo12
A permutations array used by the Simplex noise algorithms.
|
static float |
PI
The
float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter. |
static float |
PI_DIVIDED_BY_180
The
float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, divided by 180.0F . |
static float |
PI_DIVIDED_BY_360
The
float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, divided by 360.0F . |
static float |
PI_MULTIPLIED_BY_TWO
The
float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, multiplied by 2.0F . |
static float |
PI_MULTIPLIED_BY_TWO_RECIPROCAL
The reciprocal of the
float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, multiplied by 2.0F . |
static float |
PI_RECIPROCAL
The reciprocal of the
float value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter. |
protected long[] |
seeds
The seed array used by this
AbstractKernel instance. |
protected float[] |
simplexGradient3
A gradient array used by the Simplex noise algorithms.
|
protected float[] |
simplexGradient4
A gradient array used by the Simplex noise algorithms.
|
protected float[] |
sinTable
The sine table (array) used by this
AbstractKernel instance. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractKernel()
Constructs a new
AbstractKernel instance. |
Modifier and Type | Method and Description |
---|---|
float |
bytesToFloat(byte b0,
byte b1,
byte b2,
byte b3)
Returns a
float value based on four byte s. |
float |
cosDegrees(float degrees)
Returns the cosine of the angle
degrees . |
float |
cosRadians(float radians)
Returns the cosine of the angle
radians . |
float |
getAmplitude()
Returns the global amplitude.
|
float |
getFrequency()
Returns the global frequency.
|
float |
getGain()
Returns the global gain.
|
float |
getLacunarity()
Returns the global lacunarity.
|
int |
getOctaves()
Returns the global octaves.
|
float |
modulo(float value)
Returns the modulo of
value . |
float |
nextFloat()
Returns the next pseudorandom, uniformly distributed
float value between 0.0 and 1.0 from the random number generator's sequence. |
float |
perlinNoiseXYZ(float x,
float y,
float z)
Returns a
float with noise computed by the Perlin algorithm using the coordinates X, Y and Z. |
float |
remainder(float x,
float y)
Returns the remainder of
x and y . |
float |
saturate(float value,
float a,
float b)
Performs saturation arithmetic on
value . |
void |
setAmplitude(float amplitude)
Sets the global amplitude
|
void |
setFrequency(float frequency)
Sets the global frequency
|
void |
setGain(float gain)
Sets the global gain
|
void |
setLacunarity(float lacunarity)
Sets the global lacunarity
|
void |
setOctaves(int octaves)
Sets the global octaves
|
float |
simplexFractalXY(float amplitude,
float frequency,
float gain,
float lacunarity,
int octaves,
float x,
float y)
Returns a
float with noise computed by a Simplex-based fractal algorithm using the coordinates X and Y. |
float |
simplexFractalXYZ(float amplitude,
float frequency,
float gain,
float lacunarity,
int octaves,
float x,
float y,
float z)
Returns a
float with noise computed by a Simplex-based fractal algorithm using the coordinates X, Y and Z. |
float |
simplexFractalXYZW(float amplitude,
float frequency,
float gain,
float lacunarity,
int octaves,
float x,
float y,
float z,
float w)
Returns a
float with noise computed by a Simplex-based fractal algorithm using the coordinates X, Y, Z and W. |
float |
simplexFractionalBrownianMotionXY(float frequency,
float gain,
float minimum,
float maximum,
int octaves,
float x,
float y)
Returns a
float with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X and Y. |
float |
simplexFractionalBrownianMotionXYZ(float frequency,
float gain,
float minimum,
float maximum,
int octaves,
float x,
float y,
float z)
Returns a
float with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X, Y and Z. |
float |
simplexFractionalBrownianMotionXYZW(float frequency,
float gain,
float minimum,
float maximum,
int octaves,
float x,
float y,
float z,
float w)
Returns a
float with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X, Y, Z and W. |
float |
simplexNoiseXY(float x,
float y)
Returns a
float with noise computed by the Simplex algorithm using the coordinates X and Y. |
float |
simplexNoiseXYZ(float x,
float y,
float z)
Returns a
float with noise computed by the Simplex algorithm using the coordinates X, Y and Z. |
float |
simplexNoiseXYZW(float x,
float y,
float z,
float w)
Returns a
float with noise computed by the Simplex algorithm using the coordinates X, Y, Z and W. |
float |
sinDegrees(float degrees)
Returns the sine of the angle
degrees . |
float |
sinRadians(float radians)
Returns the sine of the angle
radians . |
void |
update(int width,
int height)
Updates all necessary variables in this
AbstractKernel instance. |
abs, abs, abs, abs, acos, acos, acospi, acospi, addExecutionModes, asin, asin, asinpi, asinpi, atan, atan, atan2, atan2, atan2pi, atan2pi, atanpi, atanpi, atomicAdd, cancelMultiPass, cbrt, cbrt, ceil, ceil, cleanUpArrays, clone, cos, cos, cosh, cosh, cospi, cospi, createRange, dispose, execute, execute, execute, execute, execute, execute, executeFallbackAlgorithm, exp, exp, exp10, exp10, exp2, exp2, expm1, expm1, floor, floor, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAccumulatedExecutionTime, getCancelState, getConversionTime, getCurrentPass, getExecutionMode, getExecutionTime, getGlobalId, getGlobalId, getGlobalSize, getGlobalSize, getGroupId, getGroupId, getKernelState, getLocalId, getLocalId, getLocalSize, getLocalSize, getMappedMethodName, getNumGroups, getNumGroups, getPassId, getProfileInfo, getTargetDevice, globalBarrier, hasFallbackAlgorithm, hasNextExecutionMode, hypot, hypot, IEEEremainder, IEEEremainder, invalidateCaches, isAllowDevice, isAutoCleanUpArrays, isExecuting, isExplicit, isMappedMethod, isOpenCLDelegateMethod, isRunningCL, localBarrier, log, log, log10, log10, log1p, log1p, log2, log2, mad, mad, max, max, max, max, min, min, min, min, nextAfter, nextAfter, pow, pow, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, rint, rint, round, round, rsqrt, rsqrt, run, setAutoCleanUpArrays, setExecutionMode, setExplicit, setFallbackExecutionMode, sin, sin, sinh, sinh, sinpi, sinpi, sqrt, sqrt, tan, tan, tanh, tanh, tanpi, tanpi, toDegrees, toDegrees, toRadians, toRadians, toString, tryNextExecutionMode, usesAtomic32, usesAtomic64
public static final float EPSILON
public static final float INFINITY
public static final float PI
float
value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.public static final float PI_DIVIDED_BY_180
float
value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, divided by 180.0F
.public static final float PI_DIVIDED_BY_360
float
value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, divided by 360.0F
.public static final float PI_MULTIPLIED_BY_TWO
float
value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, multiplied by 2.0F
.public static final float PI_MULTIPLIED_BY_TWO_RECIPROCAL
float
value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter, multiplied by 2.0F
.public static final float PI_RECIPROCAL
float
value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.protected float amplitude
protected float frequency
protected float gain
protected float lacunarity
protected float[] cosTable
AbstractKernel
instance.
It appears that it cannot be private for Aparapi and OpenCL to work.
protected float[] simplexGradient3
It appears that it cannot be private for Aparapi and OpenCL to work.
protected float[] simplexGradient4
It appears that it cannot be private for Aparapi and OpenCL to work.
protected float[] sinTable
AbstractKernel
instance.
It appears that it cannot be private for Aparapi and OpenCL to work.
protected int octaves
protected int[] permutations
It appears that it cannot be private for Aparapi and OpenCL to work.
protected int[] permutationsModulo12
It appears that it cannot be private for Aparapi and OpenCL to work.
protected long[] seeds
AbstractKernel
instance.
It appears that it cannot be private for Aparapi and OpenCL to work.
protected AbstractKernel()
AbstractKernel
instance.public final float bytesToFloat(byte b0, byte b1, byte b2, byte b3)
float
value based on four byte
s.b0
- the first byte
b1
- the second byte
b2
- the third byte
b3
- the fourth byte
float
value based on four byte
spublic final float cosDegrees(float degrees)
degrees
.
The angle degrees
must be in degrees.
degrees
- an angle in degreesdegrees
public final float cosRadians(float radians)
radians
.
The angle radians
must be in radians.
radians
- an angle in radiansradians
public final float getAmplitude()
public final float getFrequency()
public final float getGain()
public final float getLacunarity()
public final float modulo(float value)
value
.
This operation is equivalent to value - floor(value)
.
value
- the value to perform the modulo operation onvalue
public final float nextFloat()
float
value between 0.0
and 1.0
from the random number generator's sequence.
This method is intended to be used by run()
-reachable code.
float
value between 0.0
and 1.0
from the random number generator's sequencepublic final float perlinNoiseXYZ(float x, float y, float z)
float
with noise computed by the Perlin algorithm using the coordinates X, Y and Z.x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatefloat
with noise computed by the Perlin algorithm using the coordinates X, Y and Zpublic final float remainder(float x, float y)
x
and y
.x
- the left hand side of the remainder operationy
- the right hand side of the remainder operationx
and y
public final float saturate(float value, float a, float b)
value
.
Returns value
if, and only if, min(a, b) <= value <= max(a, b)
, otherwise either a
or b
.
If value
is less than min(a, b)
, then min(a, b)
will be returned.
If value
is greater than max(a, b)
, then max(a, b)
will be returned.
value
- a float
valuea
- either the minimum or the maximum valueb
- either the minimum or the maximum valuevalue
if, and only if, min(a, b) <= value <= max(a, b)
, otherwise either a
or b
public final float simplexFractalXY(float amplitude, float frequency, float gain, float lacunarity, int octaves, float x, float y)
float
with noise computed by a Simplex-based fractal algorithm using the coordinates X and Y.amplitude
- the amplitude to start atfrequency
- the frequency to start atgain
- the amplitude multiplierlacunarity
- the frequency multiplieroctaves
- the number of iterations to performx
- the X-coordinatey
- the Y-coordinatefloat
with noise computed by a Simplex-based fractal algorithm using the coordinates X and Ypublic final float simplexFractalXYZ(float amplitude, float frequency, float gain, float lacunarity, int octaves, float x, float y, float z)
float
with noise computed by a Simplex-based fractal algorithm using the coordinates X, Y and Z.amplitude
- the amplitude to start atfrequency
- the frequency to start atgain
- the amplitude multiplierlacunarity
- the frequency multiplieroctaves
- the number of iterations to performx
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatefloat
with noise computed by a Simplex-based fractal algorithm using the coordinates X, Y and Zpublic final float simplexFractalXYZW(float amplitude, float frequency, float gain, float lacunarity, int octaves, float x, float y, float z, float w)
float
with noise computed by a Simplex-based fractal algorithm using the coordinates X, Y, Z and W.amplitude
- the amplitude to start atfrequency
- the frequency to start atgain
- the amplitude multiplierlacunarity
- the frequency multiplieroctaves
- the number of iterations to performx
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatew
- the W-coordinatefloat
with noise computed by a Simplex-based fractal algorithm using the coordinates X, Y, Z and Wpublic final float simplexFractionalBrownianMotionXY(float frequency, float gain, float minimum, float maximum, int octaves, float x, float y)
float
with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X and Y.frequency
- the frequency to start atgain
- the amplitude multiplierminimum
- the minimum value to returnmaximum
- the maximum value to returnoctaves
- the number of iterations to performx
- the X-coordinatey
- the Y-coordinatefloat
with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X and Ypublic final float simplexFractionalBrownianMotionXYZ(float frequency, float gain, float minimum, float maximum, int octaves, float x, float y, float z)
float
with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X, Y and Z.frequency
- the frequency to start atgain
- the amplitude multiplierminimum
- the minimum value to returnmaximum
- the maximum value to returnoctaves
- the number of iterations to performx
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatefloat
with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X, Y and Zpublic final float simplexFractionalBrownianMotionXYZW(float frequency, float gain, float minimum, float maximum, int octaves, float x, float y, float z, float w)
float
with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X, Y, Z and W.frequency
- the frequency to start atgain
- the amplitude multiplierminimum
- the minimum value to returnmaximum
- the maximum value to returnoctaves
- the number of iterations to performx
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatew
- the W-coordinatefloat
with noise computed by a Simplex-based fractional Brownian motion (fBm) algorithm using the coordinates X, Y, Z and Wpublic final float simplexNoiseXY(float x, float y)
float
with noise computed by the Simplex algorithm using the coordinates X and Y.x
- the X-coordinatey
- the Y-coordinatefloat
with noise computed by the Simplex algorithm using the coordinates X and Ypublic final float simplexNoiseXYZ(float x, float y, float z)
float
with noise computed by the Simplex algorithm using the coordinates X, Y and Z.x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatefloat
with noise computed by the Simplex algorithm using the coordinates X, Y and Zpublic final float simplexNoiseXYZW(float x, float y, float z, float w)
float
with noise computed by the Simplex algorithm using the coordinates X, Y, Z and W.x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatew
- the W-coordinatefloat
with noise computed by the Simplex algorithm using the coordinates X, Y, Z and Wpublic final float sinDegrees(float degrees)
degrees
.
The angle degrees
must be in degrees.
degrees
- an angle in degreesdegrees
public final float sinRadians(float radians)
radians
.
The angle radians
must be in radians.
radians
- an angle in radiansradians
public final int getOctaves()
public final void setAmplitude(float amplitude)
amplitude
- the new global amplitudepublic final void setFrequency(float frequency)
frequency
- the new global frequencypublic final void setGain(float gain)
gain
- the new global gainpublic final void setLacunarity(float lacunarity)
lacunarity
- the new global lacunaritypublic final void setOctaves(int octaves)
octaves
- the new global octavespublic final void update(int width, int height)
AbstractKernel
instance.
This method should not be called by run()
-reachable code, because it uses a ThreadLocalRandom
to update the PRNG.
width
- the width of this AbstractKernel
instanceheight
- the height of this AbstractKernel
instance