MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / inverseSim3d

Function inverseSim3d

src/utils/sim3dTransforms.ts:118–133  ·  view source on GitHub ↗
(bFromA: Sim3d)

Source from the content-addressed store, hash-verified

116 * - translation_inv = (rotation_inv * translation) / -scale
117 */
118export 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

Callers 1

transformCameraPoseFunction · 0.85

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected