Skip to content

Commit 3b12483

Browse files
authored
Fix camera pose loading bug (#728)
1 parent 588abcf commit 3b12483

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

src/file-handler.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,6 @@ const loadCameraPoses = async (file: ImportFile, events: Events) => {
145145
const json = await response.json();
146146

147147
if (json.length > 0) {
148-
// calculate the average position of the camera poses
149-
const ave = new Vec3(0, 0, 0);
150-
json.forEach((pose: any) => {
151-
vec.set(pose.position[0], pose.position[1], pose.position[2]);
152-
ave.add(vec);
153-
});
154-
ave.mulScalar(1 / json.length);
155-
156148
// sort entries by trailing number if it exists
157149
const sorter = (a: any, b: any) => {
158150
const avalue = a.id ?? a.img_name?.match(/\d*$/)?.[0];
@@ -165,8 +157,8 @@ const loadCameraPoses = async (file: ImportFile, events: Events) => {
165157
const p = new Vec3(pose.position);
166158
const z = new Vec3(pose.rotation[0][2], pose.rotation[1][2], pose.rotation[2][2]);
167159

168-
const dot = vec.sub2(ave, p).dot(z);
169-
vec.copy(z).mulScalar(dot).add(p);
160+
// Use fixed offset along Z-axis direction instead of variable dot product
161+
vec.copy(z).mulScalar(10).add(p);
170162

171163
events.fire('camera.addPose', {
172164
name: pose.img_name ?? `${file.filename}_${i}`,

0 commit comments

Comments
 (0)