quaternions

Efficient quaternion angular velocity

假装没事ソ 提交于 2019-12-19 04:49:26
问题 I have an orientation expressed with a quaternion and an angular velocity expressed as either a quaternion or a number (radians per second around the original orientation). I understand how to do this using conversion to axis-angle but that method is rather computationally expensive and is not a realistic option. How would I go about modifying the orientation quaternion given a time interval (in seconds)? I need a solution for both cases (the quaternion and the number). However, converting

Look-at quaternion using up vector

跟風遠走 提交于 2019-12-18 13:27:30
问题 I have a camera (in a custom 3D engine) that accepts a quaternion for the rotation transform. I have two 3D points representing a camera and an object to look at. I want to calculate the quaternion that looks from the camera to the object, while respecting the world up axis . This question asks for the same thing without the "up" vector. All three answers result in the camera pointing in the correct direction, but rolling (as in yaw/pitch/roll; imagine leaning your head onto your ear while

How to animate the camera in three.js to look at an object?

心不动则不痛 提交于 2019-12-18 12:42:06
问题 In Three.js, I would like to have the camera looking at an object in the scene, and when I click on another object, to have the camera rotate smoothly to look at the new object. (i.e animate the rotation of the camera). I´ve checked in SO and this is the most similar question : Three.js How to use quaternion to rotate camera I've also tried modifying the code in this website and I manage to get something like this http://jsfiddle.net/F7Bh3/ var quat0 = mesh2.quaternion; var eye = mesh2

Efficient C++ quaternion multiplication using cv::Mat

僤鯓⒐⒋嵵緔 提交于 2019-12-18 12:28:06
问题 I want to multiply 2 quaternions, which are stored in a cv::Mat structure. I want the function to be as efficient as possible. I have the following code so far: /** Quaternion multiplication * */ void multiplyQuaternion(const Mat& q1,const Mat& q2, Mat& q) { // First quaternion q1 (x1 y1 z1 r1) const float x1=q1.at<float>(0); const float y1=q1.at<float>(1); const float z1=q1.at<float>(2); const float r1=q1.at<float>(3); // Second quaternion q2 (x2 y2 z2 r2) const float x2=q2.at<float>(0);

quaternion libraries in C/C++ [closed]

拥有回忆 提交于 2019-12-18 11:43:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Any good libraries for quaternion calculations in C/C++ ? Side note: any good tutorials/examples? I've google it and been to the first few pages but maybe you have have some demos/labs from compsci or math courses you could/would share? Thanks 回答1: I'm a fan of the Irrlicht quaternion class. It is zlib licensed

Difference between the two quaternions

杀马特。学长 韩版系。学妹 提交于 2019-12-18 11:36:54
问题 Solved I'm making a 3D portal system in my engine (like Portal game). Each of the portals has its own orientation saved in a quaternion. To render the virtual scene in one of the portals I need to calculate the difference between the two quaternions, and the result use to rotate the virtual scene. When creating the first portal on the left wall, and second one on the right wall, the rotation from one to another will take place in only one axis, but for example when the first portal will be

How do I rotate a Quaternion with 2nd Quaternion on its local or world axes without using transform.Rotate?

这一生的挚爱 提交于 2019-12-18 05:16:21
问题 Transform.Rotate has a very helpful interface for selecting whether or not a rotation should be made relative to world axes or the local axes. Behind the scenes, it's doing some math to the transform's rotation , a Quaternion , with another Quaternion . And the exact nature of this math changes depending on if you choose the local or world flag. How can I do this sort of math without assigning the first Quaternion to a Transform's rotation (wasting memory and/or time) just to do some math

How to get the euler-angles from the rotation vector (Sensor.TYPE_ROTATION_VECTOR)

风流意气都作罢 提交于 2019-12-18 04:55:37
问题 I rotated my android device in x direction (from -180 degree to 180 degree), see image below. And I assume only Rotation vector x value is changed. Y and z maybe have some noise, but it should be not much difference among the values. However, I receive this. Kindly see https://docs.google.com/spreadsheets/d/1ZLoSKI8XNjI1v4exaXxsuMtzP0qWTP5Uu4C3YTwnsKo/edit?usp=sharing I suspect my sensor has some problem. Any idea? Thank you very much. Jimmy 回答1: Your sensor is fine. Well, the rotation vector

Quaternion - Rotate To

折月煮酒 提交于 2019-12-18 04:20:30
问题 I have some object in world space, let's say at (0,0,0) and want to rotate it to face (10,10,10). How do i do this using quaternions? 回答1: This question doesn't quite make sense. You said that you want an object to "face" a specific point, but that doesn't give enough information. First, what does it mean to face that direction? In OpenGL, it means that the -z axis in the local reference frame is aligned with the specified direction in some external reference frame. In order to make this

'Difference' between two quaternions

房东的猫 提交于 2019-12-17 23:39:39
问题 I'm working in Ogre, but it's a general quaternion problem. I have an object, to which I apply a rotation quaternion Q1 initially. Later, I want to make it as if I initially rotated the object by a different quaternion Q2. How do I calculate the quaternion which will take the object, already rotated by Q1, and align it as if all I did was apply Q2 to the initial/default orientation? I was looking at (s)lerping, but I am not sure if this only valid on orientations rather than rotations ? 回答1: