i was reading about gimbal lock.
it happens when there is as parent child kind of heirarchy in rotation axes. like if heirarchy is x-y-z then rotating x affects y and z, rotating y affects z only and not x, rotating z affects no other axes.
But how i was visualizing is when y rotates(middle axis), which is mostly shown to cause gimbal lock x and z should not align , but what if they stay 90 degree apart and basically all rotations dont affect mutual orthogonality of the axes?
What is the name of second kind of rotation if it is there?
Related
A quaternion rotation defines a point in 3d-space and rotation around the axis of that point.
I am trying to understand why quaternion rotation requires a vector and rotation, why not just a 3d point in space and rotation ?
eg : In the following picture a hand points to a point in 3d-space which can be rotated around its axis.
http://s29.postimg.org/ih79tirnr/quarternion.jpg
Thanks
Actually, the x, y and z components of a quaternion define a vector pointing in the direction of the axis of rotation. The w component defines the amount of the rotation along that axis. So, the x, y and z don't actually signify a point at all. As the amount of rotation changes, the length of the x, y, z vector will change but the vector always points in the same direction. It doesn't make sense, therefore, to consider this to be a point in space. It's merely a direction and a rotation around that axis.
I once defined a new class that included a quaternion to define the transformation of an object along with a vector to describe the translation of the object. The object could then represent a complete transformation in 3D space similar to a 3x4 transformation matrix.
I have the co-ordinates of a line. They are in the form x, y. I need to find the angle this line makes with the x axis. Both the points can be edited by the user in my application, hence I cannot hold one as the center of rotation. I have tried this:
theta = tan-inv((y2 - y1)/(x2 - x1))
I consider the right point as x2, y2 and the left point as x1, y1 always. But I'm not getting the right value. Also, I need to convert the value returned in such a way that I can apply it on the canvas (between 0 - 360).
Note: I convert the values to degrees/radians whenever and wherever it is required.
I have attached an image that should explain what I'm trying in more detail.
This expression
(y2 - y1/x2 - x1)
is bracketed incorrectly, it should be
((y2 - y1)/(x2 - x1))
If you now explain that what you have posted is not really your code I will downvote this question for wasting my time. I could also do with some reassurance that you understand the difference between radians and degrees and the different conventions that mathematicians and navigators use for indicating angles around a circle.
After a 3d point has been transformed by a perspective projection matrix, what do the Z coordinate stand for? Distance from the 'eye'? Distance from the near clip plane? None of this?
Edit
I've set up a matrix using the glFustrum definition found here.
Then, I transform a 3D point with that matrix.
I'm left with a 3D point where X and Y are the coordinates of the point on the near frustum face, and Z, supposedly a depth information that I have a hard time exploiting.
Thanks!
The transformed z (that you use as denominator for dividing x and y) is the distance from the eye in the perpendicular direction to the projection plane, scaled so that the projection plane is at distance 1.
It's been a while for me, but if you have the X and Y coordinates on the frustrum, does not the Z control the layer order?
Let's say we have a parametric curve, for example a circle:
x = r * cos(t)
y = r * sin(t)
We want to plot the curve on the screen in a way that:
every pixel is painted just once (the optimal part)
there is a painted pixel for each (x, y) that lies on the curve (the continuous part)
If we just plot (x, y) for each t in [t1, t2], these conditions will not be met.
I am searching for a general solution for any parametric curve.
A general solution that 100% satisfies your criteria does not exist.
So we have to compromize.
Usually this is tackled by starting with a stepsize (usually a parameter to your routine), this stepsize can be subdivided triggered by a heuristic e.g.:
subdivide when the distance covered by a segment is larger than a given distance (e.g. one pixel)
subdivide when the curve direction changes too much
Or a combination of these.
Usually some limit to subdivision is also given to avoid taking forever.
Many systems that offer parametric plotting start with some changeable default setting for the heuristic params and step size. The user can adapt these if the curve is not "nice" enough or if it takes too long.
The problem is that there are always pathological curves that will defeat your method of drawing making it miss details or taking overly long.
Check out Bézier splines.
I would like to rotate a plane, not around a single (X or Y) axis, but around the diagonal (45 degrees between X and Y). How do I calculate the Rx and Ry given the Rdiagonal?
(Rdiagonal is the amount of rotation I would like to achieve around the diagonal axis).
To clarify: just take a yellow PostIt and draw cross on it (a horizonal and a vertical line). These are the X and Y axes. Rotating around these axes is easy (assuming you can just specify Rx and Ry). But I would like to rotate around the diagonal axis. What are the Rx and Ry in that case?
I think it's something like Rx = Rdiagonal / sqrt(2). But I'm not sure.
This is probably more of a mathoverflow question, but I found some information here about rotation around an arbitrary axis. It provides the derivation for the translation and rotation matrices.
Your plane will most certainly given by some points (depending on the dimensionality). You can then use a rotation matrix to transform these points: new = R * old. Afterwards, construct your plane from these points.
To get the right rotation matrix, see the entry at wikipedia.