Jump to content

Rotation matrix pivot point


kiryha

Recommended Posts

The rotation of each point occurs around the origin:

matrix3 matrx = ident();
vector axis = {1, 0, 0};
float angle = 256;

rotate ( matrx, angle, axis); 
@P *= matrx; 

How to define coordinates for rotation different from the origin?

Link to comment
Share on other sites

I found the answer:

matrix3 matrx = ident();
vector axis = {1, 0, 0};
float angle = 256;

rotate ( matrx, angle, axis);

vector pivot = {0, 0.8, 0};
@P = (@P - pivot) * matrx + pivot;

 But I can`t understand how it`s working, why this line `(@P - pivot) * matrx + pivot` puts pivot of rotation to a required point?

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...