39 static float multiplier;
79 float GetPerimeter()
const{
80 return 2.0f*(size.x+size.y);
87 QVector GetCenterPosition()
const {
88 return (minPos+maxPos)*0.5f;
91 float GetVolume()
const{
95 double isContain(
const QAABB& otherAABB)
const {
96 return (minPos.x <= otherAABB.minPos.x) &&
97 (minPos.y <= otherAABB.minPos.y) &&
98 (maxPos.x >= otherAABB.maxPos.x) &&
99 (maxPos.y >= otherAABB.maxPos.y);
103 float minX=b1.minPos.x<b2.minPos.x ? b1.minPos.x : b2.minPos.x;
104 float minY=b1.minPos.y<b2.minPos.y ? b1.minPos.y : b2.minPos.y;
106 float maxX=b1.maxPos.x>b2.maxPos.x ? b1.maxPos.x : b2.maxPos.x;
107 float maxY=b1.maxPos.y>b2.maxPos.y ? b1.maxPos.y : b2.maxPos.y;
112 void Fatten(
float amount){
114 SetMinMax(minPos-amountVec,maxPos+amountVec);
117 QAABB Fattened(
float amount)
const{
119 return QAABB(minPos-amountVec,maxPos+amountVec);
123 QAABB FattenedWithRate(
float rate)
const{
124 QVector ratedSize=size*rate*0.5f;
125 return QAABB(minPos-ratedSize,maxPos+ratedSize);
128 bool isCollidingWith(
const QAABB& otherAABB)
const {
129 return maxPos.x >= otherAABB.minPos.x && minPos.x <= otherAABB.maxPos.x &&
130 maxPos.y >= otherAABB.minPos.y && minPos.y <= otherAABB.maxPos.y;