mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-01-01 21:36:29 +00:00
Scaffolding changes
This commit is contained in:
@@ -1,175 +0,0 @@
|
||||
package com.volmit.iris.gen.v2;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.ArrayHunk;
|
||||
import com.volmit.iris.gen.v2.scaffold.Hunk;
|
||||
import com.volmit.iris.gen.v2.scaffold.HunkFace;
|
||||
|
||||
public class HunkView<T> implements Hunk<T>
|
||||
{
|
||||
private final int ox;
|
||||
private final int oy;
|
||||
private final int oz;
|
||||
private final int w;
|
||||
private final int h;
|
||||
private final int d;
|
||||
private final Hunk<T> src;
|
||||
|
||||
public HunkView(Hunk<T> src)
|
||||
{
|
||||
this(src, src.getWidth(), src.getHeight(), src.getDepth());
|
||||
}
|
||||
|
||||
public HunkView(Hunk<T> src, int w, int h, int d)
|
||||
{
|
||||
this(src, w, h, d, 0, 0, 0);
|
||||
}
|
||||
|
||||
public HunkView(Hunk<T> src, int w, int h, int d, int ox, int oy, int oz)
|
||||
{
|
||||
this.src = src;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
this.d = d;
|
||||
this.ox = ox;
|
||||
this.oy = oy;
|
||||
this.oz = oz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hunk<T> croppedView(int x1, int y1, int z1, int x2, int y2, int z2)
|
||||
{
|
||||
return new HunkView<T>(this, x2 - x1, y2 - y1, z2 - z1, x1 + ox, y1 + oy, z1 + oz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayHunk<T> crop(int x1, int y1, int z1, int x2, int y2, int z2)
|
||||
{
|
||||
ArrayHunk<T> h = new ArrayHunk<T>(x2 - x1, y2 - y1, z2 - z1);
|
||||
|
||||
for(int i = x1; i < x2; i++)
|
||||
{
|
||||
for(int j = y1; j < y2; j++)
|
||||
{
|
||||
for(int k = z1; k < z2; k++)
|
||||
{
|
||||
h.set(i - x1, j - y1, k - z1, get(i, j, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(int offX, int offY, int offZ, Hunk<T> hunk, boolean invertY)
|
||||
{
|
||||
if(offX + (hunk.getWidth() - 1) >= w || offY + (hunk.getHeight() - 1) >= h || offZ + (hunk.getDepth() - 1) >= d || offX < 0 || offY < 0 || offZ < 0)
|
||||
{
|
||||
throw new RuntimeException("Cannot insert hunk " + hunk.getWidth() + "," + hunk.getHeight() + "," + hunk.getDepth() + " into Hunk " + w + "," + h + "," + d + " with offset " + offZ + "," + offY + "," + offZ);
|
||||
}
|
||||
|
||||
for(int i = offX; i < offX + hunk.getWidth(); i++)
|
||||
{
|
||||
for(int j = offY; j < offY + hunk.getHeight(); j++)
|
||||
{
|
||||
for(int k = offZ; k < offZ + hunk.getDepth(); k++)
|
||||
{
|
||||
set(i, j, k, hunk.get(i - offX, j - offY, k - offZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x1, int y1, int z1, int x2, int y2, int z2, T t)
|
||||
{
|
||||
if(x1 >= w || y1 >= h || z1 >= d || x2 >= w || y2 >= h || z2 >= d)
|
||||
{
|
||||
throw new RuntimeException(x1 + "-" + x2 + " " + y1 + "-" + y2 + " " + z1 + "-" + z2 + " is out of the bounds 0,0,0 - " + (w - 1) + "," + (h - 1) + "," + (d - 1));
|
||||
}
|
||||
|
||||
src.set(x1, y1, z1, x2, y2, z2, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, T t)
|
||||
{
|
||||
if(x >= w || y >= h || z >= d)
|
||||
{
|
||||
throw new RuntimeException(x + " " + y + " " + z + " is out of the bounds 0,0,0 - " + (w - 1) + "," + (h - 1) + "," + (d - 1));
|
||||
}
|
||||
|
||||
src.set(x + ox, y + oy, z + oz, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(int x, int y, int z)
|
||||
{
|
||||
if(x >= w || y >= h || z >= d)
|
||||
{
|
||||
throw new RuntimeException(x + " " + y + " " + z + " is out of the bounds 0,0,0 - " + (w - 1) + "," + (h - 1) + "," + (d - 1));
|
||||
}
|
||||
|
||||
return src.get(x + ox, y + oy, z + oz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getClosest(int x, int y, int z)
|
||||
{
|
||||
return src.get(x >= w ? w + ox - 1 : x + ox, y >= h ? h + oy - 1 : y + oy, z >= d ? d + oz - 1 : z + oz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fill(T t)
|
||||
{
|
||||
set(0 + ox, 0 + oy, 0 + oz, w - 1 + ox, h - 1 + oy, d - 1 + oz, t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDepth()
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return h;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hunk<T> getFace(HunkFace f)
|
||||
{
|
||||
switch(f)
|
||||
{
|
||||
case BOTTOM:
|
||||
return croppedView(0, 0, 0, getWidth() - 1, 0, getDepth() - 1);
|
||||
case EAST:
|
||||
return croppedView(getWidth() - 1, 0, 0, getWidth() - 1, getHeight() - 1, getDepth() - 1);
|
||||
case NORTH:
|
||||
return croppedView(0, 0, 0, getWidth() - 1, getHeight() - 1, 0);
|
||||
case SOUTH:
|
||||
return croppedView(0, 0, 0, 0, getHeight() - 1, getDepth() - 1);
|
||||
case TOP:
|
||||
return croppedView(0, getHeight() - 1, 0, getWidth() - 1, getHeight() - 1, getDepth() - 1);
|
||||
case WEST:
|
||||
return croppedView(0, 0, getDepth() - 1, getWidth() - 1, getHeight() - 1, getDepth() - 1);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hunk<T> getSource()
|
||||
{
|
||||
return src;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
package com.volmit.iris.gen.v2;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.Interpolated;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.object.InferredType;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
||||
import com.volmit.iris.object.IrisBiomePaletteLayer;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.object.NoiseStyle;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.M;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@@ -18,14 +23,19 @@ import lombok.Data;
|
||||
public class IrisComplex implements DataProvider
|
||||
{
|
||||
private IrisDataManager data;
|
||||
private KList<IrisGenerator> generators;
|
||||
private static final BlockData AIR = Material.AIR.createBlockData();
|
||||
private ProceduralStream<IrisRegion> regionStream;
|
||||
private ProceduralStream<InferredType> bridgeStream;
|
||||
private ProceduralStream<IrisBiome> landBiomeStream;
|
||||
private ProceduralStream<IrisBiome> seaBiomeStream;
|
||||
private ProceduralStream<IrisBiome> shoreBiomeStream;
|
||||
private ProceduralStream<IrisBiome> baseBiomeStream;
|
||||
private ProceduralStream<IrisBiome> trueBiomeStream;
|
||||
private ProceduralStream<Double> heightStream;
|
||||
private ProceduralStream<Double> heightMinStream;
|
||||
private ProceduralStream<BlockData> terrainStream;
|
||||
private ProceduralStream<BlockData> rockStream;
|
||||
private ProceduralStream<BlockData> fluidStream;
|
||||
|
||||
public IrisComplex()
|
||||
{
|
||||
@@ -60,53 +70,177 @@ public class IrisComplex implements DataProvider
|
||||
public void flash(long seed, IrisDimension dimension, IrisDataManager data)
|
||||
{
|
||||
this.data = data;
|
||||
double fluidHeight = dimension.getFluidHeight();
|
||||
generators = new KList<>();
|
||||
RNG rng = new RNG(seed);
|
||||
//@builder
|
||||
regionStream = NoiseStyle.CELLULAR.stream(rng.nextRNG())
|
||||
.zoom(4)
|
||||
dimension.getRegions().forEach((i) -> data.getRegionLoader().load(i)
|
||||
.getAllBiomes(this).forEach((b) -> b
|
||||
.getGenerators()
|
||||
.forEach((c) -> registerGenerator(c.getCachedGenerator(this)))));
|
||||
rockStream = dimension.getRockPalette().getLayerGenerator(rng.nextRNG(), data).stream()
|
||||
.select(dimension.getRockPalette().getBlockData(data))
|
||||
.convert((v) -> v.getBlockData());
|
||||
fluidStream = dimension.getFluidPalette().getLayerGenerator(rng.nextRNG(), data).stream()
|
||||
.select(dimension.getFluidPalette().getBlockData(data))
|
||||
.convert((v) -> v.getBlockData());
|
||||
regionStream = dimension.getRegionStyle().create(rng.nextRNG()).stream()
|
||||
.zoom(dimension.getRegionZoom())
|
||||
.select(dimension.getRegions())
|
||||
.convertCached((s) -> data.getRegionLoader().load(s));
|
||||
.convertCached((s) -> data.getRegionLoader().load(s))
|
||||
.cache2D(1024);
|
||||
landBiomeStream = regionStream.convertCached((r)
|
||||
-> NoiseStyle.CELLULAR.stream(new RNG((long) (seed + 10000 * r.getLandBiomeZoom())))
|
||||
-> dimension.getLandBiomeStyle().create(rng.nextRNG()).stream()
|
||||
.zoom(r.getLandBiomeZoom())
|
||||
.select(r.getLandBiomes())
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s))
|
||||
).convertAware2D((str, x, z) -> str.get(x, z));
|
||||
).convertAware2D((str, x, z) -> str.get(x, z))
|
||||
.cache2D(1024);
|
||||
seaBiomeStream = regionStream.convertCached((r)
|
||||
-> NoiseStyle.CELLULAR.stream(new RNG((long) (seed + 20000 * r.getSeaBiomeZoom())))
|
||||
-> dimension.getSeaBiomeStyle().create(rng.nextRNG()).stream()
|
||||
.zoom(r.getSeaBiomeZoom())
|
||||
.select(r.getSeaBiomes())
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s))
|
||||
).convertAware2D((str, x, z) -> str.get(x, z));
|
||||
).convertAware2D((str, x, z) -> str.get(x, z))
|
||||
.cache2D(1024);
|
||||
shoreBiomeStream = regionStream.convertCached((r)
|
||||
-> NoiseStyle.CELLULAR.stream(new RNG((long) (seed + 30000 * r.getShoreBiomeZoom())))
|
||||
-> dimension.getShoreBiomeStyle().create(rng.nextRNG()).stream()
|
||||
.zoom(r.getShoreBiomeZoom())
|
||||
.select(r.getShoreBiomes())
|
||||
.convertCached((s) -> data.getBiomeLoader().load(s))
|
||||
).convertAware2D((str, x, z) -> str.get(x, z));
|
||||
bridgeStream = NoiseStyle.CELLULAR.stream(new RNG(seed + 4000))
|
||||
.convert((v) -> v >= dimension.getLandChance() ? InferredType.SEA : InferredType.LAND);
|
||||
).convertAware2D((str, x, z) -> str.get(x, z))
|
||||
.cache2D(1024);
|
||||
bridgeStream = dimension.getContinentalStyle().create(rng.nextRNG()).stream()
|
||||
.convert((v) -> v >= dimension.getLandChance() ? InferredType.SEA : InferredType.LAND);
|
||||
baseBiomeStream = bridgeStream.convertAware2D((t, x, z) -> t.equals(InferredType.SEA)
|
||||
? seaBiomeStream.get(x, z) : landBiomeStream.get(x, z));
|
||||
heightStream = baseBiomeStream.convertAware2D((b, x, z) -> {
|
||||
double h = 0;
|
||||
for(IrisBiomeGeneratorLink i : b.getGenerators())
|
||||
? seaBiomeStream.get(x, z) : landBiomeStream.get(x, z))
|
||||
.cache2D(1024);
|
||||
heightStream = baseBiomeStream.convertAware2D((b, x, z) -> getHeight(b, x, z, seed))
|
||||
.forceDouble().add(fluidHeight).roundDouble()
|
||||
.cache2D(1024);
|
||||
trueBiomeStream = heightStream
|
||||
.convertAware2D((h, x, z) ->
|
||||
fixBiomeType(h, baseBiomeStream.get(x, z),regionStream.get(x, z), x, z, fluidHeight))
|
||||
.cache2D(1024);
|
||||
terrainStream = ProceduralStream.of((x, y, z) -> {
|
||||
double height = heightStream.get(x, z);
|
||||
IrisBiome biome = trueBiomeStream.get(x, z);
|
||||
int depth = (int) (Math.round(height) - y);
|
||||
int atDepth = 0;
|
||||
|
||||
if(depth < -1)
|
||||
{
|
||||
return AIR;
|
||||
}
|
||||
|
||||
for(IrisBiomePaletteLayer i : biome.getLayers())
|
||||
{
|
||||
int th = i.getHeightGenerator(rng, data).fit(i.getMinHeight(), i.getMaxHeight(), x, z);
|
||||
|
||||
if(atDepth + th >= depth)
|
||||
{
|
||||
return i.get(rng, x, y, z, data).getBlockData();
|
||||
}
|
||||
|
||||
atDepth += th;
|
||||
}
|
||||
|
||||
return rockStream.get(x, y, z);
|
||||
}, new Interpolated<BlockData>()
|
||||
{
|
||||
@Override
|
||||
public double toDouble(BlockData t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData fromDouble(double d)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
});
|
||||
//@done
|
||||
}
|
||||
|
||||
private IrisBiome fixBiomeType(Double height, IrisBiome biome, IrisRegion region, Double x, Double z, double fluidHeight)
|
||||
{
|
||||
double sh = region.getShoreHeight(x, z);
|
||||
|
||||
if(height > fluidHeight && height <= fluidHeight + sh && !biome.isShore())
|
||||
{
|
||||
return shoreBiomeStream.get(x, z);
|
||||
}
|
||||
|
||||
if(height > fluidHeight + sh && !biome.isLand())
|
||||
{
|
||||
return landBiomeStream.get(x, z);
|
||||
}
|
||||
|
||||
if(height <= fluidHeight && !biome.isAquatic())
|
||||
{
|
||||
return seaBiomeStream.get(x, z);
|
||||
}
|
||||
|
||||
return biome;
|
||||
}
|
||||
|
||||
private double getHeight(IrisBiome b, double x, double z, long seed)
|
||||
{
|
||||
double h = 0;
|
||||
|
||||
for(IrisGenerator gen : generators)
|
||||
{
|
||||
double hi = gen.getInterpolator().interpolate(x, z, (xx, zz) ->
|
||||
{
|
||||
// TODO Use gen interp ..... or
|
||||
// try trilerp again....
|
||||
try
|
||||
{
|
||||
h += i.getHeight(this, x, z, seed);
|
||||
IrisBiome bx = baseBiomeStream.get(xx, zz);
|
||||
|
||||
return bx.getGenLinkMax(gen.getLoadKey());
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
Iris.warn("Failed to sample hi biome at " + xx + " " + zz + " using the generator " + gen.getLoadKey());
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
double lo = gen.getInterpolator().interpolate(x, z, (xx, zz) ->
|
||||
{
|
||||
try
|
||||
{
|
||||
IrisBiome bx = baseBiomeStream.get(xx, zz);
|
||||
|
||||
return bx.getGenLinkMin(gen.getLoadKey());
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
Iris.warn("Failed to sample lo biome at " + xx + " " + zz + " using the generator " + gen.getLoadKey());
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
h += M.lerp(lo, hi, gen.getHeight(x, z, seed + 239945));
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
private void registerGenerator(IrisGenerator cachedGenerator)
|
||||
{
|
||||
for(IrisGenerator i : generators)
|
||||
{
|
||||
if(i.getLoadKey().equals(cachedGenerator.getLoadKey()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return h+63;
|
||||
}).forceDouble().interpolate().starcast9(12).into().bihermite(4, 0.01, 0);
|
||||
//@done
|
||||
}
|
||||
|
||||
generators.add(cachedGenerator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class IrisTerrainGenerator
|
||||
public ProceduralStream<Double> height = NoiseStyle.CELLULAR
|
||||
.stream(69)
|
||||
.fit(1, 69)
|
||||
.interpolate().starcast9(4).into().bilinear(4)
|
||||
.interpolate().bistarcast9(4).into().bilinear(4)
|
||||
;
|
||||
|
||||
public ProceduralStream<BlockData> rock = NoiseStyle.STATIC
|
||||
@@ -46,6 +46,6 @@ public class IrisTerrainGenerator
|
||||
public void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes)
|
||||
{
|
||||
RNG rng = new RNG((((long) x) << 32) | (z & 0xffffffffL));
|
||||
complex.getHeightStream().fill2D(blocks, x * 16, z * 16, Material.STONE.createBlockData());
|
||||
complex.getHeightStream().fill2D(blocks, x * 16, z * 16, complex.getTerrainStream());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.volmit.iris.gen.v2;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@@ -14,8 +12,8 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.v2.scaffold.Hunk;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.object.NoiseStyle;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.PrecisionStopwatch;
|
||||
|
||||
public class TestGen
|
||||
{
|
||||
@@ -24,12 +22,20 @@ public class TestGen
|
||||
p.teleport(new WorldCreator("t/" + UUID.randomUUID().toString()).generator(new ChunkGenerator()
|
||||
{
|
||||
IrisTerrainGenerator tg = new IrisTerrainGenerator(1337, Iris.globaldata.getDimensionLoader().load("overworld"), Iris.globaldata);
|
||||
BlockData st = Material.STONE.createBlockData();
|
||||
|
||||
public boolean isParallelCapable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||
{
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
ChunkData c = createChunkData(world);
|
||||
tg.generate(x, z, Hunk.view(c), null);
|
||||
Iris.info("Generated " + x + " " + z + " in " + Form.duration(p.getMilliseconds(), 2));
|
||||
return c;
|
||||
}
|
||||
}).createWorld().getSpawnLocation());
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.volmit.iris.gen.v2.scaffold;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
public class ArraySignificance<T> implements Significance<T>
|
||||
{
|
||||
private final KList<T> types;
|
||||
private final KList<Double> significance;
|
||||
private final T significant;
|
||||
|
||||
public ArraySignificance(KList<T> types, KList<Double> significance, T significant)
|
||||
{
|
||||
this.types = types;
|
||||
this.significance = significance;
|
||||
this.significant = significant;
|
||||
}
|
||||
|
||||
public ArraySignificance(KList<T> types, KList<Double> significance)
|
||||
{
|
||||
this.types = types;
|
||||
this.significance = significance;
|
||||
double s = 0;
|
||||
int v = 0;
|
||||
for(int i = 0; i < significance.size(); i++)
|
||||
{
|
||||
if(significance.get(i) > s)
|
||||
{
|
||||
s = significance.get(i);
|
||||
v = i;
|
||||
}
|
||||
}
|
||||
|
||||
significant = types.get(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KList<T> getFactorTypes()
|
||||
{
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSignificance(T t)
|
||||
{
|
||||
for(int i = 0; i < types.size(); i++)
|
||||
{
|
||||
if(types.get(i).equals(t))
|
||||
{
|
||||
return significance.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getMostSignificantType()
|
||||
{
|
||||
return significant;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.volmit.iris.gen.v2.scaffold;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
public interface Significance<T>
|
||||
{
|
||||
public KList<T> getFactorTypes();
|
||||
|
||||
public double getSignificance(T t);
|
||||
|
||||
public T getMostSignificantType();
|
||||
}
|
||||
@@ -4,34 +4,160 @@ import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.Hunk;
|
||||
import com.volmit.iris.gen.v2.scaffold.Significance;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.AddingStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.AwareConversionStream2D;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.AwareConversionStream3D;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.CachedConversionStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.CachedStream2D;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.ClampedStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.ConversionStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.DividingStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.FittedStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.ForceDoubleStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.FunctionStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.Interpolated;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.ModuloStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.MultiplyingStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.OffsetStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.RoundingDoubleStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.RoundingStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.SelectionStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.SignificanceStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.SubtractingStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.To3DStream;
|
||||
import com.volmit.iris.gen.v2.scaffold.stream.ZoomStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
import com.volmit.iris.util.Function4;
|
||||
|
||||
public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T>
|
||||
{
|
||||
public static ProceduralStream<Double> ofDouble(Function2<Double, Double, Double> f)
|
||||
{
|
||||
return of(f, Interpolated.DOUBLE);
|
||||
}
|
||||
|
||||
public static ProceduralStream<Double> ofDouble(Function3<Double, Double, Double, Double> f)
|
||||
{
|
||||
return of(f, Interpolated.DOUBLE);
|
||||
}
|
||||
|
||||
public static <T> ProceduralStream<T> of(Function2<Double, Double, T> f, Interpolated<T> helper)
|
||||
{
|
||||
return of(f, (x, y, z) -> f.apply(x, z), helper);
|
||||
}
|
||||
|
||||
public static <T> ProceduralStream<T> of(Function3<Double, Double, Double, T> f, Interpolated<T> helper)
|
||||
{
|
||||
return of((x, z) -> f.apply(x, 0D, z), f, helper);
|
||||
}
|
||||
|
||||
public static <T> ProceduralStream<T> of(Function2<Double, Double, T> f, Function3<Double, Double, Double, T> f2, Interpolated<T> helper)
|
||||
{
|
||||
return new FunctionStream<>(f, f2, helper);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> add(Function3<Double, Double, Double, Double> a)
|
||||
{
|
||||
return new AddingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> add(Function2<Double, Double, Double> a)
|
||||
{
|
||||
return new AddingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> add(double a)
|
||||
{
|
||||
return new AddingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> subtract(Function3<Double, Double, Double, Double> a)
|
||||
{
|
||||
return new SubtractingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> subtract(Function2<Double, Double, Double> a)
|
||||
{
|
||||
return new SubtractingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> subtract(double a)
|
||||
{
|
||||
return new SubtractingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> multiply(Function3<Double, Double, Double, Double> a)
|
||||
{
|
||||
return new MultiplyingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> multiply(Function2<Double, Double, Double> a)
|
||||
{
|
||||
return new MultiplyingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> multiply(double a)
|
||||
{
|
||||
return new MultiplyingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> divide(Function3<Double, Double, Double, Double> a)
|
||||
{
|
||||
return new DividingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> divide(Function2<Double, Double, Double> a)
|
||||
{
|
||||
return new DividingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> divide(double a)
|
||||
{
|
||||
return new DividingStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> modulo(Function3<Double, Double, Double, Double> a)
|
||||
{
|
||||
return new ModuloStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> modulo(Function2<Double, Double, Double> a)
|
||||
{
|
||||
return new ModuloStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> modulo(double a)
|
||||
{
|
||||
return new ModuloStream<>(this, a);
|
||||
}
|
||||
|
||||
default ProceduralStream<Integer> round()
|
||||
{
|
||||
return new RoundingStream(this);
|
||||
}
|
||||
|
||||
default ProceduralStream<Double> roundDouble()
|
||||
{
|
||||
return new RoundingDoubleStream(this);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> forceDouble()
|
||||
{
|
||||
return new ForceDoubleStream<T>(this);
|
||||
}
|
||||
|
||||
default ProceduralStream<Significance<T>> significance(double radius, int checks)
|
||||
{
|
||||
return new SignificanceStream<Significance<T>, T>(this, radius, checks);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> to3D()
|
||||
{
|
||||
return new To3DStream<T>(this);
|
||||
}
|
||||
|
||||
default ProceduralStream<T> cache2D(int maxSize)
|
||||
{
|
||||
return new CachedStream2D<T>(this, maxSize);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
|
||||
public class AddingStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final Function3<Double, Double, Double, Double> add;
|
||||
|
||||
public AddingStream(ProceduralStream<T> stream, Function3<Double, Double, Double, Double> add)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.add = add;
|
||||
}
|
||||
|
||||
public AddingStream(ProceduralStream<T> stream, Function2<Double, Double, Double> add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add.apply(x, z));
|
||||
}
|
||||
|
||||
public AddingStream(ProceduralStream<T> stream, double add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return fromDouble(add.apply(x, 0D, z) + stream.getDouble(x, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return fromDouble(add.apply(x, y, z) + stream.getDouble(x, y, z));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,13 @@ package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
|
||||
public class StarcastStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
public class BiStarcastStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
{
|
||||
private ProceduralStream<T> stream;
|
||||
private int rad;
|
||||
private int checks;
|
||||
|
||||
public StarcastStream(ProceduralStream<T> stream, int rad, int checks)
|
||||
public BiStarcastStream(ProceduralStream<T> stream, int rad, int checks)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.rad = rad;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
|
||||
public class DividingStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final Function3<Double, Double, Double, Double> add;
|
||||
|
||||
public DividingStream(ProceduralStream<T> stream, Function3<Double, Double, Double, Double> add)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.add = add;
|
||||
}
|
||||
|
||||
public DividingStream(ProceduralStream<T> stream, Function2<Double, Double, Double> add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add.apply(x, z));
|
||||
}
|
||||
|
||||
public DividingStream(ProceduralStream<T> stream, double add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, z) / add.apply(x, 0D, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, y, z) / add.apply(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
|
||||
public class FunctionStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private Function2<Double, Double, T> f2;
|
||||
private Function3<Double, Double, Double, T> f3;
|
||||
private Interpolated<T> helper;
|
||||
|
||||
public FunctionStream(Function2<Double, Double, T> f2, Function3<Double, Double, Double, T> f3, Interpolated<T> helper)
|
||||
{
|
||||
super();
|
||||
this.f2 = f2;
|
||||
this.f3 = f3;
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return helper.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return helper.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return f2.apply(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return f3.apply(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
|
||||
public interface Interpolated<T>
|
||||
{
|
||||
public static final Interpolated<Double> DOUBLE = of((t) -> t, (t) -> t);
|
||||
public static final Interpolated<Integer> INT = of((t) -> Double.valueOf(t), (t) -> t.intValue());
|
||||
public static final Interpolated<Long> LONG = of((t) -> Double.valueOf(t), (t) -> t.longValue());
|
||||
|
||||
public double toDouble(T t);
|
||||
|
||||
public T fromDouble(double d);
|
||||
@@ -17,4 +23,22 @@ public interface Interpolated<T>
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> Interpolated<T> of(Function<T, Double> a, Function<Double, T> b)
|
||||
{
|
||||
return new Interpolated<T>()
|
||||
{
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return a.apply(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return b.apply(d);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
import com.volmit.iris.util.NoiseProvider;
|
||||
|
||||
public class InterpolatingStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final InterpolationMethod type;
|
||||
private final NoiseProvider np;
|
||||
private final int rx;
|
||||
|
||||
public InterpolatingStream(ProceduralStream<T> stream, int rx, InterpolationMethod type)
|
||||
{
|
||||
this.type = type;
|
||||
this.stream = stream;
|
||||
this.rx = rx;
|
||||
this.np = (xf, zf) -> stream.getDouble(xf, zf);
|
||||
}
|
||||
|
||||
public T interpolate(double x, double y)
|
||||
{
|
||||
return fromDouble(IrisInterpolation.getNoise(type, (int) x, (int) y, (double) rx, np));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return interpolate(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return interpolate(x, z);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
|
||||
public class InterpolatorFactory<T>
|
||||
{
|
||||
@@ -11,6 +12,21 @@ public class InterpolatorFactory<T>
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public InterpolatingStream<T> with(InterpolationMethod t, int rx)
|
||||
{
|
||||
return new InterpolatingStream<T>(stream, rx, t);
|
||||
}
|
||||
|
||||
public TrilinearStream<T> trilinear(int rx, int ry, int rz)
|
||||
{
|
||||
return new TrilinearStream<>(stream, rx, ry, rz);
|
||||
}
|
||||
|
||||
public TricubicStream<T> tricubic(int rx, int ry, int rz)
|
||||
{
|
||||
return new TricubicStream<>(stream, rx, ry, rz);
|
||||
}
|
||||
|
||||
public BicubicStream<T> bicubic(int rx, int ry)
|
||||
{
|
||||
return new BicubicStream<>(stream, rx, ry);
|
||||
@@ -31,24 +47,44 @@ public class InterpolatorFactory<T>
|
||||
return bilinear(r, r);
|
||||
}
|
||||
|
||||
public StarcastStream<T> starcast(int radius, int checks)
|
||||
public TriStarcastStream<T> tristarcast(int radius, int checks)
|
||||
{
|
||||
return new StarcastStream<>(stream, radius, checks);
|
||||
return new TriStarcastStream<>(stream, radius, checks);
|
||||
}
|
||||
|
||||
public StarcastStream<T> starcast3(int radius)
|
||||
public TriStarcastStream<T> tristarcast3(int radius)
|
||||
{
|
||||
return starcast(radius, 3);
|
||||
return tristarcast(radius, 3);
|
||||
}
|
||||
|
||||
public StarcastStream<T> starcast6(int radius)
|
||||
public TriStarcastStream<T> tristarcast6(int radius)
|
||||
{
|
||||
return starcast(radius, 6);
|
||||
return tristarcast(radius, 6);
|
||||
}
|
||||
|
||||
public StarcastStream<T> starcast9(int radius)
|
||||
public TriStarcastStream<T> tristarcast9(int radius)
|
||||
{
|
||||
return starcast(radius, 9);
|
||||
return tristarcast(radius, 9);
|
||||
}
|
||||
|
||||
public BiStarcastStream<T> bistarcast(int radius, int checks)
|
||||
{
|
||||
return new BiStarcastStream<>(stream, radius, checks);
|
||||
}
|
||||
|
||||
public BiStarcastStream<T> bistarcast3(int radius)
|
||||
{
|
||||
return bistarcast(radius, 3);
|
||||
}
|
||||
|
||||
public BiStarcastStream<T> bistarcast6(int radius)
|
||||
{
|
||||
return bistarcast(radius, 6);
|
||||
}
|
||||
|
||||
public BiStarcastStream<T> bistarcast9(int radius)
|
||||
{
|
||||
return bistarcast(radius, 9);
|
||||
}
|
||||
|
||||
public BiHermiteStream<T> bihermite(int rx, int ry, double tension, double bias)
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
|
||||
public class ModuloStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final Function3<Double, Double, Double, Double> add;
|
||||
|
||||
public ModuloStream(ProceduralStream<T> stream, Function3<Double, Double, Double, Double> add)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.add = add;
|
||||
}
|
||||
|
||||
public ModuloStream(ProceduralStream<T> stream, Function2<Double, Double, Double> add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add.apply(x, z));
|
||||
}
|
||||
|
||||
public ModuloStream(ProceduralStream<T> stream, double add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, z) % add.apply(x, 0D, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, y, z) % add.apply(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
|
||||
public class MultiplyingStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final Function3<Double, Double, Double, Double> add;
|
||||
|
||||
public MultiplyingStream(ProceduralStream<T> stream, Function3<Double, Double, Double, Double> add)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.add = add;
|
||||
}
|
||||
|
||||
public MultiplyingStream(ProceduralStream<T> stream, Function2<Double, Double, Double> add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add.apply(x, z));
|
||||
}
|
||||
|
||||
public MultiplyingStream(ProceduralStream<T> stream, double add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, z) * add.apply(x, 0D, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, y, z) * add.apply(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
|
||||
public class RoundingDoubleStream extends BasicLayer implements ProceduralStream<Double>
|
||||
{
|
||||
private final ProceduralStream<?> stream;
|
||||
|
||||
public RoundingDoubleStream(ProceduralStream<?> stream)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(Double t)
|
||||
{
|
||||
return t.doubleValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double fromDouble(double d)
|
||||
{
|
||||
return (double) Math.round(d);
|
||||
}
|
||||
|
||||
private double round(double v)
|
||||
{
|
||||
return Math.round(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double get(double x, double z)
|
||||
{
|
||||
return round(stream.getDouble(x, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double get(double x, double y, double z)
|
||||
{
|
||||
return round(stream.getDouble(x, y, z));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.ArraySignificance;
|
||||
import com.volmit.iris.gen.v2.scaffold.Significance;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
public class SignificanceStream<K extends Significance<T>, T> extends BasicLayer implements ProceduralStream<K>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final double radius;
|
||||
private final int checks;
|
||||
|
||||
public SignificanceStream(ProceduralStream<T> stream, double radius, int checks)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.radius = radius;
|
||||
this.checks = checks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(K t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public K fromDouble(double d)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public K get(double x, double z)
|
||||
{
|
||||
KList<T> ke = new KList<>(8);
|
||||
KList<Double> va = new KList<Double>(8);
|
||||
|
||||
double m = (360 / checks);
|
||||
double v = 0;
|
||||
|
||||
for(int i = 0; i < 360; i += m)
|
||||
{
|
||||
double sin = Math.sin(Math.toRadians(i));
|
||||
double cos = Math.cos(Math.toRadians(i));
|
||||
double cx = x + ((radius * cos) - (radius * sin));
|
||||
double cz = z + ((radius * sin) + (radius * cos));
|
||||
T t = stream.get(cx, cz);
|
||||
|
||||
if(ke.addIfMissing(t))
|
||||
{
|
||||
va.add(1D);
|
||||
v++;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
int ind = ke.indexOf(t);
|
||||
va.set(ind, va.get(ind) + 1D);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < va.size(); i++)
|
||||
{
|
||||
va.set(i, va.get(i) / (double) v);
|
||||
}
|
||||
|
||||
return (K) new ArraySignificance<T>(ke, va);
|
||||
}
|
||||
|
||||
@Override
|
||||
public K get(double x, double y, double z)
|
||||
{
|
||||
return get(x, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.Function3;
|
||||
|
||||
public class SubtractingStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final Function3<Double, Double, Double, Double> add;
|
||||
|
||||
public SubtractingStream(ProceduralStream<T> stream, Function3<Double, Double, Double, Double> add)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
this.add = add;
|
||||
}
|
||||
|
||||
public SubtractingStream(ProceduralStream<T> stream, Function2<Double, Double, Double> add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add.apply(x, z));
|
||||
}
|
||||
|
||||
public SubtractingStream(ProceduralStream<T> stream, double add)
|
||||
{
|
||||
this(stream, (x, y, z) -> add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, z) - add.apply(x, 0D, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return fromDouble(stream.getDouble(x, y, z) - add.apply(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
|
||||
public class To3DStream<T> extends BasicLayer implements ProceduralStream<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
|
||||
public To3DStream(ProceduralStream<T> stream)
|
||||
{
|
||||
super();
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return stream.get(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return stream.fromDouble(stream.getDouble(x, z) >= y ? 1D : 0D);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
|
||||
public class TriHermiteStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final int rx;
|
||||
private final int ry;
|
||||
private final int rz;
|
||||
private final double tension;
|
||||
private final double bias;
|
||||
|
||||
public TriHermiteStream(ProceduralStream<T> stream, int rx, int ry, int rz, double tension, double bias)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.rx = rx;
|
||||
this.ry = ry;
|
||||
this.rz = rz;
|
||||
this.tension = tension;
|
||||
this.bias = bias;
|
||||
}
|
||||
|
||||
public T interpolate(double x, double y, double z)
|
||||
{
|
||||
int fx = (int) Math.floor(x / rx);
|
||||
int fy = (int) Math.floor(y / ry);
|
||||
int fz = (int) Math.floor(z / rz);
|
||||
int x0 = (int) Math.round((fx - 1) * rx);
|
||||
int y0 = (int) Math.round((fy - 1) * ry);
|
||||
int z0 = (int) Math.round((fz - 1) * rz);
|
||||
int x1 = (int) Math.round(fx * rx);
|
||||
int y1 = (int) Math.round(fy * ry);
|
||||
int z1 = (int) Math.round(fz * rz);
|
||||
int x2 = (int) Math.round((fx + 1) * rx);
|
||||
int y2 = (int) Math.round((fy + 1) * ry);
|
||||
int z2 = (int) Math.round((fz + 1) * rz);
|
||||
int x3 = (int) Math.round((fx + 2) * rx);
|
||||
int y3 = (int) Math.round((fy + 2) * ry);
|
||||
int z3 = (int) Math.round((fz + 2) * rz);
|
||||
double px = IrisInterpolation.rangeScale(0, 1, x1, x2, x);
|
||||
double py = IrisInterpolation.rangeScale(0, 1, y1, y2, y);
|
||||
double pz = IrisInterpolation.rangeScale(0, 1, z1, z2, z);
|
||||
|
||||
//@builder
|
||||
return stream.fromDouble(IrisInterpolation.trihermite(
|
||||
stream.getDouble(x0, y0, z0),
|
||||
stream.getDouble(x0, y0,z1),
|
||||
stream.getDouble(x0, y0,z2),
|
||||
stream.getDouble(x0, y0,z3),
|
||||
stream.getDouble(x1, y0,z0),
|
||||
stream.getDouble(x1, y0,z1),
|
||||
stream.getDouble(x1, y0,z2),
|
||||
stream.getDouble(x1, y0,z3),
|
||||
stream.getDouble(x2, y0,z0),
|
||||
stream.getDouble(x2, y0,z1),
|
||||
stream.getDouble(x2, y0,z2),
|
||||
stream.getDouble(x2, y0,z3),
|
||||
stream.getDouble(x3, y0,z0),
|
||||
stream.getDouble(x3, y0,z1),
|
||||
stream.getDouble(x3, y0,z2),
|
||||
stream.getDouble(x3, y0,z3),
|
||||
stream.getDouble(x0, y1, z0),
|
||||
stream.getDouble(x0, y1,z1),
|
||||
stream.getDouble(x0, y1,z2),
|
||||
stream.getDouble(x0, y1,z3),
|
||||
stream.getDouble(x1, y1,z0),
|
||||
stream.getDouble(x1, y1,z1),
|
||||
stream.getDouble(x1, y1,z2),
|
||||
stream.getDouble(x1, y1,z3),
|
||||
stream.getDouble(x2, y1,z0),
|
||||
stream.getDouble(x2, y1,z1),
|
||||
stream.getDouble(x2, y1,z2),
|
||||
stream.getDouble(x2, y1,z3),
|
||||
stream.getDouble(x3, y1,z0),
|
||||
stream.getDouble(x3, y1,z1),
|
||||
stream.getDouble(x3, y1,z2),
|
||||
stream.getDouble(x3, y1,z3),
|
||||
stream.getDouble(x0, y2, z0),
|
||||
stream.getDouble(x0, y2,z1),
|
||||
stream.getDouble(x0, y2,z2),
|
||||
stream.getDouble(x0, y2,z3),
|
||||
stream.getDouble(x1, y2,z0),
|
||||
stream.getDouble(x1, y2,z1),
|
||||
stream.getDouble(x1, y2,z2),
|
||||
stream.getDouble(x1, y2,z3),
|
||||
stream.getDouble(x2, y2,z0),
|
||||
stream.getDouble(x2, y2,z1),
|
||||
stream.getDouble(x2, y2,z2),
|
||||
stream.getDouble(x2, y2,z3),
|
||||
stream.getDouble(x3, y2,z0),
|
||||
stream.getDouble(x3, y2,z1),
|
||||
stream.getDouble(x3, y2,z2),
|
||||
stream.getDouble(x3, y2,z3),
|
||||
stream.getDouble(x0, y3, z0),
|
||||
stream.getDouble(x0, y3,z1),
|
||||
stream.getDouble(x0, y3,z2),
|
||||
stream.getDouble(x0, y3,z3),
|
||||
stream.getDouble(x1, y3,z0),
|
||||
stream.getDouble(x1, y3,z1),
|
||||
stream.getDouble(x1, y3,z2),
|
||||
stream.getDouble(x1, y3,z3),
|
||||
stream.getDouble(x2, y3,z0),
|
||||
stream.getDouble(x2, y3,z1),
|
||||
stream.getDouble(x2, y3,z2),
|
||||
stream.getDouble(x2, y3,z3),
|
||||
stream.getDouble(x3, y3,z0),
|
||||
stream.getDouble(x3, y3,z1),
|
||||
stream.getDouble(x3, y3,z2),
|
||||
stream.getDouble(x3, y3,z3),
|
||||
px, pz, py, tension, bias));
|
||||
//@done
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return interpolate(x, 0, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return interpolate(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
|
||||
public class TriStarcastStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
{
|
||||
private ProceduralStream<T> stream;
|
||||
private int rad;
|
||||
private int checks;
|
||||
|
||||
public TriStarcastStream(ProceduralStream<T> stream, int rad, int checks)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.rad = rad;
|
||||
this.checks = checks;
|
||||
}
|
||||
|
||||
public T interpolate(double x, double y, double z)
|
||||
{
|
||||
double m = (360 / checks);
|
||||
double v = 0;
|
||||
|
||||
for(int i = 0; i < 360; i += m)
|
||||
{
|
||||
double sin = Math.sin(Math.toRadians(i));
|
||||
double cos = Math.cos(Math.toRadians(i));
|
||||
double cx = x + ((rad * cos) - (rad * sin));
|
||||
double cy = y + ((rad * sin) + (rad * cos));
|
||||
double cz = z + ((rad * cos) - (rad * sin));
|
||||
v += stream.getDouble(cx, cy, cz);
|
||||
}
|
||||
|
||||
return stream.fromDouble(v / checks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return interpolate(x, 0, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return interpolate(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
|
||||
public class TricubicStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final int rx;
|
||||
private final int ry;
|
||||
private final int rz;
|
||||
|
||||
public TricubicStream(ProceduralStream<T> stream, int rx, int ry, int rz)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.rx = rx;
|
||||
this.ry = ry;
|
||||
this.rz = rz;
|
||||
}
|
||||
|
||||
public T interpolate(double x, double y, double z)
|
||||
{
|
||||
int fx = (int) Math.floor(x / rx);
|
||||
int fy = (int) Math.floor(y / ry);
|
||||
int fz = (int) Math.floor(z / rz);
|
||||
int x0 = (int) Math.round((fx - 1) * rx);
|
||||
int y0 = (int) Math.round((fy - 1) * ry);
|
||||
int z0 = (int) Math.round((fz - 1) * rz);
|
||||
int x1 = (int) Math.round(fx * rx);
|
||||
int y1 = (int) Math.round(fy * ry);
|
||||
int z1 = (int) Math.round(fz * rz);
|
||||
int x2 = (int) Math.round((fx + 1) * rx);
|
||||
int y2 = (int) Math.round((fy + 1) * ry);
|
||||
int z2 = (int) Math.round((fz + 1) * rz);
|
||||
int x3 = (int) Math.round((fx + 2) * rx);
|
||||
int y3 = (int) Math.round((fy + 2) * ry);
|
||||
int z3 = (int) Math.round((fz + 2) * rz);
|
||||
double px = IrisInterpolation.rangeScale(0, 1, x1, x2, x);
|
||||
double py = IrisInterpolation.rangeScale(0, 1, y1, y2, y);
|
||||
double pz = IrisInterpolation.rangeScale(0, 1, z1, z2, z);
|
||||
|
||||
//@builder
|
||||
return stream.fromDouble(IrisInterpolation.tricubic(
|
||||
stream.getDouble(x0, y0, z0),
|
||||
stream.getDouble(x0, y0,z1),
|
||||
stream.getDouble(x0, y0,z2),
|
||||
stream.getDouble(x0, y0,z3),
|
||||
stream.getDouble(x1, y0,z0),
|
||||
stream.getDouble(x1, y0,z1),
|
||||
stream.getDouble(x1, y0,z2),
|
||||
stream.getDouble(x1, y0,z3),
|
||||
stream.getDouble(x2, y0,z0),
|
||||
stream.getDouble(x2, y0,z1),
|
||||
stream.getDouble(x2, y0,z2),
|
||||
stream.getDouble(x2, y0,z3),
|
||||
stream.getDouble(x3, y0,z0),
|
||||
stream.getDouble(x3, y0,z1),
|
||||
stream.getDouble(x3, y0,z2),
|
||||
stream.getDouble(x3, y0,z3),
|
||||
|
||||
stream.getDouble(x0, y1, z0),
|
||||
stream.getDouble(x0, y1,z1),
|
||||
stream.getDouble(x0, y1,z2),
|
||||
stream.getDouble(x0, y1,z3),
|
||||
stream.getDouble(x1, y1,z0),
|
||||
stream.getDouble(x1, y1,z1),
|
||||
stream.getDouble(x1, y1,z2),
|
||||
stream.getDouble(x1, y1,z3),
|
||||
stream.getDouble(x2, y1,z0),
|
||||
stream.getDouble(x2, y1,z1),
|
||||
stream.getDouble(x2, y1,z2),
|
||||
stream.getDouble(x2, y1,z3),
|
||||
stream.getDouble(x3, y1,z0),
|
||||
stream.getDouble(x3, y1,z1),
|
||||
stream.getDouble(x3, y1,z2),
|
||||
stream.getDouble(x3, y1,z3),
|
||||
|
||||
stream.getDouble(x0, y2, z0),
|
||||
stream.getDouble(x0, y2,z1),
|
||||
stream.getDouble(x0, y2,z2),
|
||||
stream.getDouble(x0, y2,z3),
|
||||
stream.getDouble(x1, y2,z0),
|
||||
stream.getDouble(x1, y2,z1),
|
||||
stream.getDouble(x1, y2,z2),
|
||||
stream.getDouble(x1, y2,z3),
|
||||
stream.getDouble(x2, y2,z0),
|
||||
stream.getDouble(x2, y2,z1),
|
||||
stream.getDouble(x2, y2,z2),
|
||||
stream.getDouble(x2, y2,z3),
|
||||
stream.getDouble(x3, y2,z0),
|
||||
stream.getDouble(x3, y2,z1),
|
||||
stream.getDouble(x3, y2,z2),
|
||||
stream.getDouble(x3, y2,z3),
|
||||
|
||||
stream.getDouble(x0, y3, z0),
|
||||
stream.getDouble(x0, y3,z1),
|
||||
stream.getDouble(x0, y3,z2),
|
||||
stream.getDouble(x0, y3,z3),
|
||||
stream.getDouble(x1, y3,z0),
|
||||
stream.getDouble(x1, y3,z1),
|
||||
stream.getDouble(x1, y3,z2),
|
||||
stream.getDouble(x1, y3,z3),
|
||||
stream.getDouble(x2, y3,z0),
|
||||
stream.getDouble(x2, y3,z1),
|
||||
stream.getDouble(x2, y3,z2),
|
||||
stream.getDouble(x2, y3,z3),
|
||||
stream.getDouble(x3, y3,z0),
|
||||
stream.getDouble(x3, y3,z1),
|
||||
stream.getDouble(x3, y3,z2),
|
||||
stream.getDouble(x3, y3,z3),
|
||||
px, pz, py));
|
||||
//@done
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return interpolate(x, 0, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return interpolate(x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.volmit.iris.gen.v2.scaffold.stream;
|
||||
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.BasicLayer;
|
||||
import com.volmit.iris.gen.v2.scaffold.layer.ProceduralStream;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
|
||||
public class TrilinearStream<T> extends BasicLayer implements ProceduralStream<T>, Interpolator<T>
|
||||
{
|
||||
private final ProceduralStream<T> stream;
|
||||
private final int rx;
|
||||
private final int ry;
|
||||
private final int rz;
|
||||
|
||||
public TrilinearStream(ProceduralStream<T> stream, int rx, int ry, int rz)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.rx = rx;
|
||||
this.ry = ry;
|
||||
this.rz = rz;
|
||||
}
|
||||
|
||||
public T interpolate(double x, double y, double z)
|
||||
{
|
||||
int fx = (int) Math.floor(x / rx);
|
||||
int fy = (int) Math.floor(y / ry);
|
||||
int fz = (int) Math.floor(z / rz);
|
||||
int x1 = (int) Math.round(fx * rx);
|
||||
int y1 = (int) Math.round(fy * ry);
|
||||
int z1 = (int) Math.round(fz * rz);
|
||||
int x2 = (int) Math.round((fx + 1) * rx);
|
||||
int y2 = (int) Math.round((fy + 1) * ry);
|
||||
int z2 = (int) Math.round((fz + 1) * rz);
|
||||
double px = IrisInterpolation.rangeScale(0, 1, x1, x2, x);
|
||||
double py = IrisInterpolation.rangeScale(0, 1, y1, y2, y);
|
||||
double pz = IrisInterpolation.rangeScale(0, 1, z1, z2, z);
|
||||
|
||||
//@builder
|
||||
return stream.fromDouble(IrisInterpolation.trilerp(
|
||||
stream.getDouble(x1, y1, z1),
|
||||
stream.getDouble(x2, y1, z1),
|
||||
stream.getDouble(x1, y1, z2),
|
||||
stream.getDouble(x2, y1, z2),
|
||||
stream.getDouble(x1, y2, z1),
|
||||
stream.getDouble(x2, y2, z1),
|
||||
stream.getDouble(x1, y2, z2),
|
||||
stream.getDouble(x2, y2, z2),
|
||||
px, pz, py));
|
||||
//@done
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toDouble(T t)
|
||||
{
|
||||
return stream.toDouble(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromDouble(double d)
|
||||
{
|
||||
return stream.fromDouble(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double z)
|
||||
{
|
||||
return interpolate(x, 0, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(double x, double y, double z)
|
||||
{
|
||||
return interpolate(x, y, z);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user