Swadge ESP32-S2
APIs to develop for the Magfest Swadge
Toggle main menu visibility
Loading...
Searching...
No Matches
vector2d.h
Go to the documentation of this file.
1
27
28
#ifndef _VECTOR_2D_H_
29
#define _VECTOR_2D_H_
30
31
#include <stdint.h>
32
36
typedef
struct
37
{
38
int32_t
x
;
39
int32_t
y
;
40
}
vec_t
;
41
42
vec_t
addVec2d
(
vec_t
left,
vec_t
right);
43
vec_t
subVec2d
(
vec_t
left,
vec_t
right);
44
vec_t
mulVec2d
(
vec_t
vector, int32_t scalar);
45
vec_t
divVec2d
(
vec_t
vector, int32_t scalar);
46
47
int32_t
dotVec2d
(
vec_t
left,
vec_t
right);
48
vec_t
rotateVec2d
(
vec_t
vector, int32_t degree);
49
int32_t
sqMagVec2d
(
vec_t
vector);
50
51
#endif
dotVec2d
int32_t dotVec2d(vec_t left, vec_t right)
Find the dot product of two vectors.
Definition
vector2d.c:75
divVec2d
vec_t divVec2d(vec_t vector, int32_t scalar)
Divide a vector by a scalar and return the result.
Definition
vector2d.c:59
subVec2d
vec_t subVec2d(vec_t left, vec_t right)
Subtract two vectors and return the resulting vector.
Definition
vector2d.c:27
mulVec2d
vec_t mulVec2d(vec_t vector, int32_t scalar)
Multiply a vector by a scalar and return the result.
Definition
vector2d.c:43
sqMagVec2d
int32_t sqMagVec2d(vec_t vector)
Return the squared magnitude of the given vector. The square root is not used because it is slow.
Definition
vector2d.c:116
rotateVec2d
vec_t rotateVec2d(vec_t vector, int32_t degree)
Rotate a vector by a number of degrees and return the result.
Definition
vector2d.c:87
addVec2d
vec_t addVec2d(vec_t left, vec_t right)
Add two vectors and return the resulting vector.
Definition
vector2d.c:11
vec_t::y
int32_t y
The signed integer Y component of the vector.
Definition
vector2d.h:39
vec_t::x
int32_t x
The signed integer X component of the vector.
Definition
vector2d.h:38
vec_t
A 2D vector with signed integer X and Y components.
Definition
vector2d.h:37
main
utils
math
vector2d.h
Generated by
1.17.0