<br><br><div class="gmail_quote">On Wed, Jun 10, 2009 at 12:21 AM, bruno Piguet <span dir="ltr"><<a href="mailto:bruno.piguet@gmail.com">bruno.piguet@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<span></span><div class="gmail_quote">2009/6/9 Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span><div class="im"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Well, in this case you can use complex multiplication and either work with just the x,y components or use two complex components, i.e., [x + 1j*y, z]. In the first case you can then do the rotation as V*exp(1j*phi).</blockquote>
</div><div><br>In the real case, it's a real 3-axes rotation, where M = dot (M1(psi), dot (M2(theta), M3(phi))). The decomposition in 2D-rotations and the use of complex operation is possible, but the matrix notation is more concise.<br>
<br></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> If you want more general rotations, a ufunc for quaternions would do the trick.<br>
</blockquote></div></div><span><span><br>You mean something like Christoph Gohlke's "transformations.py" program ?<br></span></span></blockquote><div><br>I don't know. But I think generating the rotation matrices is likely to be the bottleneck and I'm not sure how you want to specify them. After you have the stack of rotation matrices there are at least three ways to multiply them with stacks of vectors: in a python loop, using newaxis and a sum, or possibly a generalized ufunc. I'm not sure about the latter but I think there is an example that does that.<br>
<br>Chuck <br></div><br></div><br>