GradientNoiseProperty.java
package com.hypixel.hytale.procedurallib.property;
import com.hypixel.hytale.math.util.MathUtil;
import com.hypixel.hytale.math.util.TrigMathUtil;
public class GradientNoiseProperty implements NoiseProperty {
protected final NoiseProperty noise;
protected final GradientMode mode;
protected final double distance;
protected final double invNormalize;
public GradientNoiseProperty(NoiseProperty noise, GradientMode mode, double distance, double normalize) {
this.noise = noise;
this.mode = mode;
this.distance = distance;
this.invNormalize = 1.0 / distance / normalize;
}
public double get(int seed, double x, double y) {
double v = this.noise.get(seed, x, y);
double s .noise.get(seed, x, y + .distance);
.noise.get(seed, x + .distance, y);
e - v;
s - v;
var10000;
(.mode.ordinal()) {
-> var10000 = getMagnitude(dx, dy, .invNormalize);
-> var10000 = getAngle(dx, dy);
-> var10000 = getAbsAngle(dx, dy);
-> ((String), (Throwable));
}
var10000;
}
{
();
}
{
TrigMathUtil.atan2(dy, dx);
angle = (angle + ) / ;
()convertRange(angle);
}
{
TrigMathUtil.atan2(dy, dx);
()(Math.abs(angle) / );
}
{
MathUtil.length(dx, dy);
MathUtil.clamp(mag * invNormalize, , );
}
{
angle += ;
angle > ? angle - : angle;
}
{
MAGNITUDE,
ANGLE,
ANGLE_ABS;
{
}
}
}