Package org.matheusdev.util.vecs

Examples of org.matheusdev.util.vecs.Vec2i


    int beginx = ((int) rect.x) / width;
    int beginy = ((int) rect.y) / height;
    int endx = ((int) (rect.x + rect.w)) / width;
    int endy = ((int) (rect.y + rect.h)) / height;

    Vec2i pos = new Vec2i(0, 0);
    for (int y = beginy; y <= endy; y++) {
      for (int x = beginx; x <= endx; x++) {
        pos.set(x, y);

        ArrayList<E> mapList = map.get(pos);

        if (mapList == null) {
          ArrayList<E> list = new ArrayList<E>();
          list.add(e);
          map.put(new Vec2i(x, y), list);
        } else {
          mapList.add(e);
        }
      }
    }
View Full Code Here


    int endx = ((int) (region.x + region.w)) / width;
    int endy = ((int) (region.y + region.h)) / height;

    for (int y = beginy; y <= endy; y++) {
      for (int x = beginx; x <= endx; x++) {
        Vec2i pos = Vec2i.get(x, y);
        ArrayList<E> elements = map.get(pos);

        if (elements != null) {
          for (int i = 0; i < elements.size(); i++) {
            boolean continueSearching = callback.handleElement(x, y, elements.get(i));
View Full Code Here

    int endx = ((int) (region.x + region.w)) / width;
    int endy = ((int) (region.y + region.h)) / height;

    for (int y = beginy; y <= endy; y++) {
      for (int x = beginx; x <= endx; x++) {
        Vec2i pos = Vec2i.get(x, y);
        ArrayList<E> elements = map.get(pos);

        if (elements != null) {
          queryList.addAll(elements);
        }
View Full Code Here

TOP

Related Classes of org.matheusdev.util.vecs.Vec2i

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.