Need help to understand what and how the tools work
Posted: Sun 12. May 2013, 22:12
I'm taking look at two tools: TranslateTool and DraggingTool. At first glance, I think they are the same like they are used to move the component from one place to another place. But once I look at the codes, I found that they are different and I get lost.
I think I understand how the translateTool work, clearly it applies the transformation matrix on the component
using:
MatrixBuilder.euclidean(comp.getTransformation())
.times(tc.getTransformationMatrix(trafo).toDoubleArray(null))
.assignTo(comp);
However, I cannot understand how the DraggingTool works.
It has to calculate the conjugation of the local2world: evolution.conjugateBy(local2world.getInverse())
and then it puts the evolution matrix on the right of the component transformation matrix to generate the result matrix:
comp.getTransformation().getMatrix(result.getArray());
result.multiplyOnRight(evolution);
comp.getTransformation().setMatrix(result.getArray());
I cannot understand why here it has to use the conjugate, and actually I found that the rotateTool also uses it.
Would some one please help me to understand the local2world and conjugate stuff and what's the difference for the translateTool and DraggingTool?
Thank you.
I think I understand how the translateTool work, clearly it applies the transformation matrix on the component
using:
MatrixBuilder.euclidean(comp.getTransformation())
.times(tc.getTransformationMatrix(trafo).toDoubleArray(null))
.assignTo(comp);
However, I cannot understand how the DraggingTool works.
It has to calculate the conjugation of the local2world: evolution.conjugateBy(local2world.getInverse())
and then it puts the evolution matrix on the right of the component transformation matrix to generate the result matrix:
comp.getTransformation().getMatrix(result.getArray());
result.multiplyOnRight(evolution);
comp.getTransformation().setMatrix(result.getArray());
I cannot understand why here it has to use the conjugate, and actually I found that the rotateTool also uses it.
Would some one please help me to understand the local2world and conjugate stuff and what's the difference for the translateTool and DraggingTool?
Thank you.