@Override public void setCurrentSample(final int sampleIndex, final double progressPercent, final Object applyTo) { final double[] store = (double[]) applyTo; // set key store[0] = MathUtils.lerp(progressPercent, _values[sampleIndex], _values[sampleIndex + 1]); }
@Override public void setCurrentSample(final int sampleIndex, final double progressPercent, final Object applyTo) { final double[] store = (double[]) applyTo; // set key store[0] = MathUtils.lerp(progressPercent, _values[sampleIndex], _values[sampleIndex + 1]); }
@Override public void setCurrentSample(final int sampleIndex, final double progressPercent, final Object applyTo) { final float[] store = (float[]) applyTo; // set key store[0] = MathUtils.lerp((float) progressPercent, _values[sampleIndex], _values[sampleIndex + 1]); }
@Override public void setCurrentSample(final int sampleIndex, final double progressPercent, final Object applyTo) { final float[] store = (float[]) applyTo; // set key store[0] = MathUtils.lerp((float) progressPercent, _values[sampleIndex], _values[sampleIndex + 1]); }
protected static void blendDoubleValue(final Map<String, Object> rVal, final String key, final double blendWeight, final double[] dataA, final double[] dataB) { if (dataB == null) { rVal.put(key, dataA); } else { double[] store = (double[]) rVal.get(key); if (store == null) { store = new double[1]; rVal.put(key, store); } store[0] = MathUtils.lerp(blendWeight, dataA[0], dataB[0]); } }
protected static void blendFloatValue(final Map<String, Object> rVal, final String key, final double blendWeight, final float[] dataA, final float[] dataB) { if (dataB == null) { rVal.put(key, dataA); } else { float[] store = (float[]) rVal.get(key); if (store == null) { store = new float[1]; rVal.put(key, store); } store[0] = MathUtils.lerp((float) blendWeight, dataA[0], dataB[0]); } }
protected static void blendDoubleValue(final Map<String, Object> rVal, final String key, final double blendWeight, final double[] dataA, final double[] dataB) { if (dataB == null) { rVal.put(key, dataA); } else { double[] store = (double[]) rVal.get(key); if (store == null) { store = new double[1]; rVal.put(key, store); } store[0] = MathUtils.lerp(blendWeight, dataA[0], dataB[0]); } }
protected static void blendFloatValue(final Map<String, Object> rVal, final String key, final double blendWeight, final float[] dataA, final float[] dataB) { if (dataB == null) { rVal.put(key, dataA); } else { float[] store = (float[]) rVal.get(key); if (store == null) { store = new float[1]; rVal.put(key, store); } store[0] = MathUtils.lerp((float) blendWeight, dataA[0], dataB[0]); } }
private float getWeightedHeight(final float viewX, final float viewY, final float h, final float w, final float scaledClipSideSize) { final float maxDistance = Math.max(viewX, viewY) / scaledClipSideSize; final float blend = MathUtils.clamp((maxDistance - 0.51f) * 2.2f, 0.0f, 1.0f); return MathUtils.lerp(blend, h, w); }
private float getWeightedHeight(final float viewX, final float viewY, final float h, final float w, final float scaledClipSideSize) { final float maxDistance = Math.max(viewX, viewY) / scaledClipSideSize; final float blend = MathUtils.clamp((maxDistance - 0.51f) * 2.2f, 0.0f, 1.0f); return MathUtils.lerp(blend, h, w); }
protected void updateTerrain(final int x, final int y, final int radius, final ColorRGBA paint, final float offset) { float r, dr; int dx, dy, index; byte red, green, blue, alpha; final int minY = Math.max(0, y - radius), maxY = Math.min(y + radius, side - 1); final int minX = Math.max(0, x - radius), maxX = Math.min(x + radius, side - 1); for (int i = minY; i <= maxY; i++) { dy = Math.abs(y - i); for (int j = minX; j <= maxX; j++) { dx = Math.abs(x - j); r = (float) MathUtils.sqrt(dx * dx + dy * dy); if (r <= radius) { dr = (radius - r) / radius; index = i * side + j; heightData[index] = Math.max(minHeight, Math.min(heightData[index] + dr * offset, maxHeight)); red = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 0] & 0xff, (paint.getRed() * 255)) & 0xff); green = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 1] & 0xff, (paint.getGreen() * 255)) & 0xff); blue = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 2] & 0xff, (paint.getBlue() * 255)) & 0xff); alpha = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 3] & 0xff, (paint.getAlpha() * 255)) & 0xff); colorData[index * 4 + 0] = red; colorData[index * 4 + 1] = green; colorData[index * 4 + 2] = blue; colorData[index * 4 + 3] = alpha; } } } }
protected void updateTerrain(final int x, final int y, final int radius, final ColorRGBA paint, final float offset) { float r, dr; int dx, dy, index; byte red, green, blue, alpha; final int minY = Math.max(0, y - radius), maxY = Math.min(y + radius, side - 1); final int minX = Math.max(0, x - radius), maxX = Math.min(x + radius, side - 1); for (int i = minY; i <= maxY; i++) { dy = Math.abs(y - i); for (int j = minX; j <= maxX; j++) { dx = Math.abs(x - j); r = (float) MathUtils.sqrt(dx * dx + dy * dy); if (r <= radius) { dr = (radius - r) / radius; index = i * side + j; heightData[index] = Math.max(minHeight, Math.min(heightData[index] + dr * offset, maxHeight)); red = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 0] & 0xff, (paint.getRed() * 255)) & 0xff); green = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 1] & 0xff, (paint.getGreen() * 255)) & 0xff); blue = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 2] & 0xff, (paint.getBlue() * 255)) & 0xff); alpha = (byte) ((int) MathUtils.lerp(dr, colorData[index * 4 + 3] & 0xff, (paint.getAlpha() * 255)) & 0xff); colorData[index * 4 + 0] = red; colorData[index * 4 + 1] = green; colorData[index * 4 + 2] = blue; colorData[index * 4 + 3] = alpha; } } } }
public double eval(final double x, final double y, final double z) { return MathUtils.lerp(amount, sourceA.eval(x, y, z), sourceB.eval(x, y, z)); } };
public double eval(final double x, final double y, final double z) { return MathUtils.lerp(amount, sourceA.eval(x, y, z), sourceB.eval(x, y, z)); } };