My Project
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ParaEngine::CGDIRegion Class Reference

We always shape the region points and edges in clockwise. More...

#include <GDIRegion.h>

Public Member Functions

 CGDIRegion ()
 This default constructor constructs an infinite region.
 
 CGDIRegion (const RECT &rect)
 This constructor constructs a region with the given rectangle.
 
bool operator== (const CGDIRegion &region)
 
bool operator== (const RECT &rect)
 
 operator RECT ()
 
void Translate (float dx, float dy, float dz=0)
 Move the whole region.
 
void Translate (const Vector3 &v)
 
bool IsEmpty () const
 Check if the region is empty.
 
bool IsInfinite () const
 Check if the region is infinite.
 
void MakeEmpty ()
 
void MakeInifinite ()
 
CGDIRegionClone ()
 
bool LineIntersect (const Vector3 &point1, const Vector3 &point2, Vector3 &outpoint) const
 Find the intersection of a line with the region. More...
 
bool LineIntersect (const GDISimpleEdge &edge, vector< Vector3 > &outpoint, vector< int > &outedge) const
 
bool InsideTest (const Vector3 &point) const
 Decide if the point is inside or outside the region. More...
 
int PolygonClip (const CGDIRegion &region, vector< CGDIRegion > &outregions)
 Clip the input region with the current region the outregion contains all intersections, because clipping a polygon may result in more than one polygon The input region is the polygon to be clipped and the current region is the clipping window.
 
int RectClip (const CGDIRegion &region, CGDIRegion &outregion)
 Clip two rectangle regions.
 
Vector3 GetPoint (int index) const
 
int PointCount () const
 
GDISimpleEdge GetEdge (int index) const
 

Static Public Member Functions

static bool EdgeIntersect (const GDISimpleEdge &edge1, const GDISimpleEdge &edge2, Vector3 &point)
 Static function to decide and find the intersect point of two edges. More...
 

Protected Member Functions

bool IsPoint1Closer (const Vector3 &point, const Vector3 &point1, const Vector3 &point2, int relation=0)
 Decide if the input edge intersects with any of the edges in the current region,. More...
 
bool CalculateClipX (const GDISimpleEdge &edge1, const GDISimpleEdge &edge2, float &pointx) const
 
void GenerateEdge ()
 
void Preprocessing ()
 

Protected Attributes

vector< Vector3m_points
 
vector< GDISimpleEdgem_edges
 
list< GDIClipNodem_nodes
 
int m_shape
 

Detailed Description

We always shape the region points and edges in clockwise.

Member Function Documentation

§ EdgeIntersect()

bool CGDIRegion::EdgeIntersect ( const GDISimpleEdge edge1,
const GDISimpleEdge edge2,
Vector3 point 
)
static

Static function to decide and find the intersect point of two edges.

Returns
: true if the two edges intersect, false if not

§ InsideTest()

bool CGDIRegion::InsideTest ( const Vector3 point) const

Decide if the point is inside or outside the region.

Returns
: true if inside, false if outside

§ IsPoint1Closer()

bool CGDIRegion::IsPoint1Closer ( const Vector3 point,
const Vector3 point1,
const Vector3 point2,
int  relation = 0 
)
protected

Decide if the input edge intersects with any of the edges in the current region,.

Returns
: -1 if edge is inside the region, 0 if edge intersects with the region, 1 if edge is outside the region Compare two points against the source point and decide which point is closer to the source point if relation is 0, all the points are supposed to be on the same line

§ LineIntersect()

bool CGDIRegion::LineIntersect ( const Vector3 point1,
const Vector3 point2,
Vector3 outpoint 
) const

Find the intersection of a line with the region.

Parameters
point1,point2[in] the start point and end point of the input line
outpoint1,outpoint2[out] the start point and end point of the line which intersects with the region. Their meaningless if the return is false; : true if the line is inside the region or intersects with the region. false if the line is outside the region

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