perspectivecamera

ThreeJS orbit controls set target without lookAt

非 Y 不嫁゛ 提交于 2020-02-22 04:21:31
问题 I am trying to make a 3D viewer for building models. We have the model loaded and are trying to make some sort of interaction with the model. Therefor we are using OrbiControls for rotating, panning and zooming the model. We want to have the behaviour in the viewer that when a user clicks and drags (thus rotating), the rotation center is at the point of the building where the user clicks. I thought I was wise by changing the target of the OrbitControl as such: control.target.set(newX, newY,

ThreeJS orbit controls set target without lookAt

和自甴很熟 提交于 2020-02-22 04:20:12
问题 I am trying to make a 3D viewer for building models. We have the model loaded and are trying to make some sort of interaction with the model. Therefor we are using OrbiControls for rotating, panning and zooming the model. We want to have the behaviour in the viewer that when a user clicks and drags (thus rotating), the rotation center is at the point of the building where the user clicks. I thought I was wise by changing the target of the OrbitControl as such: control.target.set(newX, newY,

THREE.js PerspectiveCamera focalLength off by a factor of two, inconsistent with FOV

房东的猫 提交于 2020-01-15 05:50:06
问题 In THREE.js we construct a camera using the following function const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000); We know from optics that the field of view of a camera is related to the focal length by the following equation FOV = arctan(d/2f) where FOV is the vertical FOV in degrees, d is the height of the image plane in mm, and f is the focal length of the camera in mm. After reading the documentation on the matter, it seems as though d is set by default to be 35mm

How to rotate a THREE.PerspectiveCamera around on object

牧云@^-^@ 提交于 2020-01-02 04:33:10
问题 I am making this program where you can click on an object, zoom to it, then look at it from all angles by holding the right mouse button and dragging. I need the camera to be going around the object, not rotate the object with the camera looking at it. I honestly just have no idea how to math it out! For testing there is already a game object with an xyz we have selected and are looking at var g = new GameObject(500, 0, 0);//The game object with xyz this.selected = g;//set selected to g /

three.js TextGeometry: text alignment gets messed up after re-setting the rotation

a 夏天 提交于 2019-12-25 02:28:10
问题 I have created a THREE. TubeGeometry and using the THREE.TextGeometry added the text to the tube created. The tube is then added to scene. Also the I have set the text rotation to camera rotation. The code snippet is below text.rotation = camera.rotation; text.lookAt(camera.position); My application has a button by which I can reset the original position of my tube geometry. Internally, this is done by reseting the camera to its originally position. Initially, when the page loads up, the tube

three.js perspectivecamera current angle in degrees

 ̄綄美尐妖づ 提交于 2019-12-24 05:13:12
问题 For a project I use a PerspectiveCamera which gets rotated using the vrcontrols from r69. At one point I require the current viewing angle degrees (horizontal & vertical degrees at which direction the camera is looking at). How would I acquire those? 回答1: What you want are also called euler angles. Three.js eulers have a built in function to set them from a quaternion. var quat = new THREE.Quaternion(); var euler = new THREE.Euler(); euler.setFromQuaternion(quat); alert('X in degrees: ' +

Perspective Transform in Matlab

∥☆過路亽.° 提交于 2019-12-24 00:16:19
问题 Lets say : point1 = [1 2 3 4 5 ; 1 2 3 4 5 ]; point2 = [2 3 4 5 6 ; 2 3 4 5 6 ]; s = findHomography(points1,points2); Coordinates of an object containing points1 are [0,0; 10,0; 0,10; 10,10] How do I find calculate perspective transform on the object so that it transforms to my test coordinates. There are built in function in opencv that can do this , however , I really need a simple example to clear out my confusion . Thanks. 回答1: Perspective transform is not a linear transformation. So you

Three.js - Good z distance of camera for full view of box

霸气de小男生 提交于 2019-12-23 10:16:48
问题 I display with Three.js a scene of size 700x700. In this scene, I generate a system of particles with random positions between -250 and 250 (for x,y,z), so the box is 500x500 size. to compute the right distance of camera (for an adapted full view of the box), I tried : <script> if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); var container, stats; var camera, controls, scene, renderer; var cross; var width = 700, height = 700; init(); animate(); function init() { camera = new THREE

Cartesian Coordinate System in Perspective Projection

 ̄綄美尐妖づ 提交于 2019-12-22 13:54:28
问题 I'm still implementing a perspective projection for my augmented reality application. I've already asked some questions about the viewport-calculation and other camera stuff, which is explained from Aldream in this thread However, I don't get any useful value at the moment and I think this depends on my calculation of the cartesian coordinate space. I had some different ways to transform latitude,longitude and altitude to a cartesian coordinate space, but nothing of them seems to work

three.js rotate camera in plane

倖福魔咒の 提交于 2019-12-21 20:01:31
问题 I have a camera in my app: camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); camera.position.z = 1; camera.position.y = -5; camera.rotateOnAxis(new THREE.Vector3(1, 0, 0), degInRad(90)); camera.up = new THREE.Vector3(0, 0, 1); Those code in render function must rotate the camera while I'm pressing the keys: if (leftPressed) { camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(1)); } else if (rightPressed) { camera.rotateOnAxis(