<Binary Space Partitioning Tree>=
public BSPTree() {
PolygonList polylist;
BSPTree front, back;
if (null == polylist) { return null };
else {
BSPTree root = selectAndRemovePoly(polylist);
root.front = new BSPTree();
root.back = new BSPTree();
for (each p in polylist) {
if (p is in front of root) { front.addToList(p); }
else if (p is in back of root) { back.addToList(p); }
else {
p.splitPpoly(root, p, frontPoly,backPoly);
front.addToList(frontPoly);
back.addToList(backPoly);
}
}
}
}