Xonotic
p2mathlib.qc 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.

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

Referenced by viewloc_PlayerPhysics().

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(float skel, float bonenum) _skel_get_boneabs_hidden
vector v
Definition: ent_cs.qc:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ angle_snap_f()

ERASEABLE float angle_snap_f ( float  f,
float  increment 
)

Definition at line 73 of file p2mathlib.qc.

References ERASEABLE.

Referenced by angle_snap_vec(), and viewloc_PlayerPhysics().

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 }
+ Here is the caller graph for this function:

◆ angle_snap_vec()

ERASEABLE vector angle_snap_vec ( vector  v,
float  increment 
)

Definition at line 85 of file p2mathlib.qc.

References angle_snap_f(), ERASEABLE, and vector().

Referenced by viewloc_PlayerPhysics().

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 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
vector v
Definition: ent_cs.qc:116
ERASEABLE float angle_snap_f(float f, float increment)
Definition: p2mathlib.qc:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vec_bias()

ERASEABLE vector vec_bias ( vector  v,
float  f 
)

Definition at line 21 of file p2mathlib.qc.

References ERASEABLE, and vector().

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 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
vector v
Definition: ent_cs.qc:116
+ Here is the call graph for this function:

◆ vec_bounds_in()

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

Definition at line 51 of file p2mathlib.qc.

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

Referenced by viewloc_PlayerPhysics().

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_max(vector a, vector b)
Definition: p2mathlib.qc:40
ERASEABLE vector vec_to_min(vector a, vector b)
Definition: p2mathlib.qc:30
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vec_bounds_out()

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

Definition at line 62 of file p2mathlib.qc.

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

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 }
ERASEABLE vector vec_to_max(vector a, vector b)
Definition: p2mathlib.qc:40
ERASEABLE vector vec_to_min(vector a, vector b)
Definition: p2mathlib.qc:30
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:

◆ vec_to_max()

ERASEABLE vector vec_to_max ( vector  a,
vector  b 
)

Definition at line 40 of file p2mathlib.qc.

References ERASEABLE, max(), and vector().

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

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 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vec_to_min()

ERASEABLE vector vec_to_min ( vector  a,
vector  b 
)

Definition at line 30 of file p2mathlib.qc.

References ERASEABLE, min(), and vector().

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

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 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function: