/**
     * Finds the boundaries of all the geometry polygons in X and Y.
     * The boundaries are extended by robot radius in each direction.
     *
     * @return array of doubles {{minX, minY}}, {{maxX, maxY}}.
     */
// TODO(playerone) remove sync
private synchronized double[][] findGeometriesBoundaries() {
        if (mGeometryList.isEmpty()) {
            Log.wtf(TAG, "Empty geometries list");
            return null;
        }
        double minX = Double.MAX_VALUE;
        double maxX = -Double.MAX_VALUE;
        double minY = Double.MAX_VALUE;
        double maxY = -Double.MAX_VALUE;
        for (Geometry g : mGeometryList) {
            int size = g.mPolygon.getSize();
            List<Transform> points = g.mPolygon.getPoints();
            for (int i = 0; i < size; i++) {
                double[] pointPosition = points.get(i).getPosition();
                minX = Math.min(minX, pointPosition[0]);
                maxX = Math.max(maxX, pointPosition[0]);
                minY = Math.min(minY, pointPosition[1]);
                maxY = Math.max(maxY, pointPosition[1]);
            }
        }
        return new double[][]{{minX - mRobotRadius, minY - mRobotRadius},
                              {maxX + mRobotRadius, maxY + mRobotRadius}};
    }
private synchronized double[][] findGeometriesBoundaries() {
if (mGeometryList.isEmpty()) {
Log.wtf(TAG, "Empty geometries list");
return null;
}
double minX = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Geometry g : mGeometryList) {
int size = g.mPolygon.getSize();
List<Transform> points = g.mPolygon.getPoints();
for (int i = 0; i < size; i++) {
double[] pointPosition = points.get(i).getPosition();
minX = Math.min(minX, pointPosition[0]);
maxX = Math.max(maxX, pointPosition[0]);
minY = Math.min(minY, pointPosition[1]);
maxY = Math.max(maxY, pointPosition[1]);
}
}
return new double[][]{{minX - mRobotRadius, minY - mRobotRadius},
{maxX + mRobotRadius, maxY + mRobotRadius}};
}
private synchronized double[][] findGeometriesBoundaries() {
if (mGeometryList.isEmpty()) {
Log.wtf(TAG, "Empty geometries list");
return null;
}
double minX = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Geometry g : mGeometryList) {
int size = g.mPolygon.getSize();
List<Transform> points = g.mPolygon.getPoints();
for (int i = 0; i < size; i++) {
double[] pointPosition = points.get(i).getPosition();
minX = Math.min(minX, pointPosition[0]);
maxX = Math.max(maxX, pointPosition[0]);
minY = Math.min(minY, pointPosition[1]);
maxY = Math.max(maxY, pointPosition[1]);
}
}
return new double[][]{{minX - mRobotRadius, minY - mRobotRadius},
{maxX + mRobotRadius, maxY + mRobotRadius}};
}
private synchronized double[][] findGeometriesBoundaries() {
if (mGeometryList.isEmpty()) {
Log.wtf(TAG, "Empty geometries list");
return null;
}
double minX = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Geometry g : mGeometryList) {
int size = g.mPolygon.getSize();
List<Transform> points = g.mPolygon.getPoints();
for (int i = 0; i < size; i++) {
double[] pointPosition = points.get(i).getPosition();
minX = Math.min(minX, pointPosition[0]);
maxX = Math.max(maxX, pointPosition[0]);
minY = Math.min(minY, pointPosition[1]);
maxY = Math.max(maxY, pointPosition[1]);
}
}
return new double[][]{{minX - mRobotRadius, minY - mRobotRadius},
{maxX + mRobotRadius, maxY + mRobotRadius}};
}