Ok die interessant sein könnte, wie etwa:
var w = $('#rect').width();
var h = $('#rect').height();
var ratio = h/w;
var splitAcross = 10;//Ten divisions squared *Changeable*
var splitW = w/splitAcross;
var splitH = ratio*splitW;//Split across and down
var divRects = document.createElement("div"); // Create with DOM
divRects.style.width = splitW+'px';
divRects.style.height = splitH+'px';
var span = 0;
var spl = 0;
while (span < splitAcross)
{
spl++;
var cln = divRects.cloneNode(true);
if (splitW*spl % w == 0) span++;
$("#rect").append(cln);
}
//Removeable*** this is just to show divisions
$("#rect div").each(function(){
$(this).animate({
left: ($(this).offset().left-(w/2))*0.1,
top: ($(this).offset().top-(h/2))*0.1
}, 1000).animate({
left: 0,
top: 0
}, 1000);
});
//Removeable
#rect div {
border: 1px solid #eee;
margin: -1px;
float: left;
position: relative;
background:#5fba7d;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="rect" style="width:450px; height:200px"></div>
<!--width:450px; height:200px *Changeable*-->
B-Baum-oder Quad-Baum könnte der Weg zu gehen. Wofür wird es verwendet? –
Es gibt keine Möglichkeit, diese Frage zu beantworten. "Gut" hängt von der genauen Art der Partition und von den Operationen ab, die Sie dafür ausführen müssen. – Gene