84 lines
1.4 KiB
C
84 lines
1.4 KiB
C
/*
|
|
* vector.h
|
|
*
|
|
* Created on: Mar 4, 2021
|
|
* Author: zemon
|
|
*/
|
|
|
|
#ifndef VECTOR_H_
|
|
#define VECTOR_H_
|
|
|
|
#include "stdint.h"
|
|
|
|
typedef struct {
|
|
double x;
|
|
double y;
|
|
} vector2double;
|
|
|
|
typedef struct {
|
|
float x;
|
|
float y;
|
|
} vector2;
|
|
|
|
typedef struct {
|
|
uint16_t x;
|
|
uint16_t y;
|
|
uint16_t z;
|
|
} vector3uint16;
|
|
|
|
typedef struct {
|
|
int16_t x;
|
|
int16_t y;
|
|
int16_t z;
|
|
} vector3int16;
|
|
|
|
typedef struct {
|
|
int32_t x;
|
|
int32_t y;
|
|
int32_t z;
|
|
} vector3int32;
|
|
|
|
typedef struct {
|
|
float x;
|
|
float y;
|
|
float z;
|
|
} vector3;
|
|
|
|
vector3 vector3Add(vector3 one, vector3 two);
|
|
|
|
vector3 vector3Less(vector3 one, vector3 two);
|
|
|
|
vector3 vector3DivNum(vector3 vec, float num);
|
|
|
|
vector3 vector3MultiplyNum(vector3 vec, float num);
|
|
|
|
float vector3Sum(vector3 vec);
|
|
|
|
float vector3DotProduct(vector3 first, vector3 second);
|
|
|
|
float vector3LenSquare(vector3 vec);
|
|
|
|
float vector3Len(vector3 vec);
|
|
|
|
vector3 vector3AbsVector(vector3 one);
|
|
|
|
float vector3AngleCos(vector3 first, vector3 second);
|
|
|
|
///!!!! VERY EXPENSIVE calculation
|
|
float vector3Angle(vector3 first, vector3 second);
|
|
|
|
vector3 vector3Projection(vector3 one, vector3 two);
|
|
|
|
|
|
vector3int32 vector3Int32Less(vector3int32 one, vector3int32 two);
|
|
|
|
vector3int32 vector3Int32Add(vector3int32 one, vector3int32 two);
|
|
|
|
vector3int32 vector3Int32Div(vector3int32 vector, int32_t divider);
|
|
|
|
vector3int16 vector3Int32toInt16(vector3int32 vector);
|
|
|
|
vector3int32 vector3int32Abs(vector3int32 one);
|
|
|
|
#endif /* VECTOR_H_ */
|