added rotation to vector2
This commit is contained in:
parent
edaddeb109
commit
0d9cf0f7f5
2 changed files with 19 additions and 0 deletions
|
|
@ -5,4 +5,10 @@ void ARC_Vector2_Normalize(ARC_Vector2 *vector){
|
|||
float length = sqrtf((vector->x * vector->x) + (vector->y * vector->y));
|
||||
vector->x /= length;
|
||||
vector->y /= length;
|
||||
}
|
||||
|
||||
void ARC_Vector2_RotateDegree(ARC_Vector2 *vector, float angle){
|
||||
ARC_Vector2 temp = *vector;
|
||||
vector->x = (temp.x * cos(angle)) - (temp.y * sin(angle));
|
||||
vector->y = (temp.x * sin(angle)) + (temp.y * cos(angle));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue