Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
p2mathlib.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ERASEABLE vector aim_vec (vector org, vector targ)
ERASEABLE float angle_snap_f (float f, float increment)
ERASEABLE vector angle_snap_vec (vector v, float increment)
ERASEABLE vector vec_bias (vector v, float f)
ERASEABLE vector vec_bounds_in (vector point, vector a, vector b)
ERASEABLE vector vec_bounds_out (vector point, vector a, vector b)
ERASEABLE vector vec_to_max (vector a, vector b)
ERASEABLE vector vec_to_min (vector a, vector b)

Function Documentation

◆ aim_vec()

ERASEABLE vector aim_vec ( vector org,
vector targ )

Definition at line 95 of file p2mathlib.qc.

96{
97 vector v;
98 // we float around x and y, but rotate around z
99 v.x = targ.x - org.x;
100 v.y = targ.y - org.y;
101 v.z = org.z - targ.z;
102 // get the angles actual
103 return vectoangles(normalize(v));
104}
vector vectoangles(vector v)
vector normalize(vector v)
vector
Definition self.qh:92
vector org
Definition self.qh:92

References normalize(), org, vectoangles(), and vector.

Referenced by viewloc_SetViewLocation().

◆ angle_snap_f()

ERASEABLE float angle_snap_f ( float f,
float increment )

Definition at line 73 of file p2mathlib.qc.

74{
75 for (int j = 0; j <= 360; )
76 {
77 if (f <= j - increment) return j - increment;
78 j = j + increment;
79 }
80
81 return 0;
82}

Referenced by angle_snap_vec(), and viewloc_SetViewLocation().

◆ angle_snap_vec()

ERASEABLE vector angle_snap_vec ( vector v,
float increment )

Definition at line 85 of file p2mathlib.qc.

86{
87 vector c;
88 c.x = angle_snap_f(v.x, increment);
89 c.y = angle_snap_f(v.y, increment);
90 c.z = angle_snap_f(v.z, increment);
91 return c;
92}
ERASEABLE float angle_snap_f(float f, float increment)
Definition p2mathlib.qc:73

References angle_snap_f(), and vector.

Referenced by viewloc_SetViewLocation().

◆ vec_bias()

ERASEABLE vector vec_bias ( vector v,
float f )

Definition at line 21 of file p2mathlib.qc.

22{
23 vector c;
24 c.x = v.x + f;
25 c.y = v.y + f;
26 c.z = v.z + f;
27 return c;
28}

References vector.

◆ vec_bounds_in()

ERASEABLE vector vec_bounds_in ( vector point,
vector a,
vector b )

Definition at line 51 of file p2mathlib.qc.

52{
53 vector d = vec_to_min(a, b);
54 vector e = vec_to_max(a, b);
55
56 vector c = vec_to_min(vec_to_max(point, d), e);
57
58 return c;
59}
ERASEABLE vector vec_to_min(vector a, vector b)
Definition p2mathlib.qc:30
ERASEABLE vector vec_to_max(vector a, vector b)
Definition p2mathlib.qc:40

References vec_to_max(), vec_to_min(), and vector.

Referenced by viewloc_SetViewLocation().

◆ vec_bounds_out()

ERASEABLE vector vec_bounds_out ( vector point,
vector a,
vector b )

Definition at line 62 of file p2mathlib.qc.

63{
64 vector d = vec_to_max(a, b);
65 vector e = vec_to_min(a, b);
66
67 vector c = vec_to_min(vec_to_max(point, d), e);
68
69 return c;
70}

References vec_to_max(), vec_to_min(), and vector.

◆ vec_to_max()

ERASEABLE vector vec_to_max ( vector a,
vector b )

Definition at line 40 of file p2mathlib.qc.

41{
42 vector c;
43 c.x = max(a.x, b.x);
44 c.y = max(a.y, b.y);
45 c.z = max(a.z, b.z);
46 return c;
47}
float max(float f,...)

References max(), and vector.

Referenced by vec_bounds_in(), vec_bounds_out(), and viewloc_SetViewLocation().

◆ vec_to_min()

ERASEABLE vector vec_to_min ( vector a,
vector b )

Definition at line 30 of file p2mathlib.qc.

31{
32 vector c;
33 c.x = min(a.x, b.x);
34 c.y = min(a.y, b.y);
35 c.z = min(a.z, b.z);
36 return c;
37}
float min(float f,...)

References min(), and vector.

Referenced by vec_bounds_in(), vec_bounds_out(), and viewloc_SetViewLocation().