I'm writing a simple 3D render engine. In 3D graphics, everything is made of triangles. To figure how bright to make each triangle, it needs to know what angle it is relative to the direction of the single light source. For simplicity, the light source is a direction, not a point.
Line = $(0,0,0)$ to $(0,1,0)$
I couldn't find anything helpful when I searched Google and this StackExchange. At this point, I don't care how complex the formula(e) is/are.
Thank you very much!
The direction vector for the line is
given the normal vector for the plane $n=(a,b,c)$ use that
$$\cos \theta =\frac{v\cdot n}{|v||n|}$$
If you are looking for the acute angle just consider the absolute value for the RHS.
Given the three points P,Q,R for the plane a normal vector can be determined by the cross product
$$n=PQ\times PR$$