mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-16 13:23:07 +00:00
terraScript random is no more
This commit is contained in:
@@ -9,11 +9,12 @@ package com.dfsek.terra.api.structure;
|
||||
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.noise.NoiseSampler;
|
||||
import com.dfsek.terra.api.util.Rotation;
|
||||
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
|
||||
public interface Structure {
|
||||
boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation);
|
||||
boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long Seed);
|
||||
}
|
||||
|
||||
@@ -173,4 +173,21 @@ public final class MathUtil {
|
||||
|
||||
return mu + sigma * val;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1D Linear interpolation between 2 points 1 unit apart.
|
||||
*
|
||||
* @param t - Distance from v0. Total distance between v0 and v1 is 1 unit.
|
||||
* @param v0 - Value at v0.
|
||||
* @param v1 - Value at v1.
|
||||
*
|
||||
* @return double - The interpolated value.
|
||||
*/
|
||||
public static double lerp(double t, double v0, double v1) {
|
||||
return v0 + t * (v1 - v0);
|
||||
}
|
||||
|
||||
public static double inverseLerp(double t, double v0, double v1) {
|
||||
return (t - v0) / (v1 - v0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user