14 lines
No EOL
452 B
C
14 lines
No EOL
452 B
C
#include "arc/math/vector2.h"
|
|
#include <math.h>
|
|
|
|
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));
|
|
} |