Skip to content

Commit

Permalink
fix: change THREE.Math to THREE.MathUtils
Browse files Browse the repository at this point in the history
change THREE.Math to THREE.MathUtils
  • Loading branch information
lafflan authored and mgermerie committed Oct 20, 2022
1 parent e455bdb commit 826b5bd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Renderer/Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class Camera {
this.camera3D.bottom = -halfH;
this.camera3D.top = halfH;
} else if (this.camera3D.isPerspectiveCamera) {
this.camera3D.fov = 2 * THREE.Math.radToDeg(Math.atan(
(height / this.height) * Math.tan(THREE.Math.degToRad(this.camera3D.fov) / 2),
this.camera3D.fov = 2 * THREE.MathUtils.radToDeg(Math.atan(
(height / this.height) * Math.tan(THREE.MathUtils.degToRad(this.camera3D.fov) / 2),
));
}
this.camera3D.aspect = ratio;
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/CameraUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export default {
cameraTransformOptions.range = 1000;
} else if (camera.isPerspectiveCamera) {
// setup range for camera placement
const verticalFOV = THREE.Math.degToRad(camera.fov);
const verticalFOV = THREE.MathUtils.degToRad(camera.fov);
if (dimensions.x / dimensions.y > camera.aspect) {
const focal = (view.domElement.clientHeight * 0.5) / Math.tan(verticalFOV * 0.5);
const horizontalFOV = 2 * Math.atan(view.domElement.clientWidth * 0.5 / focal);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/CameraUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('Camera utils unit test', function () {
camera3D.updateMatrixWorld(true);
assert.ok(
CameraUtils.getCameraTransformOptionsFromExtent(view, camera3D, subExtent).range -
subExtent.planarDimensions().y / (2 * Math.tan(THREE.Math.degToRad(camera3D.fov) / 2)) < 10 ** -14,
subExtent.planarDimensions().y / (2 * Math.tan(THREE.MathUtils.degToRad(camera3D.fov) / 2)) < 10 ** -14,
);
});
});
3 changes: 1 addition & 2 deletions test/unit/globeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ describe('GlobeView', function () {
new OBB().setFromExtent(extent).box3D.getSize(size);
assert.ok(
CameraUtils.getTransformCameraLookingAtTarget(extentViewer, camera3D).range -
size.x / (2 * Math.tan(THREE.Math.degToRad(camera3D.fov) / 2))
size.x / (2 * Math.tan(THREE.MathUtils.degToRad(camera3D.fov) / 2))
< 10 ** -6,
);
});
});

0 comments on commit 826b5bd

Please sign in to comment.