-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeom.h
47 lines (36 loc) · 1014 Bytes
/
geom.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#define PI 3.14159265358979323846
#include <cmath>
struct vec
{
float x, y, z;
vec() { x = y = z = 0; }
vec(float a, float b, float c) : x(a), y(b), z(c) {}
vec& sub(const vec& o);
const float squaredlen();
const float magnitude();
const float dist(const vec& e, vec& t);
//scale vec at a fixed point with equal dimension for screen drawing
vec scaleFixedPoint(float scale, vec fixedPoint);
//scale vec at a fixed point, for screen drawing, variable width & height
vec scaleFixedPoint(float scalex, float scaley, vec fixedPoint);
};
struct vec2
{
float x{ 0 };
float y{ 0 };
//scale vec at a fixed point with equal dimension for screen drawing
void scaleFixedPoint(float scale, vec2 fixedPoint);
};
struct vec4
{
float x, y, z, w;
};
struct glmatrixf
{
float v[16];
const float transformw(const vec& p);
};
float Get3dDistance(vec to, vec from);
vec CalcAngle(vec src, vec dst);
vec2 W2S(glmatrixf* mvpmatrix, vec vPlayerLoc);