IList <FracturedParticle> fractureSolidWithPositionAndRotation(SpatialVectorDouble objectGlobalPosition, Quaternion objectRotation, SolidCluster.SolidWithPositionAndRotation solidWithPositionAndRotation) { uint roughtlyNumberOfFracturedElements = 64; IList <FracturedParticle> fracturedParticles = SimpleFracturing.fractureSolid(solidWithPositionAndRotation.solid, roughtlyNumberOfFracturedElements); // transform positions from local to global foreach (FracturedParticle iFracturedParticle in fracturedParticles) { Matrix localToGlobalTranslation = MatrixUtilities.calcLocalToGlobalTranslationMatrix(objectGlobalPosition); Matrix localToGlobalRotation = QuaternionUtilities.convToRotationMatrix4(objectRotation); Matrix localToGlobal = (localToGlobalTranslation * localToGlobalRotation) * MatrixUtilities.calcLocalToGlobalRotationAndTranslationMatrix(solidWithPositionAndRotation.localPosition, solidWithPositionAndRotation.localRotation); iFracturedParticle.relativePosition = SpatialVectorUtilities.toVector3(new SpatialVectorDouble(localToGlobal * SpatialVectorUtilities.toVector4(iFracturedParticle.relativePosition).asMatrix)); } return(fracturedParticles); }
public Matrix calcLocalToGlobalTranslationMatrix() { return(MatrixUtilities.calcLocalToGlobalTranslationMatrix(position)); }