List of usage examples for org.apache.commons.math3.geometry.euclidean.threed RotationOrder XZY
RotationOrder XZY
To view the source code for org.apache.commons.math3.geometry.euclidean.threed RotationOrder XZY.
Click Source Link
From source file:IK.AbstractBone.java
public AbstractBone(AbstractBone par, //parent bone double xAngle, //how much the bone should be pitched relative to its parent bone double yAngle, //how much the bone should be rolled relative to its parent bone double zAngle, //how much the bone should be yawed relative to its parent bone String inputTag, //some user specified name for the bone, if desired double inputBoneHeight //bone length ) throws NullParentForBoneException { if (par != null) { if (this.tag == null || this.tag == "") { this.tag = Integer.toString(System.identityHashCode(this)); } else//from www . ja v a2s . c om this.tag = inputTag; this.boneHeight = inputBoneHeight; AbstractAxes tempAxes = par.localAxes().getAbsoluteCopy(); Rotation toRot = new Rotation(RotationOrder.XZY, xAngle, yAngle, zAngle); Rot newRot = new Rot(); newRot.rotation = toRot; tempAxes.rotateTo(newRot); this.parent = par; this.parentArmature = this.parent.parentArmature; parentArmature.addToBoneList(this); generateAxes(parent.getTip(), tempAxes.x().heading(), tempAxes.y().heading(), tempAxes.z().heading()); this.localAxes.orthogonalize(); localAxes.setParent(parent.localAxes); previousOrientation = localAxes.attachedCopy(true); majorRotationAxes = parent.localAxes().getAbsoluteCopy(); majorRotationAxes.translateTo(parent.getTip()); majorRotationAxes.setParent(parent.localAxes); this.parent.addFreeChild(this); this.parent.addChild(this); this.updateSegmentedArmature(); } else { throw new NullParentForBoneException(); } }
From source file:IK.AbstractBone.java
/** * @return an array where each element indicated how much this bone is rotated on the X,Y,Z (in that order) * axes relative to its parent bone. If the bone has no parent, this method * throws an exception.//from www .jav a2 s . c o m * @throws NullParentForBoneException */ public double[] getXZYAngle() throws NullParentForBoneException { if (this.parent != null) { Rot boneOffset = new Rot(this.majorRotationAxes.x().heading(), this.majorRotationAxes.y().heading(), this.localAxes().x().heading(), this.localAxes().y().heading()); return boneOffset.rotation.getAngles(RotationOrder.XZY); } else { return null; } }