Skip to content
pjc0247 edited this page Oct 23, 2014 · 2 revisions

x,y, width,height를 담는 사각형

생성

Rect rt(0,0,100,100);

연산

containsPoint
사각형 범위에 점이 속해 있는지 검사,
속할 경우 true, 아니면 false

bool c = 
  rect.containsPoint(pt);

intersectsRect
두 사각형 사이에 충돌 영역이 있는지 검사,
충돌할 경우 true, 아니면 false

bool i = 
  rect1.intersectRect(rect2);

unionWithRect
두 사각형의 교집합을 계산

union = rect1.unionWithRect(rect2);

Clone this wiki locally