Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Transformation(Matrix transformation) {
- this.pos = transformation.getColumn(3).removeDimensionFromVec(3);
- var rotScaleMatrix = transformation.getSubMatrix(0,0,2,2);
- List<Vector> rotCols = new ArrayList<>();
- var scale = new Vector(1,1,1);
- for(int i = 0;i < 3;i++) {
- var v = rotScaleMatrix.getColumn(i);
- scale.setDataElement(i, v.getNorm());
- v.normalise();
- rotCols.add(v);
- }
- var rotMatrix = new Matrix(rotCols);
- this.orientation = new Quaternion(rotMatrix);
- this.orientation.normalise();
- this.scale = scale;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement