KiCad PCB EDA Suite
CRectPlacement::TRect Struct Reference

#include <rect_placement.h>

Inheritance diagram for CRectPlacement::TRect:
CRectPlacement::TPos TSubRect

Public Member Functions

 TRect ()
 
 TRect (int _x, int _y, int _w, int _h)
 
bool Contains (const TPos &p) const
 
bool Contains (const TRect &r) const
 
bool Intersects (const TRect &r) const
 
bool operator== (const TPos &p) const
 

Static Public Member Functions

static bool Greater (const TRect &a, const TRect &b)
 

Public Attributes

int w
 
int h
 
int x
 
int y
 

Detailed Description

Definition at line 35 of file rect_placement.h.

Constructor & Destructor Documentation

CRectPlacement::TRect::TRect ( )
inline

Definition at line 39 of file rect_placement.h.

39 : w( 0 ), h( 0 ) { }
CRectPlacement::TRect::TRect ( int  _x,
int  _y,
int  _w,
int  _h 
)
inline

Definition at line 40 of file rect_placement.h.

40  : TPos( _x, _y ), w( _w > 0 ? _w : 0 ), h(
41  _h > 0 ? _h : 0 ) { }

Member Function Documentation

bool CRectPlacement::TRect::Contains ( const TPos p) const
inline

Definition at line 43 of file rect_placement.h.

References w, CRectPlacement::TPos::x, and CRectPlacement::TPos::y.

Referenced by CRectPlacement::IsFree().

44  {
45  return p.x >= x && p.y >= y && p.x < (x + w) && p.y < (y + h);
46  }
bool CRectPlacement::TRect::Contains ( const TRect r) const
inline

Definition at line 47 of file rect_placement.h.

References h, w, CRectPlacement::TPos::x, and CRectPlacement::TPos::y.

48  {
49  return r.x >= x && r.y >= y &&
50  (r.x + r.w) <= (x + w) && (r.y + r.h) <= (y + h);
51  }
static bool CRectPlacement::TRect::Greater ( const TRect a,
const TRect b 
)
inlinestatic

Definition at line 62 of file rect_placement.h.

References h, and w.

Referenced by spreadRectangles().

63  {
64  return (a.w > b.w && a.w > b.h) || (a.h > b.w && a.h > b.h);
65  }
bool CRectPlacement::TRect::Intersects ( const TRect r) const
inline

Definition at line 52 of file rect_placement.h.

References h, w, CRectPlacement::TPos::x, and CRectPlacement::TPos::y.

53  {
54  return w > 0 && h > 0 && r.w > 0 && r.h > 0
55  && ( (r.x + r.w) > x && r.x < (x + w) && (r.y + r.h) > y && r.y < (y + h) );
56  }
bool CRectPlacement::TPos::operator== ( const TPos p) const
inlineinherited

Definition at line 32 of file rect_placement.h.

References CRectPlacement::TPos::x, and CRectPlacement::TPos::y.

32 { return x == p.x && y == p.y; }

Member Data Documentation


The documentation for this struct was generated from the following file: