Add transformation compacting.

This commit is contained in:
Chicken Bones committed 2013-08-29 11:10:33 +10:00
1 parent 0941845227
commit 5ef9f6174d
7 files changed
+133 -66

No files matched your search

+16
View File
@@ -227,6 +227,22 @@ public class Rotation extends Transformation
{
return new Rotation(-angle, axis);
}
@Override
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);
}
}
return null;
}
@Override
public String toString()