我跟随this回答来计算three.js中Sphere Geometry
的大小。但是,当我通过屏幕截图测量尺寸时,由于计算结果不正确,我有点遗漏了某些东西。
我生成了这样的设置:
this.cubeGeometry = new THREE.SphereGeometry(210, 60, 60);
this.camera = new THREE.PerspectiveCamera(45, this.size.w / this.size.h, 1, 20000);
this.camera.position.z = 1000;
然后我计算这样的大小
var vFOV = THREE.Math.degToRad( this.camera.fov ); // => 0.7853981633974483
var height = 2 * Math.tan( vFOV / 2 ) * 1000; // => 828.4271247461901
var fraction = 210 / height; // => 0.253492424049175
var finalSize = this.size.h * fraction // => 242.33875739101128
屏幕截图大小约为500px。我错过了什么?
谢谢!