Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-14 15:10:05 +01:00
Add Transform.isIdentity().
Dieser Commit ist enthalten in:
Ursprung
47ad03a013
Commit
932513d8a1
@ -109,6 +109,7 @@ public class AffineTransform implements Transform {
|
|||||||
// ===================================================================
|
// ===================================================================
|
||||||
// accessors
|
// accessors
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIdentity() {
|
public boolean isIdentity() {
|
||||||
if (m00 != 1)
|
if (m00 != 1)
|
||||||
return false;
|
return false;
|
||||||
|
@ -54,6 +54,17 @@ public class CombinedTransform implements Transform {
|
|||||||
this(transforms.toArray(new Transform[checkNotNull(transforms).size()]));
|
this(transforms.toArray(new Transform[checkNotNull(transforms).size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIdentity() {
|
||||||
|
for (Transform transform : transforms) {
|
||||||
|
if (!transform.isIdentity()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector apply(Vector vector) {
|
public Vector apply(Vector vector) {
|
||||||
for (Transform transform : transforms) {
|
for (Transform transform : transforms) {
|
||||||
|
@ -26,6 +26,11 @@ import com.sk89q.worldedit.Vector;
|
|||||||
*/
|
*/
|
||||||
public class Identity implements Transform {
|
public class Identity implements Transform {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIdentity() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector apply(Vector vector) {
|
public Vector apply(Vector vector) {
|
||||||
return vector;
|
return vector;
|
||||||
|
@ -26,6 +26,15 @@ import com.sk89q.worldedit.Vector;
|
|||||||
*/
|
*/
|
||||||
public interface Transform {
|
public interface Transform {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether this transform is an identity.
|
||||||
|
*
|
||||||
|
* <p>If it is not known, then {@code false} must be returned.</p>
|
||||||
|
*
|
||||||
|
* @return true if identity
|
||||||
|
*/
|
||||||
|
boolean isIdentity();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the result of applying the function to the input.
|
* Returns the result of applying the function to the input.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren