Loading...
Searching...
No Matches
vector2.c
Go to the documentation of this file.
#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));
if(length == 0){
return;
}
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));
}
ARC_Vector2
Definition vector2.h:8
ARC_Vector2::x
float x
Definition vector2.h:9
ARC_Vector2::y
float y
Definition vector2.h:9
ARC_Vector2_RotateDegree
void ARC_Vector2_RotateDegree(ARC_Vector2 *vector, float angle)
rotates a given ARC_Vector2 by a given angle in degrees
Definition vector2.c:14
ARC_Vector2_Normalize
void ARC_Vector2_Normalize(ARC_Vector2 *vector)
normalizes a given ARC_Vector2
Definition vector2.c:4
vector2.h