quaternions

How does this Quaternion rotation code work?

為{幸葍}努か 提交于 2019-12-30 01:31:07
问题 I'm trying to understand how the quaternion rotations work, I found this mini tutorial http://www.julapy.com/blog/2008/12/22/quaternion-rotation/ but He makes some assumptions that I can't workout, like how can I do " work out the rotation vectors around each axis, simply by rotating the vector around an axis. " and how does he calculate angleDegreesX, angleDegreesY and angleDegreesZ? Can some one provide a working example or explanation? 回答1: The shortest possible summary is that a

Three.js Object3d cylinder rotation to align to a vector

夙愿已清 提交于 2019-12-29 03:39:09
问题 I have searched far and wide, but can't seem to figure this pretty basic thing out. I have seen other examples on stackoverflow and elsewhere from a year or two ago, but they fail to work with the latest version of Three.js. Here is a version of what i'm working on: http://medschoolgunners.com/sandbox/3d/. I'm trying to get the grey cone to exactly align with the unlabeled red vector. Ie. I want the tip of the cone to be exactly aligned with the vector and point out from the origin in that

Why are quaternions used for rotations?

若如初见. 提交于 2019-12-29 02:17:33
问题 I'm a physicist, and have been learning some programming, and have come across a lot of people using quaternions for rotations instead of writing things in matrix/vector form. In physics, there are very good reasons we don't use quaternions (despite the bizarre story that's occasionally told about Hamilton/Gibbs/etc). Physics requires that our descriptions have good analytic behavior (this has a precisely defined meaning, but in some rather technical ways that go far beyond what's taught in

ROS Rviz visualization of Tango Pose data

杀马特。学长 韩版系。学妹 提交于 2019-12-25 17:07:39
问题 We have modified sample code for the C API so Tango pose data (position (x,y,z) and quaternion (x,y,z,w) ) is published as PoseStamped ROS messages. We are attempting to visualize the pose using Rviz. The pose data appears to need some transformation as the rotation of the Rviz arrow does not match the behavior of the Tango when we move it around. We realize that in the sample code, before visualization on the Tango screen, the pose data is transformed into a 4x4 Pose matrix (function

iPhone rotation quaternion absolute coordinates?

跟風遠走 提交于 2019-12-25 03:18:12
问题 I have an iPhone with gyroscope. Let's say I have a quaternion of the phone rotation Q. I want to show points on screen relative of the world absolute coordinates. So with every rotation of my phone this points will be "still" in the real 3d space (sort of augmented reality). Let's say it is 4 points forming a rectangle. So I have created 4 points in 3d space relative to my phone screen and apply the transformation of Q to each of it. I thought it should be very simple but my points get

rotate Object towards another in Unity3D

强颜欢笑 提交于 2019-12-24 15:28:58
问题 I have already this function from this question. I changed the sign of the rotation: void rotateBotConnector() { Vector3 diff = (player.transform.position - botConnector.transform.position).normalized; float rot_z = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg; botConnector.transform.localRotation = Quaternion.Euler(0f, 0f, -(rot_z - 90f)); } But the problem is, that now my object follows the player on the XZ plane but when the rotation reaches a certain degree, left or right, the object stops

Open a Door Front and Back in Unity3D similar to Amnesia

北慕城南 提交于 2019-12-24 13:39:16
问题 I am attempting to implement a feature similar to Amnesia: The Dark Descent's that makes the player hold down the mouse button and drag forwards or backwards on a door in order to open it (if you are not familiar see Door Example at about 36:30). I have the following code, and it sort of works, but the opening is jittery and bounces back and forth a bit, and I cannot figure out if I'm using transform.Rotate incorrectly: if (previousMousePosition == garbageVector) // if this is the first frame

calculate quaternion by coordinate 2 points of object in two positions

冷暖自知 提交于 2019-12-24 12:49:16
问题 Object rotate in 3D. I have rotation center and coordinate of 2 point in rotate and not rotate position. Calculate quaternion that rotate object from first position to two position. 回答1: We have to vector OA' and OB' in first position of object OA and OB in second position Q vector part quaternion Q 0 scalar part fig.1 COMMENT OA OB - dot vector product OAxOB - cross vector product Quaternion of rotation object from first positon to second was: 1 case If OA OB'-OB OA' not equal zero, then Q=Q

Rotation with Quaternion not quite right

无人久伴 提交于 2019-12-24 12:13:43
问题 Following on from my previous question, I have now managed to rotate my object with quaternions but there is still a small problem and I dont know how to solve it. With the code below my object rotates round the x and y axis. But it always jumps back to the initial position when I switch between x- and y-key. So I never get a rotation from the new position, but always from the one with which the programm started. Quaternion q1 = quaternion->quat_rotate(anglex,1,0,0); Quaternion q2 =

How to calculate Azimuth & Elevation of objects relative to camera using cam quaternion …?

依然范特西╮ 提交于 2019-12-24 09:42:33
问题 I have a camera quaternion (a,b,c,d) and a cam position (camX, camY, camZ) I have an object with 3d coordinates (x,y,z) I need to calculate azimuth, elevation of objects relatively to the cam view direction & plane. First question If I put the object in center of my view, f I rotate the cam, translate it, I should have the same azimuth value, right ?? I don't have that. Second question, the calculation. I'm doing object coordinates - cam position, in order to translate the object to the cam.