Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
vectorFl2d.h
Go to the documentation of this file.
1
28#ifndef _VECTOR_FL_2D_H_
29#define _VECTOR_FL_2D_H_
30
31#include <stdint.h>
32
36typedef struct
37{
38 float x;
39 float y;
40} vecFl_t;
41
44vecFl_t mulVecFl2d(vecFl_t vector, float scalar);
45vecFl_t divVecFl2d(vecFl_t vector, float scalar);
46
47float dotVecFl2d(vecFl_t left, vecFl_t right);
48vecFl_t rotateVecFl2d(vecFl_t vector, float radians);
49float magVecFl2d(vecFl_t vector);
50float sqMagVecFl2d(vecFl_t vector);
53
54#endif
float sqMagVecFl2d(vecFl_t vector)
Return the squared magnitude of the given vector. The square root is not used because it is slow.
Definition vectorFl2d.c:107
vecFl_t addVecFl2d(vecFl_t left, vecFl_t right)
Add two vectors and return the resulting vector.
Definition vectorFl2d.c:11
vecFl_t divVecFl2d(vecFl_t vector, float scalar)
Divide a vector by a scalar and return the result.
Definition vectorFl2d.c:59
float magVecFl2d(vecFl_t vector)
Compute the magnitude of a vector.
Definition vectorFl2d.c:118
float dotVecFl2d(vecFl_t left, vecFl_t right)
Find the dot product of two vectors.
Definition vectorFl2d.c:75
vecFl_t mulVecFl2d(vecFl_t vector, float scalar)
Multiply a vector by a scalar and return the result.
Definition vectorFl2d.c:43
vecFl_t subVecFl2d(vecFl_t left, vecFl_t right)
Subtract two vectors and return the resulting vector.
Definition vectorFl2d.c:27
float y
The signed integer Y component of the vector.
Definition vectorFl2d.h:39
vecFl_t perpendicularVecFl2d(vecFl_t in)
Return a vector perpendicular to the input.
Definition vectorFl2d.c:145
float x
The signed integer X component of the vector.
Definition vectorFl2d.h:38
vecFl_t normVecFl2d(vecFl_t in)
Normalize and return a vector.
Definition vectorFl2d.c:129
vecFl_t rotateVecFl2d(vecFl_t vector, float radians)
Rotate a vector by a number of degrees and return the result.
Definition vectorFl2d.c:87
A 2D vector with signed integer X and Y components.
Definition vectorFl2d.h:37