Exemple #1
0
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);
}
Exemple #2
0
Graphic* Picture::LastGraphicWithin (BoxObj& userb) {
    Iterator i;
    BoxObj b;

    for (Last(i); !Done(i); Prev(i)) {
	Graphic* subgr = GetGraphic(i);
	subgr->GetBox(b);

	if (b.Within(userb)) {
	    return subgr;
	}
    }
    return nil;
}
Exemple #3
0
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);
    }
}
Exemple #4
0
boolean MultiLineObj::Within (BoxObj& userb) {
    BoxObj b;
    
    GetBox(b);
    return b.Within(userb);
}