I would love to solve this problem. Using matrixes is not easy, I have read

that you move the points to the origin, rotate the points then move them

back to their offsets. Is it possible using matrixes?(3 matrix operations).

I would like the point of rotaion to be changeable. This effect is similar

to illustrator or photoshop where you select an object and can rotate the

bounding box by handles.

> I would love to solve this problem. Using matrixes is not easy, I have read

> that you move the points to the origin, rotate the points then move them

> back to their offsets. Is it possible using matrixes?(3 matrix operations).

special type of matrix most non-CG people aren't used to: a 4x4 matrix

operating on 'homegeneous' coordinates (x,y,z,1). This is standard

craftsmanship in computer graphics. You may want to get yourself a

textbook to learn how to use it.

--

Even if all the snow were burnt, ashes would remain.

> I would love to solve this problem. Using matrixes is not easy, I have read

> that you move the points to the origin, rotate the points then move them

> back to their offsets. Is it possible using matrixes?(3 matrix operations).

> I would like the point of rotaion to be changeable. This effect is similar

> to illustrator or photoshop where you select an object and can rotate the

> bounding box by handles.

box maps on to, then a 2x2 rotation matrix like this will work:

R = [Xx Xy]

[Yx Yy]

So when X = [0 1] and Y = [-1 0] a point P at (7,3) would become

[7 3] (mtx mult) [ 0 1] = [7*0 + 3*-1 7*1 + 3*0] = [-3 7]

[-1 0]

To rotate about an arbitrary point, you could subtractt he point from

each vertex's position, rotate the point and add the rotation point

back. There is a faster way, though.

Fatten your vertices to the form [x y 1]. Fatten your matrix like this:

[Xx Xy 0]

[Yx Yy 0]

[Tx Ty 1]

Tx and Ty form the translation vector (T = [Tx Ty]). The translation

will be done after the rotation.

To make a composite matrix that rotates about a point A, multiply

together the one for translating from A and the one that both rotates

and translates to A.

[ 1 0 0 ] [Xx Xy 0]

M = [ 0 1 0 ] X [Yx Yy 0]

[-Ax -Ay 1 ] [Ax Ay 1]

[ Xx Xy 0 ]

= [ Yx Yy 0 ]

[ Tx Ty 1 ]

You'll notice that the rotation part of the transformation is the same

and still rotates about the origin, but Tx and Ty will form the

necessary translation to make the rotation appear as if it happened

about point A.

You might think it wasteful to transform every vertex like this:

P = [x y 1]

P' = PM

[ Xx Xy 0 ]

= [x y 1] X [ Yx Yy 0 ]

[ Tx Ty 1 ]

= [x' y' 1]

(appending the '1's and removing them at the end just to be able to use

a 3x3 matrix)

But what you really do is just steal the Tx and Ty from the matrix and

use the simple 2x2 rotation matrix discussed earlier.

P = [x y]

P' = PR + T

= [x y] X [Xx Xy] + [Tx Ty]

[Yx Yy]

= [x' y']

BTW. You'll notice I'm using 'row vectors' and 'postmultiplication'.

Most people use instead, 'column vectors' and 'premultiplcation'. To

swap between the two systems, make every row a column and every column a

row ('transposing') and reverse the left-right order of matrices and

vectors being multiplied.

Cheers.

Blancmange

I could send you all the necessary asm functions if you really want

them....

Thag

1. Rotating a point around an arbitrary line in 3D

I'm sure someone out there must know this. I asked on another group, but

didn't get a reply, so I am hoping this group is read more.

All I want to do, is rotate a point around an arbitrary line in 3D. ie..

given <x,y,z> for the point and <x,y,z> for the endpoints of the line, how

can I rotate the point around the line X degrees? I know how to rotate

around the axes, but not how to do it around an arbitrary line in space.

Thanks for any help you can give me...

David Doucette

2. Wich server for 4-color work ?

3. Rotate around arbitrary point?

4. Amiga --> PC

5. Rotating an object around an arbitrary fixed point

7. Rotating Points (in 2d) around center?

8. OT the kennel sent me this a minute ago

9. Rotating Around An Arbitrary Axis

10. Rotating vectors around arbitrary axes

11. Rotating a point around another point(silly me)

12. Rotating around arbitrary axis

13. Rotating vectors around arbitrary axes

4 post • Page:**1** of **1**