Archeus 0.0.0
A C library and game engine that focuses on documentation
Loading...
Searching...
No Matches
vector2.c
Go to the documentation of this file.
1#include "arc/math/vector2.h"
2#include <math.h>
3
5 float length = sqrtf((vector->x * vector->x) + (vector->y * vector->y));
6 if(length == 0){
7 return;
8 }
9
10 vector->x /= length;
11 vector->y /= length;
12}
13
14void ARC_Vector2_RotateDegree(ARC_Vector2 *vector, float angle){
15 ARC_Vector2 temp = *vector;
16 vector->x = (temp.x * cos(angle)) - (temp.y * sin(angle));
17 vector->y = (temp.x * sin(angle)) + (temp.y * cos(angle));
18}
float x
Definition vector2.h:9
float y
Definition vector2.h:9
void ARC_Vector2_RotateDegree(ARC_Vector2 *vector, float angle)
rotates a given ARC_Vector2 by a given angle in degrees
Definition vector2.c:14
void ARC_Vector2_Normalize(ARC_Vector2 *vector)
normalizes a given ARC_Vector2
Definition vector2.c:4