quaternions

Wiimote orientation as a 3D vector

旧时模样 提交于 2019-12-07 21:04:34
问题 I wonder if it is possible, as the Wiimote has 3 accelerometers, to convert the accelerometers readings to a 3D vector. I know the trick to extract pitch/roll, but it only uses the X and Z accelerometers, and has the gimbal lock problem. What I would like is a full 3D vector, that can be converted to a quaternion rotation representation. 回答1: Thinking about it further, the accelerometers values are the components of the vector I was looking for... You only have to express the shortest arc

Gyroscope with compass help needed

↘锁芯ラ 提交于 2019-12-07 17:03:50
问题 I need to have a game object point north AND I want to combine this with gyro.attitude input. I have tried, unsuccessfully, to do this in one step. That is, I couldn't make any gyro script, which I found on the net, work with the additional requirement of always pointing north. Trust me, I have tried every script I could find on the subject. I deduced that it's impossible and probably was stupid to think it could be done; at least not this way (i.e. all-in-one). I guess you could say I

Properly normalizing a dual quaternion

百般思念 提交于 2019-12-07 12:59:18
问题 I'm having trouble with dual quaternions, and I believe it's because they're not properly normalized. A, B and A' are dual quaternions where the latter is conjugated. When doing this: Q = A * B * A' I should theoretically always end up with Q = B if A and B are properly normalized. But in some cases, I don't, and it's completely messing up my whole skeletal hierarchy. Many pages show that the norm of a dual quaternion is ||Q|| = sqrt(QQ'), but that means taking the square root of a dual

Smooth rotation with quaternions

前提是你 提交于 2019-12-07 05:21:44
问题 Quaternion can describe not only rotation, but also an orientation, i.e. rotation from initial (zero) position. I was wishing to model smooth rotation from one orientation to another. I calculated start orientation startOrientation and end orientation endOrientation and was wishing to describe intermediate orientations as startOrientation*(1-argument) + endOrientation*argument while argument changes from 0 to 1 . The code for monkey engine update function is follows: @Override public void

Find final world coordinates from model matrix or quaternion

不打扰是莪最后的温柔 提交于 2019-12-06 17:05:49
问题 I am displaying an object in OpenGL using a model matrix for the object, which I build from my pre-stored object location AND a quaternion applied to the rotation. I need to find the final cartesian coordinates in 3D of my object AFTER the rotations and transformations applied (the coordinates that the object appears at on the screen). How can I get the plain coordinates? 回答1: If I understand correctly, you have an object; if you rendered it without applying any transformation, its center

Direction vector to a rotation (three.js)

半腔热情 提交于 2019-12-06 16:13:17
I'm attempting rotate an arrow on the surface of a planet to face the direction it is traveling. I can get the direction vector and the up vector from the surface normal. How would I go about turning this into a quaternion for my arrows rotation. I'm using three.js so any suggested methods they provided that I can use would be useful. Cheers. The information I have so far. var upVector = new THREE.Vector3(); upVector.subVectors( new THREE.Vector3(0,0,0), lastVec ); var dirVector = new THREE.Vector3(); upVector.subVectors( lastVec, destVec ); var sideVector = new THREE.Vector3(); sideVector

Quaternion from two vector pairs

自作多情 提交于 2019-12-06 15:40:40
I have two vector pairs (before and after rotation). before rotation: [x1,y1,z1] [x2,y2,z2] after rotation: [x1',y1',z1'] [x2',y2',z2'] How to create a quaternion representing this rotation? In most cases there is no rotation which transforms 2 vectors into 2 other vectors. Here is a simple way to visualize why: a rotation does not change the angle between vectors. If the angle between the 2 vectors before the rotation is different from the angle between the 2 vectors after the rotation, then there is no rotation which meets your criteria. This said there may be an optimal quaternion with an

Add offset to DeviceOrientationControls in three.js

試著忘記壹切 提交于 2019-12-06 14:55:58
I'm trying to add an offset to the camera after deviceControls.update(); command. I used DeviceOrientationControls as shown in this first example. The offset will be the result of a drag gesture, as presents in this example. When I multiply the 2 quaternions (I have tried a x b and b x a), the final result is not correct. Here is my operation : const m1 = new THREE.Matrix4(); m1.lookAt(new THREE.Vector3(), camera.target, THREE.Object3D.DefaultUp.clone()); const quater = new THREE.Quaternion(); quater.setFromRotationMatrix(m1); const finalQuater = new THREE.Quaternion(); finalQuater

Controling OpenSceneGraph camera with Cartesian coordinates and Euler angles

巧了我就是萌 提交于 2019-12-06 12:26:13
问题 I am attempting to control an osg::Camera with Cartesian coordinates (X, Y, Z) and Euler angles (Yaw, Pitch, Roll) that I read in from file. Part 1 For some reason setting my roll will cause the camera to rotate around the z-axis and not the y-axis as expected. The following is the previously written camera manipulator that I am feeding my positional data to. class EulerManipulator : public osgGA::CameraManipulator { public: EulerManipulator(osg::ref_ptr<osg::View> x) : view(x), camView(new

Wiimote orientation as a 3D vector

泪湿孤枕 提交于 2019-12-06 11:34:06
I wonder if it is possible, as the Wiimote has 3 accelerometers, to convert the accelerometers readings to a 3D vector. I know the trick to extract pitch/roll, but it only uses the X and Z accelerometers, and has the gimbal lock problem. What I would like is a full 3D vector, that can be converted to a quaternion rotation representation. Thinking about it further, the accelerometers values are the components of the vector I was looking for... You only have to express the shortest arc between a reference vector and this vector as a quaternion. For example, if accel is a (normalized) vector