Browse Source

Removed old fill_area

tags/v0.7.0
Fen Dweller 7 years ago
parent
commit
088fc5c17e
1 changed files with 0 additions and 41 deletions
  1. +0
    -41
      recursive-macro.js

+ 0
- 41
recursive-macro.js View File

@@ -108,48 +108,7 @@ function fill_area2(area, weights)
} else {
return new Person(1);
}

}

function fill_area(area, weights = {"Person": 0.1})
{
var testRadius = Math.sqrt(area / Math.PI);
result = []
for (var key in weights) {
if (weights.hasOwnProperty(key)) {
var objArea = areas[key];
var objRadius = Math.sqrt(objArea / Math.PI);
var newRadius = testRadius - objRadius;

if (newRadius > 0) {
var newArea = newRadius * newRadius * Math.PI;
var numObjs = weights[key] * newArea;
if (numObjs < 1) {
numObjs = Math.random() > numObjs ? 0 : 1;
}
else {
numObjs = Math.round(numObjs);
}

if (numObjs > 0)
result.push(new things[key](numObjs));
else {
// try again with a better chance for just one
}

}

}
}

if (result.length > 1)
return new Container(result);
else if (result.length == 1)
return result[0];
else
return new Person();
}

// describes everything in the container

function describe_all(contents,verbose=true) {


Loading…
Cancel
Save