mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-15 17:44:42 +00:00
Improved transformation compacting.
This commit is contained in:
1 parent
5c5384f79c
commit
ea515682c1
6 files changed
+56
-34
No files matched your search
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user