use of com.b3dgs.lionengine.geom.Point in project lionengine by b3dgs.
the class ComponentCollision method removePoints.
/**
* Remove point and adjacent points depending of the collidable max collision size.
*
* @param transformable The transformable reference.
* @param collidable The collidable reference.
*/
private void removePoints(Transformable transformable, Collidable collidable) {
final int oldMinX = getIndex(transformable.getOldX() - collidable.getMaxWidth());
final int oldMinY = getIndex(transformable.getOldY() - collidable.getMaxHeight());
final int oldMaxX = getIndex(transformable.getOldX() + collidable.getMaxWidth());
final int oldMaxY = getIndex(transformable.getOldY() + collidable.getMaxHeight());
for (int x = oldMinX; x <= oldMaxX; x++) {
for (int y = oldMinY; y <= oldMaxY; y++) {
removePoint(cache(x, y), collidable);
}
}
}
use of com.b3dgs.lionengine.geom.Point in project lionengine by b3dgs.
the class ComponentCollision method getPoints.
/**
* Get point representing the area.
*
* @param area The area reference.
* @return The area divided in point depending of reduce factor.
*/
private Collection<Point> getPoints(Area area) {
final Collection<Point> points = new HashSet<>(4);
final int oldMinX = getIndex(area.getX() - area.getWidth());
final int oldMinY = getIndex(area.getY() - area.getHeight());
final int oldMaxX = getIndex(area.getX() + area.getWidth());
final int oldMaxY = getIndex(area.getY() + area.getHeight());
for (int x = oldMinX; x <= oldMaxX; x++) {
for (int y = oldMinY; y <= oldMaxY; y++) {
points.add(cache(x, y));
}
}
return points;
}
Aggregations