This follows exactly the same procedure as above, but now it becomes slightly more tricky
to calculate the values of y1 and y2. You will first have to define your plane.
There are a couple of ways to do this, but I shall show you the method where you define the
plane by a point on the plane and a vector perpendicular to it.
Suppose the normal to the plane is (Na, Nb, Nc)
and the point whose distance from the plane you want to determine is (Px, Py, Pz)
(Na*Px + Nb*Py + Nc*Pz)
Distance = -----------------------
sqrt(Na2 + Nb2 + Nc2)
This is assuming that the plane passes through the origin.
There are a couple of traps here. This method will attempt to draw a shadow in all
circumstances. It will draw a shadow if the light is between the plane and the polygon, and if
the light is on the other side of the plane.
To prevent this from happening, either detect it's occurence, or prevent it altogether. If
you are always going to have a horizontal plane, then just make sure the light source stays
above all the polygons. If you want to have a tilting plane, or if you can't guarantee the
positions of any objects or light sources, then you will have to detect. I don't really have the
time to go into details here as it is way past my bed time. If anyone really wants to do the
detection, and can't figure it out, drop me a line and I'll see what I can come up with.