Community
DWF
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rotate image 90 degree

1 REPLY 1
Reply
Message 1 of 2
Anonymous
1710 Views, 1 Reply

Rotate image 90 degree

Using the DWF toolkit,  I want to rotate the image 90 degreee ,using

double anTransform[4][4] = {0, 0.0423, 0, 0,
-0.0423, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };

the result is that the image is rotated, but the insert point is in the center of the page, if using 

double anTransform[4][4] = { 0.0423, 0, 0, 0,
 0, 0.0423, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };

the image is insert in the left bottom of the page 

I think the image is only rotate, the insert point should be the same? any wrong  in my opinion?

Tags (1)
1 REPLY 1
Message 2 of 2
zobb011111
in reply to: Anonymous

Your understanding is partially correct, but there's a bit more to it when it comes to transformation matrices and their effect on the positioning of an image. Let's break down the two transformation matrices you provided and explain their effects:

1. **Matrix for 90-degree rotation around the center of the page:**

```cpp
double anTransform[4][4] = {
0, 0.0423, 0, 0,
-0.0423, 0, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
```

This matrix rotates the image 90 degrees counterclockwise. However, the transformation also affects the positioning. The image's insertion point appears to be in the center of the page because the rotation is performed around the origin, which might be the center in your coordinate system.

2. Matrix for uniform scaling without rotation:

```cpp
double anTransform[4][4] = {
0.0423, 0, 0, 0,
0, 0.0423, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
```

This matrix scales the image uniformly by a factor of 0.0423 along both the x and y axes without any rotation. The insertion point is at the bottom-left corner because the scaling transformation does not alter the position relative to the origin.

### Solution to Preserve the Insertion Point

To rotate the image 90 degrees while keeping the insertion point the same, you need to combine the rotation with a translation transformation. Here's how you can do it:

1. Translate the image to the origin.
2. **Apply the rotation.
3. Translate the image back to the desired insertion point.

Suppose `(x0, y0)` is the insertion point, the combined transformation matrix would look like this:

```cpp
double anTransform[4][4] = {
0, 0.0423, 0, -y0*0.0423,
-0.0423, 0, 0, x0*0.0423,
0, 0, 1, 0,
0, 0, 0, 1
};
```

In this matrix:
- The rotation part is `0, 0.0423, -0.0423, 0`.
- The translation part is adjusted with `-y0*0.0423` and `x0*0.0423` to account for the rotation around the original insertion point.

Adjust `x0` and `y0` according to your specific insertion point coordinates.

By applying this combined transformation, the image should rotate 90 degrees around its insertion point while keeping that point fixed on the page.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report