Re: TrackBall Object. [message #16229] |
Tue, 13 July 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David Borland (dborland@egi.com) writes:
> Does the trackball object always rotate around the natural origin, or will
> it rotate around a user defined origin?
> What I am doing is I have the viewplane rectangle centered around the
> polygon, and the trackball set to [xdim/2.,ydim/2.],xdim/2.. So that it
> should be the entire view plane. The problem is that the polygon is
> rotating around something other than the center of the viewplane rectangle.
> Any hints on how to make this behave?
A couple of questions:
1. What coordinate system are you using in your viewplane
rectangle?
2. How are you scaling the polygon into that viewplane?
My guess is that the coordinate system you are using
for the viewplane rectangle and the coordinate system
you are using for the trackball do not align. For rotations,
it's nice to choose a coordinate system whose origin is
in the center of the display window. If your polygon is
displayed from the center of rotation, you must first
translate it to the center, rotate it, then translate
it back to where you want it. (Assuming, of course,
that you want to rotate the polygon about its center
of mass, if you like.)
Unfortunately, there are LOTS of things that can go
wrong here. It's hard to speculate without more
information.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: TrackBall Object. [message #16231 is a reply to message #16229] |
Tue, 13 July 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
David Borland (dborland@egi.com) writes:
> Does the trackball object always rotate around the natural origin, or will
> it rotate around a user defined origin?
> What I am doing is I have the viewplane rectangle centered around the
> polygon, and the trackball set to [xdim/2.,ydim/2.],xdim/2.. So that it
> should be the entire view plane. The problem is that the polygon is
> rotating around something other than the center of the viewplane rectangle.
> Any hints on how to make this behave?
A couple of questions:
1. What coordinate system are you using in your viewplane
rectangle?
2. How are you scaling the polygon into that viewplane?
My guess is that the coordinate system you are using
for the viewplane rectangle and the coordinate system
you are using for the trackball do not align. For rotations,
it's nice to choose a coordinate system whose origin is
in the center of the display window. If your polygon is
displayed from the center of rotation, you must first
translate it to the center, rotate it, then translate
it back to where you want it. (Assuming, of course,
that you want to rotate the polygon about its center
of mass, if you like.)
Unfortunately, there are LOTS of things that can go
wrong here. It's hard to speculate without more
information.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|