euler-angles

Split quaternion into axis rotations

爷,独闯天下 提交于 2019-12-02 08:58:05
I have a quaternion representing the orientantion of an object (yellow box and sphere). I would like to know if it is possible to split that quaternion into other quaternions that give us the rotation of each local axis (X, Y and Z). What I have been doing until now is getting the Euler representation and work with it, but it is not the correct solution for my particular case: Given two points (blue boxes), I want to limit the orientation of my object so that it can't point out of the grey plane, even if my quaternion looks out of that plane. I want to split (decompose) the quaternion, because

Unity3d - eulerAngles (local and global) totally different than what's in inspector

余生颓废 提交于 2019-12-01 22:08:13
问题 In the inspector for a gameObject I'm using the starting rotation is "-90", but when I run print(transform.eulerAngles.x) I get 270 (ditto for transform.localEulerAngles.x ). If I tilt the gameObject downward, the inspector X value gets bigger (say, to -85) as it should. The printed transform.eulerAngles.x also gets bigger, say to 274. Here's where things get weird: If I tilt the gameObject upward the inspector x coordinate gets smaller (ex, to -95), as it should, BUT the printed eulerAngle.x

Unity3d - eulerAngles (local and global) totally different than what's in inspector

南楼画角 提交于 2019-12-01 20:59:29
In the inspector for a gameObject I'm using the starting rotation is "-90", but when I run print(transform.eulerAngles.x) I get 270 (ditto for transform.localEulerAngles.x ). If I tilt the gameObject downward, the inspector X value gets bigger (say, to -85) as it should. The printed transform.eulerAngles.x also gets bigger, say to 274. Here's where things get weird: If I tilt the gameObject upward the inspector x coordinate gets smaller (ex, to -95), as it should, BUT the printed eulerAngle.x value gets BIGGER (here to 274). So if I rotate the object up or down from the eulerAngle.x being 270,

html5 - Get device orientation rotation in relative coordinate

自作多情 提交于 2019-12-01 04:48:08
I'm trying to get the change in orientation between two deviceorientation events along the left-right axis, and top-bottom axis, those axis being usually defined as the phone x and y axis ( https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained ) ie between instants t1 and t2 where those phone axis move from (x1, y1) to (x2, y2) , It'd like to get (angle(x2-x1), angle(y1-y2)) . When the device is in portrait mode (in opposition to landscape mode), those axis seems to correspond to the beta and gamma . However when the phone is vertical (bottom facing

Is there an algorithm for converting quaternion rotations to Euler angle rotations?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 10:12:44
问题 Is there an existing algorithm for converting a quaternion representation of a rotation to an Euler angle representation? The rotation order for the Euler representation is known and can be any of the six permutations (i.e. xyz, xzy, yxz, yzx, zxy, zyx). I've seen algorithms for a fixed rotation order (usually the NASA heading, bank, roll convention) but not for arbitrary rotation order. Furthermore, because there are multiple Euler angle representations of a single orientation, this result

Conversion euler to matrix and matrix to euler

一曲冷凌霜 提交于 2019-11-30 09:35:29
I'm trying to convert a 3D rotation described in term of euler angles into a matrix and then back, using .NET/C#. My conventions are: left handed system (x right, y top, z forward) order of rotations: heading around y, pitch around x, bank around z rotations are positive using the left hand rule (thumb pointing to +infinity) My trial is: Euler to matrix (I've removed the x,y,z translation part for simplification) Matrix3D matrix = new Matrix3D() { M11 = cosH * cosB - sinH * sinP * sinB, M12 = - sinB * cosP, M13 = sinH * cosB + cosH * sinP * sinB, M21 = cosH * sinB + sinH * sinP * cosB, M22 =

Is there an algorithm for converting quaternion rotations to Euler angle rotations?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 19:47:25
Is there an existing algorithm for converting a quaternion representation of a rotation to an Euler angle representation? The rotation order for the Euler representation is known and can be any of the six permutations (i.e. xyz, xzy, yxz, yzx, zxy, zyx). I've seen algorithms for a fixed rotation order (usually the NASA heading, bank, roll convention) but not for arbitrary rotation order. Furthermore, because there are multiple Euler angle representations of a single orientation, this result is going to be ambiguous. This is acceptable (because the orientation is still valid , it just may not

Android FaceDetector.Face Euler angles are 0 all the time

折月煮酒 提交于 2019-11-29 16:50:38
问题 I'm trying to get a the Euler angle of a Face that is detected by FaceDetector. Here is what I use to output to Logcat: Log.v("debug", " X: " + face.pose(Face.EULER_X) + " Y: " + face.pose(Face.EULER_Y) + " Z: " + face.pose(Face.EULER_Z) ); But it always returns 0.0 for all three, no matter what angle the face is at. Any ideas why? 回答1: Yeah the FaceDetector from API 1 never returns a pose angle. You can look at the source code to verify. The newer FaceDetectionListener from API 14 will

Euler angle to Quaternion then Quaternion to euler angle

好久不见. 提交于 2019-11-28 20:44:42
I'm using lib glm ( http://glm.g-truc.net/ ) for test quaternion but I've a problem; when I convert euler angle to quaternion then immediatly quaternion to euler angles, my result are totally different from my initial euler angles. Is this normal? Could it be because the rotations are not communative? Code test: #include <glm\quaternion.hpp> #include <math.h> #define PI M_PI #define RADTODEG(x) ( (x) * 180.0 / PI ) #define DEGTORAD(x) ( (x) * PI / 180.0 ) int main( void ) { float RotX = 90.f; float RotY = 180.f; float RotZ = -270.f; if ( RotX || RotY || RotZ ) { std::cout << "Init: x= " <<

Rotate GameObject back and forth

て烟熏妆下的殇ゞ 提交于 2019-11-28 14:17:59
I would like to rotate an object back and forth between 90,-90 on the Y axis. The problem is I can set the object in the editor at -90, but when I run the project -90 suddenly becomes 270. Anyway here is the code that I'm using: void Update() { if (transform.eulerAngles.y >= 270) { transform.Rotate(Vector3.up * speed * Time.deltaTime); } else if (transform.eulerAngles.y <= 90) { transform.Rotate(Vector3.up * -speed * Time.deltaTime); } } It always gets stuck in the middle around 360 degrees. Help? Programmer Just like moving GameObject back and forth, you can rotate GameObject back and forth