Skip to content

Commit a12eb0e

Browse files
committed
3D generation should map coords on a sphere not a cylinder
1 parent a4b187e commit a12eb0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polar-scanner-x3d.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ PolarScanner.prototype.indexedFaceSet = function(stpInc, stpNbr, srvInc, srvNbr,
4242
for (var i=0; i<scan.length; i++) {
4343
srvAngle = srvFrm + srvInc * (i % srvNbr);
4444
stpAngle += i != 0 && i % srvNbr == 0 ? stpInc : 0;
45-
coords.push((scan[i] * Math.cos(stpAngle)).toFixed(this._us_precision)); // x
45+
coords.push((scan[i] * Math.sin(srvAngle) * Math.cos(stpAngle)).toFixed(this._us_precision)); // x
4646
coords.push((scan[i] * Math.cos(srvAngle)).toFixed(this._us_precision)); // y
47-
coords.push((scan[i] * Math.sin(stpAngle)).toFixed(this._us_precision)); // z
47+
coords.push((scan[i] * Math.sin(srvAngle) * Math.sin(stpAngle)).toFixed(this._us_precision)); // z
4848
}
4949

5050
var indexes = [];

0 commit comments

Comments
 (0)