Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

How to rotate transformation matrix along with viewperspective?
Started by specialtouch at 05-29-2008 16:30. Topic has 1 replies.

Print Search « Previous Thread Next Thread »
  05-29-2008, 16:30
specialtouch is not online. Last active: 7/29/2008 3:41:42 PM specialtouch

Not Ranked
Joined on 04-01-2008
Posts 2
How to rotate transformation matrix along with viewperspective?
Reply Quote
How do I convert the transformation matrix of a RasterImageViewer after its image has had its view perspective rotated?

I have a situation where I am performing custom drawing of Regions on the surface of a RasterImageViewer. The Region is described in logical coordinates, so before drawing the Region in the OnPostImagePaint method, I transform its coordinates to physical using the RasterImageViewer's Transform property Matrix:

// Transform region coordinates from logical to physical
Matrix matrix = base.Transform;
region.Transform(matrix);

// Draw the region
DrawRegion(region);


The problem I am having is after I have applied a rotation to the image, the transformation matrix does not account for the change in rotation. The rotation applied is always a multiple of 90 and I am using the RotateViewPerspective method to apply the rotation. If I rotate the transformation matrix, I seem to get the correct region for 180 degree rotation, but not for 90 and 270 degree rotation:

// Transform region coordinates from logical to physical
Matrix matrix = base.Transform.Clone();
matrix.RotateAt(rotationApplied, new PointF((float)(base.Image.Width / 2.0), (float)(base.Image.Height / 2.0)));
region.Transform(matrix);


The +-90 degree rotations are always offset and I don't understand why. Does anyone know if there is some other step I am overlooking?

   Report 
  06-02-2008, 10:50
Adnan Ismail is not online. Last active: 9/4/2008 2:25:00 PM Adnan Ismail



Top 10 Posts
Joined on 07-31-2006
Posts 1,150
Re: How to rotate transformation matrix along with viewperspective?
Reply Quote
By communicating through support email it turned out that the cause of this issue was incorrect rotation origin.
Adnan Ismail
LEADTOOLS Technical Support

   Report 
Post
LEAD Support Fo... » Developer » Image Display » How to rotate transformation matrix along with viewperspective?

Powered by Community Server, by Telligent Systems