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
4
void
ARC_Vector2_Normalize
(
ARC_Vector2
*vector){
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
14
void
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
}
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
src
math
vector2.c