(bFromA: Sim3d)
| 116 | * - translation_inv = (rotation_inv * translation) / -scale |
| 117 | */ |
| 118 | export function inverseSim3d(bFromA: Sim3d): Sim3d { |
| 119 | const scaleInv = 1 / bFromA.scale; |
| 120 | const rotationInv = bFromA.rotation.clone().invert(); |
| 121 | |
| 122 | // t_inv = (R_inv * t) / -scale = R_inv * t * (-1/scale) |
| 123 | const translationInv = bFromA.translation |
| 124 | .clone() |
| 125 | .applyQuaternion(rotationInv) |
| 126 | .multiplyScalar(-scaleInv); |
| 127 | |
| 128 | return { |
| 129 | scale: scaleInv, |
| 130 | rotation: rotationInv, |
| 131 | translation: translationInv, |
| 132 | }; |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Compose two Sim3d transforms: c_from_a = c_from_b * b_from_a |
no test coverage detected