angle

Convert a Unit Vector to a Quaternion

懵懂的女人 提交于 2019-12-22 05:52:21
问题 So I'm very new to quaternions, but I understand the basics of how to manipulate stuff with them. What I'm currently trying to do is compare a known quaternion to two absolute points in space. I'm hoping what I can do is simply convert the points into a second quaternion, giving me an easy way to compare the two. What I've done so far is to turn the two points into a unit vector. From there I was hoping I could directly plug in the i j k into the imaginary portion of the quaternion with a

What's a quaternion rotation?

浪尽此生 提交于 2019-12-22 01:26:56
问题 Is quaternion rotation just a vector with X,Y,Z which the object will rotate towards, and a roll which turns the object on its axis? Is it that simple? Meaning if you have X=0, Z=0 and Y=1 the object will face upwards? And if you have Y=0, Z=0 and X=1 the object will face to the right? (assuming X right, Y up and Z depth) 回答1: A quaternion has 4 components, which can be related to an angle θ and an axis vector n . The rotation will make the object rotate about the axis n by an angle θ. For

Getting angle back from a sin/cos conversion

浪子不回头ぞ 提交于 2019-12-21 06:58:17
问题 I want to reverse a sin / cos operation to get back an angle, but I can't figure out what I should be doing. I have used sin and cos on an angle in radians to get the x/y vector as such: double angle = 90.0 * M_PI / 180.0; // 90 deg. to rad. double s_x = cos( angle ); double s_y = sin( angle ); Given s_x and s_y , is it possible to get back the angle? I thought atan2 was the function to use, but I'm not getting the expected results. 回答1: atan2(s_y, s_x) should give you the correct angle.

3D skew transformation matrix along one coordinate axis

…衆ロ難τιáo~ 提交于 2019-12-20 14:32:31
问题 Is there a way to calculate the skew transformation matrix along one coordinate axis, given the skew angle, as follows 回答1: This should work for the most part for skewing an object with a transformation matrix, in particular using glMultMatrix(matrix) matrix1[] = { 1, 0, 0, 0, tan(a), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; matrix2[] = { 1, 0, 0, 0, 0, 1, 0, 0, tan(a), 0, 1, 0, 0, 0, 0, 1 }; matrix3[] = { 1, tan(a), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; matrix4[] = { 1, 0, 0, 0, 0, 1, 0, 0,

3D skew transformation matrix along one coordinate axis

一笑奈何 提交于 2019-12-20 14:32:09
问题 Is there a way to calculate the skew transformation matrix along one coordinate axis, given the skew angle, as follows 回答1: This should work for the most part for skewing an object with a transformation matrix, in particular using glMultMatrix(matrix) matrix1[] = { 1, 0, 0, 0, tan(a), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; matrix2[] = { 1, 0, 0, 0, 0, 1, 0, 0, tan(a), 0, 1, 0, 0, 0, 0, 1 }; matrix3[] = { 1, tan(a), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; matrix4[] = { 1, 0, 0, 0, 0, 1, 0, 0,

Sorting list of two-dimensional coordinates by clockwise angle using Python?

依然范特西╮ 提交于 2019-12-20 10:27:57
问题 I have a set of points with x and y coordinates that can be seen in the figure below. The coordinates of the 9 points were stored in a list as follows: L = [[5,2], [4,1], [3.5,1], [1,2], [2,1], [3,1], [3,3], [4,3] , [2,3]] The idea is to sort the points clockwise from an origin. In this case, the origin is the point that is colored and that has an arrow that indicates the direction of the ordering. Do not worry about creating methodology to determine the origin because it is already solved.

Normalise orientation between 0 and 360

佐手、 提交于 2019-12-20 08:38:50
问题 I'm working on a simple rotate routine which normalizes an objects rotation between 0 and 360 degrees. My C# code seems to be working but I'm not entirely happy with it. Can anyone improve on the code below making it a bit more robust? public void Rotate(int degrees) { this.orientation += degrees; if (this.orientation < 0) { while (this.orientation < 0) { this.orientation += 360; } } else if (this.orientation >= 360) { while (this.orientation >= 360) { this.orientation -= 360; } } } 回答1: Use

Incorrect conversion from quaternions to euler angles and back

a 夏天 提交于 2019-12-19 21:32:27
问题 I am converting angles-axis representation to Euler angles. I decided to check and make sure that the Euler angles I got from the conversion would lead back to the original axis-angle. I print out the values, but they do not match! I have read http://forum.onlineconversion.com/showthread.php?t=5408 and http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles as well as similar conversion questions on this website. In the code below I start with angle 'angle' and axis (rx

How to determine whether V3 is between V1 and V2 when we go from V1 to V2 counterclockwise?

有些话、适合烂在心里 提交于 2019-12-19 07:21:56
问题 I have three vectors V1, V2, and V3. Their origin points are on the axes' origin. How could I determine whether V3 is between V1 and V2 when I move around counterclockwise from V1 to V2? alt text http://www.freeimagehosting.net/uploads/1448ea8896.jpg It can't be done with obtaining their angles and evaluating these kind of conditions (pseudo-code): if angle(V3) > angle(V1) && angle(V3) < angle(V2) printf("V3 is between V1 and V2") else printf("out of the interval") To see its defect, suppose

How to determine whether V3 is between V1 and V2 when we go from V1 to V2 counterclockwise?

╄→гoц情女王★ 提交于 2019-12-19 07:21:32
问题 I have three vectors V1, V2, and V3. Their origin points are on the axes' origin. How could I determine whether V3 is between V1 and V2 when I move around counterclockwise from V1 to V2? alt text http://www.freeimagehosting.net/uploads/1448ea8896.jpg It can't be done with obtaining their angles and evaluating these kind of conditions (pseudo-code): if angle(V3) > angle(V1) && angle(V3) < angle(V2) printf("V3 is between V1 and V2") else printf("out of the interval") To see its defect, suppose