Version: 9.12.0
GLViewer_Poly Class Reference

#include <GLViewer_Geom.h>

Public Member Functions

 GLViewer_Poly (const GLViewer_PntList *thePoints)
 
virtual ~GLViewer_Poly ()
 
void AddPoint (GLViewer_Pnt &pnt)
 Adds point to polygon. More...
 
int Count () const
 Returns number of point. More...
 
virtual bool IsIn (const GLViewer_Pnt &thePnt) const
 Returns true if a point lies inside this polygon. More...
 
virtual bool IsCovers (const GLViewer_Poly &thePoly) const
 Returns true if a other polygon covers this polygon
More...
 
virtual bool IsCovers (const GLViewer_Rect &theRect) const
 Likes the above function. More...
 
virtual bool HasIntersection (const GLViewer_Segment &theSegment) const
 

Private Attributes

GLViewer_PntListmyPoints
 

Detailed Description

Class GLViewer_Poly Polygon for 2d detection

Constructor & Destructor Documentation

◆ GLViewer_Poly()

GLViewer_Poly::GLViewer_Poly ( const GLViewer_PntList thePoints)

constructs a closed polygon from the given ordered list of points

◆ ~GLViewer_Poly()

GLViewer_Poly::~GLViewer_Poly ( )
virtual

destructor, <myPoints> mustn't be deleted here!

Member Function Documentation

◆ AddPoint()

void GLViewer_Poly::AddPoint ( GLViewer_Pnt pnt)
inline

Adds point to polygon.

◆ Count()

int GLViewer_Poly::Count ( ) const
inline

Returns number of point.

◆ HasIntersection()

bool GLViewer_Poly::HasIntersection ( const GLViewer_Segment theSegment) const
virtual
Returns
true if polygon has intersection with segment or ray
Parameters
theSegment- segment to check intersection

References GLViewer_Segment::HasIntersection(), and myPoints.

◆ IsCovers() [1/2]

bool GLViewer_Poly::IsCovers ( const GLViewer_Poly thePoly) const
virtual

Returns true if a other polygon covers this polygon

Returns
true if <thePnt> lies within this polygon
true if <thePoly> covers this polygon

References Count(), IsIn(), and myPoints.

◆ IsCovers() [2/2]

bool GLViewer_Poly::IsCovers ( const GLViewer_Rect theRect) const
virtual

Likes the above function.

Returns
true if <theRect> covers this polygon

References GLViewer_Rect::bottom(), GLViewer_Poly(), IsCovers(), GLViewer_Rect::left(), myPoints, GLViewer_Rect::right(), and GLViewer_Rect::top().

◆ IsIn()

bool GLViewer_Poly::IsIn ( const GLViewer_Pnt thePnt) const
virtual

Returns true if a point lies inside this polygon.

Returns
true if <thePnt> lies within this polygon

References GLViewer_Segment::HasIntersection(), myPoints, and GLViewer_Pnt::y().

Member Data Documentation

◆ myPoints

GLViewer_PntList* GLViewer_Poly::myPoints
private

The documentation for this class was generated from the following files: