Ported mode Model methods to XS

This commit is contained in:
Alessandro Ranellucci 2015-12-02 18:06:18 +01:00
parent dfce3a3138
commit ed75219215
9 changed files with 86 additions and 125 deletions

View file

@ -168,15 +168,15 @@ linint(double value, double oldmin, double oldmax, double newmin, double newmax)
}
Pointfs
arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf &bb)
arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf* bb)
{
// use actual part size (the largest) plus separation distance (half on each side) in spacing algorithm
part.x += dist;
part.y += dist;
Pointf area;
if (bb.defined) {
area = bb.size();
if (bb != NULL) {
area = bb->size();
} else {
// bogus area size, large enough not to trigger the error below
area.x = part.x * total_parts;
@ -278,10 +278,10 @@ arrange(size_t total_parts, Pointf part, coordf_t dist, const BoundingBoxf &bb)
positions.push_back(Pointf(cx * part.x, cy * part.y));
}
if (bb.defined) {
if (bb != NULL) {
for (Pointfs::iterator p = positions.begin(); p != positions.end(); ++p) {
p->x += bb.min.x;
p->y += bb.min.y;
p->x += bb->min.x;
p->y += bb->min.y;
}
}
return positions;