cf_reflect_v3¶
Category: math
GitHub: cute_math3d.h
Reflects a vector off a plane given the plane's normal.
CF_V3 cf_reflect_v3(CF_V3 a, CF_V3 n) { return cf_sub_v3(a, cf_mul_v3_f(n, 2.0f * cf_dot_v3(a, n))); }
| Parameters | Description |
|---|---|
a |
The vector to reflect. |
n |
The plane's normal. Should be unit length. |
Remarks¶
The 3d analog of cf_reflect -- bounces, ricochets, mirrored cameras. The C++ API overloads cf_reflect directly.