1 // File: GLViewer_Detector.h
2 // Created: 11/16/2004 09:33:22
3 // Author: Sergey ANIKIN
6 #ifndef GLVIEWER_DETECTOR_H
7 #define GLVIEWER_DETECTOR_H
9 #include <GLViewer_Object.h>
11 //================================================================
12 // Class : GLViewer_Segment
13 // Description : segment for 2d detection
14 //================================================================
15 class GLVIEWER_EXPORT GLViewer_Segment
18 GLViewer_Segment( const GLViewer_Pnt& thePnt1,
19 const GLViewer_Pnt& thePnt2 );
20 // Ordinary segment construction
22 GLViewer_Segment( const GLViewer_Pnt& thePnt,
26 // Construction of a ray with given equation Ax + By + C = 0
30 bool HasIntersection( const GLViewer_Segment& theOther ) const;
31 // Detects intersection with another segment or ray
41 //================================================================
42 // Class : GLViewer_Poly
43 // Description : polygon for 2d detection
44 //================================================================
45 class GLVIEWER_EXPORT GLViewer_Poly
48 GLViewer_Poly( const GLViewer_PntList* thePoints );
49 virtual ~GLViewer_Poly();
52 int Count() const { return myPoints->count(); }
53 virtual bool IsIn( const GLViewer_Pnt& thePnt ) const;
54 // Detects if a point lies inside this polygon
56 virtual bool IsCovers( const GLViewer_Poly& thePoly ) const;
57 // Detect if a other polygon covers this polygon
59 virtual bool IsCovers( const GLViewer_Rect& theRect ) const;
60 // likes the above function
62 virtual bool HasIntersection( const GLViewer_Segment& theSegment ) const;
63 // Detects intersection of this polygon with a segment or a ray
66 GLViewer_PntList* myPoints;