geforkt von Mirrors/FastAsyncWorldEdit
Added Transform.inverse() as a standard operation.
Dieser Commit ist enthalten in:
Ursprung
a74bab7f98
Commit
63411b427a
@ -21,8 +21,10 @@ package com.sk89q.worldedit.math.transform;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -60,6 +62,15 @@ public class CombinedTransform implements Transform {
|
|||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Transform inverse() {
|
||||||
|
List<Transform> list = new ArrayList<Transform>();
|
||||||
|
for (int i = transforms.length - 1; i >= 0; i--) {
|
||||||
|
list.add(transforms[i].inverse());
|
||||||
|
}
|
||||||
|
return new CombinedTransform(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Transform combine(Transform other) {
|
public Transform combine(Transform other) {
|
||||||
checkNotNull(other);
|
checkNotNull(other);
|
||||||
|
@ -31,6 +31,11 @@ public class Identity implements Transform {
|
|||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Transform inverse() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Transform combine(Transform other) {
|
public Transform combine(Transform other) {
|
||||||
if (other instanceof Identity) {
|
if (other instanceof Identity) {
|
||||||
|
@ -27,6 +27,13 @@ import com.sk89q.worldedit.Vector;
|
|||||||
*/
|
*/
|
||||||
public interface Transform extends Function<Vector, Vector> {
|
public interface Transform extends Function<Vector, Vector> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new inverse transform.
|
||||||
|
*
|
||||||
|
* @return a new inverse transform
|
||||||
|
*/
|
||||||
|
Transform inverse();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link Transform} that combines this transform with another.
|
* Create a new {@link Transform} that combines this transform with another.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren