本文整理汇总了C++中BoxObj::Intersects方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxObj::Intersects方法的具体用法?C++ BoxObj::Intersects怎么用?C++ BoxObj::Intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxObj
的用法示例。
在下文中一共展示了BoxObj::Intersects方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intersects
bool Picture::intersects (BoxObj& userb, Graphic* gs) {
if (!IsEmpty()) {
Iterator i;
FullGraphic gstemp;
Transformer ttemp;
BoxObj b;
getBox(b, gs);
if (b.Intersects(userb)) {
gstemp.SetTransformer(&ttemp);
for (First(i); !Done(i); Next(i)) {
Graphic* gr = GetGraphic(i);
concatGraphic(gr, gr, gs, &gstemp);
if (intersectsGraphic(gr, userb, &gstemp)) {
gstemp.SetTransformer(nil);
return true;
}
}
gstemp.SetTransformer(nil); /* to avoid deleting ttemp explicitly*/
}
}
return false;
}
示例2: Intersects
boolean FillPolygonObj::Intersects (BoxObj& ub) {
BoxObj b;
GetBox(b);
if (!b.Intersects(ub)) {
return false;
}
if (b.Within(ub)) {
return true;
}
LineObj bottom(ub._left, ub._bottom, ub._right, ub._bottom);
if (Intersects(bottom)) {
return true;
}
LineObj right(ub._right, ub._bottom, ub._right, ub._top);
if (Intersects(right)) {
return true;
}
LineObj top(ub._right, ub._top, ub._left, ub._top);
if (Intersects(top)) {
return true;
}
LineObj left(ub._left, ub._top, ub._left, ub._bottom);
return Intersects(left);
}
示例3: intersects
boolean BSplineSelection::intersects (BoxObj& userb, Graphic* gs) {
BoxObj b;
getBox(b, gs);
if (b.Intersects(userb)) {
if (intersectsGraphic(ifillbspline, userb, gs)) {
return true;
} else if (intersectsGraphic(bspline, userb, gs)) {
return true;
} else if (LeftAints(lx0, ly0, lx1, ly1, userb, gs)) {
return true;
} else if (RightAints(rx0, ry0, rx1, ry1, userb, gs)) {
return true;
}
}
return false;
}
示例4: Merge
void Damage::Merge (BoxObj& newb) {
BoxObj* a1, *a2;
int newArea, area1, area2, diff1, diff2, diff3, maximum;
Iterator i;
FirstArea(i);
a1 = GetArea(i);
Next(i);
a2 = GetArea(i);
BoxObj merge1(*a1 + newb);
BoxObj merge2(*a2 + newb);
BoxObj merge3(*a1 + *a2);
newArea = Area(newb);
area1 = Area(*a1);
area2 = Area(*a2);
diff1 = area1 + newArea - Area(merge1);
diff2 = area2 + newArea - Area(merge2);
diff3 = area1 + area2 - Area(merge3);
maximum = max(max(diff1, diff2), diff3);
if (maximum == diff1) {
if (a2->Intersects(merge1)) {
*a1 = merge1 + *a2;
DeleteArea(a2);
} else {
*a1 = merge1;
}
} else if (maximum == diff2) {
if (a1->Intersects(merge2)) {
*a2 = merge2 + *a1;
DeleteArea(a1);
} else {
*a2 = merge2;
}
} else {
if (newb.Intersects(merge3)) {
*a1 = merge3 + newb;
DeleteArea(a2);
} else {
*a1 = merge3;
*a2 = newb;
}
}
}
示例5: f_intersects
boolean MultiLine::f_intersects (BoxObj& userb, Graphic* gs) {
Coord* convx, *convy;
BoxObj b;
boolean result = false;
getBox(b, gs);
if (b.Intersects(userb)) {
convx = new Coord[count()+1];
convy = new Coord[count()+1];
transformList(x(), y(), count(), convx, convy, gs);
FillPolygonObj fp (convx, convy, count());
result = fp.Intersects(userb);
delete convx;
delete convy;
}
return result;
}
示例6: s_intersects
bool OpenBSpline::s_intersects (BoxObj& userb, Graphic* gs) {
Coord* convx, *convy;
BoxObj b;
bool result = false;
getBox(b, gs);
if (b.Intersects(userb)) {
convx = new Coord[_count];
convy = new Coord[_count];
transformList(_x, _y, _count, convx, convy, gs);
MultiLineObj ml;
ml.SplineToMultiLine(convx, convy, _count);
result = ml.Intersects(userb);
delete convx;
delete convy;
}
return result;
}
示例7: f_intersects
bool ClosedBSpline::f_intersects (BoxObj& userb, Graphic* gs) {
Coord* convx, *convy;
BoxObj b;
bool result = false;
getBox(b, gs);
if (b.Intersects(userb)) {
convx = new Coord[_count];
convy = new Coord[_count];
transformList(_x, _y, _count, convx, convy, gs);
FillPolygonObj fp;
fp.ClosedSplineToPolygon(convx, convy, _count);
result = fp.Intersects(userb);
delete convx;
delete convy;
}
return result;
}
示例8: Incur
void Damage::Incur (BoxObj& newb) {
BoxObj* b;
Iterator i;
if (_areas->IsEmpty()) {
_areas->Prepend(new UList(new BoxObj(&newb)));
} else if (_areas->First() == _areas->Last()) {
FirstArea(i);
b = GetArea(i);
if (newb.Intersects(*b)) {
if (!newb.Within(*b)) {
*b = *b + newb;
}
} else {
_areas->Prepend(new UList(new BoxObj(&newb)));
}
} else {
Merge(newb);
}
}
示例9: intersects
boolean Graphic::intersects (BoxObj& userb, Graphic* gs) {
BoxObj b;
getBox(b, gs);
return b.Intersects(userb);
}
示例10: intersects
boolean Line::intersects (BoxObj& b, Graphic* gs) {
LineObj l (_x0, _y0, _x1, _y1);
transform(l._p1._x, l._p1._y, gs);
transform(l._p2._x, l._p2._y, gs);
return b.Intersects(l);
}