# rotation of a local vector

This topic is 2991 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

trying to work this out if you have a box , that has 4 corners at vectors -2,5 2,5 -2,5 2,-5 these positions are local to the center of the box/model. if the box/model is rotated , by a number i can get the matrices of the rotation ect , but how do i calculate the 4 corners relitilve to the world?

##### Share on other sites
Your corner points are in local coordinates relative to the box center? Then apply the rotation matrix to the four corner points and add the box's world position to the four points.

##### Share on other sites
Quote:
 Original post by WaterwalkerYour corner points are in local coordinates relative to the box center? Then apply the rotation matrix to the four corner points and add the box's world position to the four points.

i kind of understand that , could you point me to the correct tutorail for this please, or overview please

##### Share on other sites
The center of your box is at
$\left[\begin{array}{c}cx\\ cy\end{array}\right]$

The local coordinate of one of the corners is
$\left[\begin{array}{c}x\\ y\end{array}\right]$

The world coordinate of this corner is
$\left[\begin{array}{c}cx + x\\ cy + y\end{array}\right]$

To rotate the corner around the center of the box, apply the rotation matrix to the local coordinates

$\left[\begin{array}{c}x' \\ y'\end{array}\right] = \left[ \begin{array}{cc} cos(\theta ) & -sin(\theta ) \\ sin(\theta ) & cos(\theta )\end{array} \right]\left[\begin{array}{c}x \\ y\end{array}\right]$

The new world space coordinate is
$\left[\begin{array}{c}cx + x'\\ cy + y'\end{array}\right]$

##### Share on other sites
Quote:
 Original post by Eric_BrownThe center of your box is at $\left[\begin{array}{c}cx\\ cy\end{array}\right]$The local coordinate of one of the corners is $\left[\begin{array}{c}x\\ y\end{array}\right]$The world coordinate of this corner is $\left[\begin{array}{c}cx + x\\ cy + y\end{array}\right]$To rotate the corner around the center of the box, apply the rotation matrix to the local coordinates$\left[\begin{array}{c}x' \\ y'\end{array}\right] = \left[ \begin{array}{cc} cos(\theta ) & -sin(\theta ) \\ sin(\theta ) & cos(\theta )\end{array} \right]\left[\begin{array}{c}x \\ y\end{array}\right]$The new world space coordinate is $\left[\begin{array}{c}cx + x'\\ cy + y'\end{array}\right]$

Thank you , this i understand perfectly :) cheers

• 16
• 9
• 13
• 41
• 15