mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-19 02:52:34 +00:00
FastMath is a drop in replacement for the native Java math class with improved performance and fall backs to the native Java math class if necessary. https://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/util/FastMath.html This requires further testing and might cause chunk borders due the FastMath giving slightly different results than the native Java math class. I also added .idea/Terra.iml to the .gitignore
48 lines
1.1 KiB
Java
48 lines
1.1 KiB
Java
package com.dfsek.terra.structure;
|
|
|
|
import com.dfsek.terra.procgen.math.Vector2;
|
|
import org.apache.commons.math3.util.FastMath;
|
|
|
|
import java.io.Serializable;
|
|
|
|
public class StructureInfo implements Serializable {
|
|
private static final long serialVersionUID = -175639605885943678L;
|
|
private final int sizeX;
|
|
private final int sizeY;
|
|
private final int sizeZ;
|
|
private final int centerX;
|
|
private final int centerZ;
|
|
|
|
public StructureInfo(int sizeX, int sizeY, int sizeZ, Vector2 center) {
|
|
this.sizeX = sizeX;
|
|
this.sizeY = sizeY;
|
|
this.sizeZ = sizeZ;
|
|
this.centerX = (int) center.getX();
|
|
this.centerZ = (int) center.getZ();
|
|
}
|
|
|
|
public int getSizeX() {
|
|
return sizeX;
|
|
}
|
|
|
|
public int getSizeZ() {
|
|
return sizeZ;
|
|
}
|
|
|
|
public int getSizeY() {
|
|
return sizeY;
|
|
}
|
|
|
|
public int getCenterX() {
|
|
return centerX;
|
|
}
|
|
|
|
public int getCenterZ() {
|
|
return centerZ;
|
|
}
|
|
|
|
public double getMaxHorizontal() {
|
|
return FastMath.sqrt(FastMath.pow(sizeX, 2) + FastMath.pow(sizeZ, 2));
|
|
}
|
|
}
|