| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #ifndef VECTOR3D_H
- #define VECTOR3D_H
- #ifndef M_PI
- #define M_PI 3.14159265358979323846
- #endif
- #ifndef M_PI_2
- #define M_PI_2 1.57079632679489661923
- #endif
- #ifndef M_PI_4
- #define M_PI_4 0.78539816339744830962
- #endif
- #ifndef M_1_PI
- #define M_1_PI 0.31830988618379067154
- #endif
- typedef struct Vector3D {
- float x;
- float y;
- float z;
- } Vector3D;
- void vectorSet(Vector3D* v, float x, float y, float z);
- void vectorSetTo(Vector3D* v1, Vector3D* v2);
- void vectorSetToInverse(Vector3D* v1, Vector3D* v2);
- void vectorSetMul(Vector3D* v1, Vector3D* v2, float f);
- void vectorSetAngles(Vector3D* v, float lengthAngle, float widthAngle);
- void vectorAdd(Vector3D* v1, Vector3D* v2);
- void vectorSub(Vector3D* v1, Vector3D* v2);
- void vectorMul(Vector3D* v1, float f);
- void vectorAddMul(Vector3D* v1, Vector3D* v2, float f);
- void vectorCross(Vector3D* v, float x, float y, float z);
- void vectorCrossWith(Vector3D* v1, Vector3D* v2);
- void vectorNormalize(Vector3D* v);
- float vectorLength(Vector3D* v);
- float vectorDot(Vector3D* v1, Vector3D* v2);
- float vectorDotInverse(Vector3D* v1, Vector3D* v2);
- #endif
|