// -------------------------------------------------------------------------------- // Name : AddPosition // Description : Add new anchor point // -------------------------------------------------------------------------------- public void addPosition(PackerPos p) { // Try to insert anchor as close as possible to the top left corner // So it will be tried first bool bFound = false; int pos = 0; foreach (PackerPos it in vPositions) { if (p.x + p.y < it.x + it.y) { bFound = true; break; } pos++; } if (bFound) { vPositions.Insert(pos, p); } else { vPositions.Add(p); } }
public bool containsPoint(PackerPos p) { return(p.x >= x && p.y >= y && p.x < (x + w) && p.y < (y + h)); }
public bool isEqual(PackerPos obj) { return(x == obj.x && y == obj.y); }