How to find the rotation direction(TRotateImage)

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

How to find the rotation direction(TRotateImage)

Postby Donnie » September 10th, 2006, 1:25 pm

I am using the RotateImage Component for my program. It is useful and powerful component for dealing with a picture. But a problem occured in these days. I don't know how to find the status of the rotation (CW or CCW) when the picture is operated. Can you give me some advice about it?
Donnie
Member
Member
 
Posts: 2
Joined: September 10th, 2006, 1:22 pm

Postby Kambiz » September 11th, 2006, 9:51 am

Increasing angle, rotates the image in CCW.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Donnie » September 11th, 2006, 10:19 am

I think it is difficult to know the direction if you just compare the original angle to the new angle (refer to below programe). You know the minus and plus value will be occured. Maybe, I don't understand your meaning very well. Could you explain it in detail for me. Thanks a lot.

if Dragging then
begin
if X = RotateImage1.Width / 2 then
if Y < RotateImage1.Height / 2 then
Theta := Pi / 2
else
Theta := -Pi / 2
else
Theta := ArcTan2(Y - RotateImage1.Height / 2, X - RotateImage1.Width / 2);
Angle := StartAngle + 180 * (StartTheta - Theta) / Pi;
TrackBar1.Position := Trunc(Angle * 10) mod 3600;
TrackBar1Change(Self);
end;
Donnie
Member
Member
 
Posts: 2
Joined: September 10th, 2006, 1:22 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 0 guests

cron