+/**
+ * @param dir the directional vector
+ * @param norm the normalized normal
+ * @returns dir reflected by norm
+ */
+ERASEABLE
+vector reflect(vector dir, vector norm)
+{
+ return dir - 2 * (dir * norm) * norm;
+}
+
+/**
+ * clip vel along the plane defined by norm (assuming 0 distance away), bounciness determined by bounce 0..1
+ */
+ERASEABLE
+vector vec_reflect(vector vel, vector norm, float bounce)
+{
+ return vel - (1 + bounce) * (vel * norm) * norm;
+}
+
+ERASEABLE
+vector vec_epsilon(vector this, float eps)
+{
+ if (this.x > -eps && this.x < eps) this.x = 0;
+ if (this.y > -eps && this.y < eps) this.y = 0;
+ if (this.z > -eps && this.z < eps) this.z = 0;
+ return this;
+}
+
+#define ClipVelocity(in, normal, out, overbounce) \
+ (out = vec_epsilon(vec_reflect(in, normal, (overbounce) - 1), 0.1))
+
+#ifdef GAMEQC
+ ERASEABLE