|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have an application (an engineering question at work!) where I have to
create a simulation based on rotation of vectors. The only problem is that
it's a specifically defined Euler system where each subsequent rotation is
done on the "local", not the "universal" axis of the cube.
My head keeps exploding when I try to grasp how to do this in povray.
Any tips (especially references with visual clues)? thanks in advance.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"gregjohn" <pte### [at] yahoocom> wrote in message
news:web.44d8fc1ca05d1ece40d56c170@news.povray.org...
>I have an application (an engineering question at work!) where I have to
> create a simulation based on rotation of vectors. The only problem is
> that
> it's a specifically defined Euler system where each subsequent rotation is
> done on the "local", not the "universal" axis of the cube.
>
> My head keeps exploding when I try to grasp how to do this in povray.
>
> Any tips (especially references with visual clues)? thanks in advance.
>
>
Hi Greg,
Sorry if I've misunderstood the question, but can't you just apply the
rotations in the reverse sequence?
So, if you're doing an animation where you first rotate around y by 70
degrees then round z by 20 degrees relative to the new position of the
object, and you're doing the frame that's half way through the second
rotation you would rotate first by 10 degrees around z, then by 70 degrees
around y, all with respect to the universal axes.
Regards,
Chris.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
gregjohn <pte### [at] yahoocom> wrote:
> I have an application (an engineering question at work!) where I have to
> create a simulation based on rotation of vectors. The only problem is that
> it's a specifically defined Euler system where each subsequent rotation is
> done on the "local", not the "universal" axis of the cube.
If you want to rotate an object around the point 'Point', it's easy:
translate -Point
rotate <whatever>
translate Point
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Chris B wrote:
> Sorry if I've misunderstood the question, but can't you just apply the
> rotations in the reverse sequence?
>
> So, if you're doing an animation where you first rotate around y by 70
> degrees then round z by 20 degrees relative to the new position of the
> object, and you're doing the frame that's half way through the second
> rotation you would rotate first by 10 degrees around z, then by 70
> degrees around y, all with respect to the universal axes.
Yes, this should work.
Greg, you can try to imagine what happens. If someone wants to know more
about that: This has to do with linear algebra. rotate and scale are
linear transformations. (Translate is not a linear transformation. The
trick is to use 4 dimensions where the 3-dimensional translate is also
linear.) All linear transformations can be described by matrices. If
you do two transformations after each other, they together are again a
linear transformation. You can get the matrix of this transformation by
simply multiplying the matrices of the other transformations. By
multiplying matrices, the order is important!
In OpenGL (I do not know about DirectX) the multiplication order is the
other way round as in POV-Ray. POV-Ray also has a matrix-transformation
keyword which you can use to do any linear transformation you want.
Happy transformation!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Um, this is probably over my head, but I think that most of the advice here
is based on a question of how to do multiple povray-style, rotations off
the universal axis. I'm trying to implement the Euler rotations using the
convention of Bunge.
What I need to do is to take a cube centered on the origin and rotate it
first around the z axis. (No prob: universal and local are the same).
Then rotate the cube not about the x axis, not of the universal axis but its
own new local axis.
Then another rotation about the local z axis.
I can do this with my fingers no prob, but trying to get pov to do it makes
my head hurt.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I figured it out. I use can use vaxis_rotate to rotate about any arbitrary
axis. That'll get me there.
gregjohn wrote:
> I have an application (an engineering question at work!) where I have to
> create a simulation based on rotation of vectors. The only problem is
> that it's a specifically defined Euler system where each subsequent
> rotation is done on the "local", not the "universal" axis of the cube.
>
> My head keeps exploding when I try to grasp how to do this in povray.
>
> Any tips (especially references with visual clues)? thanks in advance.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
gregjohn wrote:
> Um, this is probably over my head, but I think that most of the advice
> here is based on a question of how to do multiple povray-style,
> rotations off
> the universal axis. I'm trying to implement the Euler rotations
> using the convention of Bunge.
> [...]
I'll post an example in p.b.i.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> ... I'm trying to implement the Euler rotations
>> using the convention of Bunge.
I think this is right, had to look up Euler angles...
// Euler Angles in Bunge convention
#macro EulerRotate(A)
#local xvector = vaxis_rotate(x,y,-A.x);
#local yvector = vaxis_rotate(y,xvector,A.y);
#local vX1 = vaxis_rotate(x,xvector,A.y);
#local vY1 = vaxis_rotate(y,xvector,A.y);
#local vZ1 = vaxis_rotate(z,xvector,A.y);
#local vX2 = vaxis_rotate(x,yvector,-A.z);
#local vY2 = vaxis_rotate(y,yvector,-A.z);
#local vZ2 = vaxis_rotate(z,yvector,-A.z);
transform {
rotate <0,-A.x,0>
matrix < vX1.x, vX1.y, vX1.z,
vY1.x, vY1.y, vY1.z,
vZ1.x, vZ1.y, vZ1.z, 0,0,0 >
matrix < vX2.x, vX2.y, vX2.z,
vY2.x, vY2.y, vY2.z,
vZ2.x, vZ2.y, vZ2.z, 0,0,0 >
}
#end
box{-0.5,0.5
pigment{checker color z color y scale 0.1}
EulerRotate(<15, 30 , 15>)
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I came across this (very) old thread but eventually had to write my own
version of the rotation matrix. It follows the conventions from
http://mathworld.wolfram.com/EulerAngles.html and rotates by the angles
phi,theta,psi,
#macro Euler(A)
#local xp = vaxis_rotate(x,z,-A.x);
#local yp = vaxis_rotate(y,z, A.x);
#local ys = vaxis_rotate(yp,xp,A.y);
#local zs = vaxis_rotate(z,xp,A.y);
#local xt = vaxis_rotate(xp,zs,A.z);
#local yt = vaxis_rotate(ys,zs,A.z);
#local cosphi = vdot(xp,x);
#local sinphi = vdot(vcross(xp,x), z);
#local costheta = vdot(zs,z);
#local sintheta= vdot(vcross(zs,z), xp);
#local cospsi = vdot(xt,xp);
#local sinpsi = vdot(vcross(xt,xp), zs);
transform {
matrix < cospsi, sinpsi, 0,
-sinpsi, cospsi, 0,
0, 0, 1, 0,0,0 >
matrix < 1, 0, 0,
0, costheta, sintheta,
0, -sintheta, costheta, 0,0,0 >
matrix < cosphi, sinphi, 0,
-sinphi, cosphi, 0,
0, 0, 1, 0,0,0 >
}
#end
The three matrices could be combined into one, but it seems clearer that way.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|