00001 // Polygon selection function by Alan Baylis 2003 00002 00003 // SelectPolygon() creates a ray from the current camera coordinates to a point half a unit into the screen that is coincident 00004 // with the mouse coordinates passed in and checks for an intersection along the line of this ray with the array of 00005 // polygons passed in. 00006 // If there is an intersection then the function returns the zero based index of the closest polygon intersected or -1 00007 // if there was no intersection. 00008 // The polygons passed in must have between 3 to 29 edges, be convex, non-degenerate and have their normals set. 00009 // MouseX and MouseY are relative to the top-left corner of the window. 00010 00011 #ifndef __SELECTION_H_ 00012 #define __SELECTION_H_ 00013 00014 #include <windows.h> 00015 #include "polygon.h" 00016 00017 int SelectPolygon(HWND hWnd, POLYGON* Polygons, int numPolys, int MouseX, int MouseY); 00018 00019 #endif
1.2.15