mkkellogg / GaussianSplats3D

Three.js-based implementation of 3D Gaussian splatting
MIT License
1.54k stars 199 forks source link

Fix missing _axis variable #294

Closed PeterZhizhin closed 3 months ago

PeterZhizhin commented 4 months ago

This piece of code uses uninitialized variable:

    setDirection( dir ) {
        if (dir.y > 0.99999) {
            this.quaternion.set(0, 0, 0, 1);
        } else if (dir.y < - 0.99999) {
            this.quaternion.set(1, 0, 0, 0);
        } else {
            _axis.set(dir.z, 0, -dir.x).normalize();
            const radians = Math.acos(dir.y);
            this.quaternion.setFromAxisAngle(_axis, radians);
        }
    }

I add a global constant to fix this, similar to this threejs example file: https://github.com/mrdoob/three.js/blob/dev/examples/jsm/utils/CameraUtils.js

mkkellogg commented 3 months ago

I included this fix with this PR that's going into dev soon and should be released this week.