Improved transformation compacting.

This commit is contained in:
Chicken Bones committed 2013-09-05 17:41:31 +10:00
1 parent 5c5384f79c
commit ea515682c1
6 files changed
+56 -34

No files matched your search

+9 -7
View File
@@ -232,18 +232,20 @@ public class Rotation extends Transformation
public Transformation merge(Transformation next) {
if(next instanceof Rotation) {
Rotation r = (Rotation)next;
if(r.axis.equalsT(axis)) {
double d = angle+r.angle;
if(d == 0)
return new RedundantTransformation();
return new Rotation(angle, axis);
}
if(r.axis.equalsT(axis))
return new Rotation(angle+r.angle, axis);
return new Rotation(toQuat().copy().multiply(r.toQuat()));
}
return null;
}
@Override
public boolean isRedundant() {
return MathHelper.between(-1E-5, angle, 1E-5);
}
@Override
public String toString()
{