reflect - chung-leong/qb GitHub Wiki

reflect - Calculate reflection vector

float[] reflect(float[] $I, float[] $N)

For the incident vector I and surface orientation N, returns the reflection direction:

I – 2 ∗ dot(N, I) ∗ N

N must already be normalized in order to achieve the desired result.

Version

1.0 and above.

(Language taken from OpenGL® ES 3.0 specification)