50 lines
1.2 KiB
C
50 lines
1.2 KiB
C
#pragma once
|
|
|
|
#ifndef VECTOR_H
|
|
#define VECTOR_H
|
|
|
|
|
|
typedef struct
|
|
{
|
|
float x, y;
|
|
} Vector2;
|
|
|
|
typedef struct
|
|
{
|
|
float x, y, z;
|
|
} Vector3;
|
|
|
|
Vector2 normalizeV2(const Vector2* v, float gain);
|
|
Vector3 normalizeV3(const Vector3* v, float gain);
|
|
|
|
Vector2 absV2(const Vector2* v);
|
|
Vector3 absV3(const Vector3* v);
|
|
|
|
float lengthV2(const Vector2* v);
|
|
float lengthV3(const Vector3* v);
|
|
|
|
float lengthSquaredV2(const Vector2* v);
|
|
float lengthSquaredV3(const Vector3* v);
|
|
|
|
Vector2 limitV2(const Vector2* v, float min, float max);
|
|
Vector3 limitV3(const Vector3* v, float min, float max);
|
|
|
|
Vector2 powerV2(const Vector2* v, float pow);
|
|
Vector3 powerV3(const Vector3* v, float pow);
|
|
|
|
Vector2 sumV2(const Vector2* v1, const Vector2* v2);
|
|
Vector3 sumV3(const Vector3* v1, const Vector3* v2);
|
|
|
|
Vector2 diffV2(const Vector2* v1, const Vector2* v2);
|
|
Vector3 diffV3(const Vector3* v1, const Vector3* v2);
|
|
|
|
Vector2 constProdV2(const Vector2* v, float value);
|
|
Vector3 constProdV3(const Vector3* v, float value);
|
|
|
|
float scalarProdV2(const Vector2* v1, const Vector2* v2);
|
|
float scalarProdV3(const Vector3* v1, const Vector3* v2);
|
|
|
|
Vector2 vectorProdV2(const Vector2* v1, const Vector2* v2);
|
|
Vector3 vectorProdV3(const Vector3* v1, const Vector3* v2);
|
|
|
|
#endif |