Your quad is exclusively in the XY-plane, so the normal vector is the Z-axis; either (0,0,1) or (0,0,-1) depending on what you consider to be the front of it.
In general though, the normal can be calculated from the cross product of two non-linearly dependent vectors on your face. You can, for example, take two edges (the vector between two pairs of vertices), and calculate the normal as the cross product of the two vectors.
For a plane normal you need a third dimension. Then you take two edges of the plane that share the same corners, make vectors of them, take the cross product of those vectors and then normalize the cross product. So let's give your plane a z axis... and put them in a vertex (pseudo) class so the data can be manipulated by us...
//now you want to normalize the crossproduct you do that via sqrt(x^2 + y^2 + z^2) and then divide each of its coordinates by the value obtained. Last but not least you add the resultant vector (which is going to be 0,0,1 or ideally close to it) to one of the planes four vertices. Yeah, the normal here is one along the z but the method I described works for any plane orientation.
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy
Well I dont know a lot about this ray casting stuff,I'm assuming you ray cast by using a 2D grid to project 3D images.
Anyways, in order to calculate normal in 2D all you have to do is calculate the vector By subtracting Point2 by Point1 .
The result is a vector in the pointing in the direction of Point2 ;
Math looks like this:
Edge Vector =>P2.X-P1.X, P2.Y-P1.Y
Now you can get the left or right normal of this vector.
right normal => -*Edge.Y,Edge.X
left normal => Edge.Y,-*Edge.X
For a plane normal you need a third dimension. Then you take two edges of the plane that share the same corners, make vectors of them, take the cross product of those vectors and then normalize the cross product. So let's give your plane a z axis... and put them in a vertex (pseudo) class so the data can be manipulated by us...
//now you want to normalize the crossproduct you do that via sqrt(x^2 + y^2 + z^2) and then divide each of its coordinates by the value obtained. Last but not least you add the resultant vector (which is going to be 0,0,1 or ideally close to it) to one of the planes four vertices. Yeah, the normal here is one along the z but the method I described works for any plane orientation.
I open sourced my C++/iOS OpenGL 2D RPG engine :-)