[vtkusers] getting the angle of rotation

Moreland, Kenneth kmorel at sandia.gov
Tue Sep 5 15:25:20 EDT 2006


You may also be interested in the POSIX compliant function atan2(y,x)
that gives the angle in the full -pi to pi range and handles the case of
x=0 correctly.

-Ken

> -----Original Message-----
> From: vtkusers-bounces+kmorel=sandia.gov at vtk.org [mailto:vtkusers-
> bounces+kmorel=sandia.gov at vtk.org] On Behalf Of Thomas Lambertz
> Sent: Monday, September 04, 2006 4:08 PM
> To: vtkusers
> Subject: Re: [vtkusers] getting the angle of rotation
> 
> Hi Anja,
> 
> i am not sure wether it is what you searched for...
> 
> tan (alpha) =  (y2-y1) / (x2-x1)
> 
> in case of y1=x1=0 its simple tan (alpha) = y/x
> 
> If the center isnt 0/0 then
> alpha = atan ( (Y-Ycenter) / (X-Xcenter) );
> You should be aware of X-Xcenter == 0
> 
> Hope thats what your looking for,
> Tom
> 
> 
> Anja Ende schrieb:
> > Hi everyone,
> >
> > I have a problem that I wonder if someone can help me with.
> >
> > I have an image and when I press the left button and drag the mouse,
I
> > want to calculate the angle that the subsequent mouse positions
> > describe from the center of the image. So, given x1, y1 and x2, y2,
> > can someone tell me how I can calculate the angle between them...
> >
> > Thanks and cheers,
> >
> > Anja
> >
------------------------------------------------------------------------
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list