Add a new block metadata framework and fix //rotate and //flip.

Remove the previous Mapping interfaces.
This commit is contained in:
sk89q
2014-07-09 14:14:17 -07:00
parent 22dceb5614
commit 56b349ead8
29 changed files with 7425 additions and 319 deletions

View File

@ -24,6 +24,15 @@ package com.sk89q.worldedit.math;
*/
public final class MathUtils {
/**
* Safe minimum, such that 1 / SAFE_MIN does not overflow.
* <p>
* In IEEE 754 arithmetic, this is also the smallest normalized number
* 2<sup>-1022</sup>. The value of this constant is from Apache Commons
* Math 2.2.
*/
public static final double SAFE_MIN = 0x1.0p-1022;
private MathUtils() {
}

View File

@ -292,6 +292,10 @@ public class AffineTransform implements Transform {
vector.getX() * m20 + vector.getY() * m21 + vector.getZ() * m22 + m23);
}
public AffineTransform combine(AffineTransform other) {
return concatenate(other);
}
@Override
public Transform combine(Transform other) {
if (other instanceof AffineTransform) {
@ -305,4 +309,6 @@ public class AffineTransform implements Transform {
public String toString() {
return String.format("Affine[%g %g %g %g, %g %g %g %g, %g %g %g %g]}", m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23);
}
}

View File

@ -19,13 +19,20 @@
package com.sk89q.worldedit.math.transform;
import com.google.common.base.Function;
import com.sk89q.worldedit.Vector;
/**
* Makes a transformation of {@link Vector}s.
*/
public interface Transform extends Function<Vector, Vector> {
public interface Transform {
/**
* Returns the result of applying the function to the input.
*
* @param input the input
* @return the result
*/
Vector apply(Vector input);
/**
* Create a new inverse transform.