Package transientlibs.rlforj.math

Examples of transientlibs.rlforj.math.Point2I


      LinkedList<bumpT> shallowBumps, LinkedList<fieldT> activeFields)
  {
//    System.out.println("-> "+steepBumps+" - "+shallowBumps);
    // System.out.println("visitsq called "+dest);
    // The top-left and bottom-right corners of the destination square.
    Point2I topLeft = new Point2I(dest.x, dest.y + 1);
    Point2I bottomRight = new Point2I(dest.x + 1, dest.y);

    // fieldT currFld=null;

    while (!currentField.isAtEnd()
        && currentField.getCurrent().steep
View Full Code Here


    fieldT currFld = currentField.getCurrent();
    boolean ret = false;

    if (currFld.shallow.doesContain(currFld.steep.near)
        && currFld.shallow.doesContain(currFld.steep.far)
        && (currFld.shallow.doesContain(new Point2I(0, 1)) || currFld.shallow
            .doesContain(new Point2I(1, 0))))
    {
//      System.out.println("removing "+currentField.getCurrent());
      currentField.removeCurrent();
      ret = true;
    }
View Full Code Here

    }
  }

  boolean actIsBlocked(final fovStateT state, final Point2I pos)
  {
    Point2I adjustedPos = new Point2I(pos.x * state.quadrant.x
        + state.source.x, pos.y * state.quadrant.y + state.source.y);

    if(!state.board.contains(adjustedPos.x, adjustedPos.y))
      return false;//we are getting outside the board
   
View Full Code Here

  }

  void permissiveFov(int sourceX, int sourceY, permissiveMaskT mask)
  {
    fovStateT state = new fovStateT();
    state.source = new Point2I(sourceX, sourceY);
    state.mask = mask;
    state.board = mask.board;
    // state.isBlocked = isBlocked;
    // state.visit = visit;
    // state.context = context;

    final int quadrantCount = 4;
    final Point2I quadrants[] = { new Point2I(1, 1), new Point2I(-1, 1),
        new Point2I(-1, -1), new Point2I(1, -1) };

    Point2I extents[] = { new Point2I(mask.east, mask.north),
        new Point2I(mask.west, mask.north),
        new Point2I(mask.west, mask.south),
        new Point2I(mask.east, mask.south) };
    int quadrantIndex = 0;
    for (; quadrantIndex < quadrantCount; ++quadrantIndex)
    {
      state.quadrant = quadrants[quadrantIndex];
      state.extent = extents[quadrantIndex];
View Full Code Here

    mask.fovType = FovType.SQUARE;
    mask.distPlusOneSq = 0;
    mask.board = fb;

    fovStateT state = new fovStateT();
    state.source = new Point2I(startX, startY);
    state.mask = mask;
    state.board = fb;
    state.isLos = true;
    state.quadrant = new Point2I(dx < 0 ? -1 : 1, dy < 0 ? -1 : 1);
    state.quadrantIndex = 0;

    LinkedList<bumpT> steepBumps = new LinkedList<bumpT>();
    LinkedList<bumpT> shallowBumps = new LinkedList<bumpT>();
    // activeFields is sorted from shallow-to-steep.
    LinkedList<fieldT> activeFields = new LinkedList<fieldT>();
    activeFields.addLast(new fieldT());
    activeFields.getLast().shallow.near = new Point2I(0, 1);
    activeFields.getLast().shallow.far = new Point2I(adx + 1, 0);
    activeFields.getLast().steep.near = new Point2I(1, 0);
    activeFields.getLast().steep.far = new Point2I(0, ady + 1);

    Point2I dest = new Point2I(0, 0);

    Line2I stopLine = new Line2I(new Point2I(0, 1), new Point2I(adx, ady + 1)), startLine = new Line2I(
        new Point2I(1, 0), new Point2I(adx + 1, ady));

    // Visit the source square exactly once (in quadrant 1).
    actIsBlocked(state, dest);

    CLikeIterator<fieldT> currentField = new CLikeIterator<fieldT>(
        activeFields.listIterator());
    int maxI = adx + ady;
    // For each square outline
    int lastStartJ = -1;
    Point2I topLeft = new Point2I(0, 0), bottomRight = new Point2I(0, 0);
    for (int i = 1; i <= maxI && !activeFields.isEmpty(); ++i)
    {
      // System.out.println("i "+i);
      int startJ = max(0, i - adx);
      startJ = max(startJ, lastStartJ - 1);
View Full Code Here

  class fieldT
  {
    public fieldT(fieldT f)
    {
      steep = new Line2I(new Point2I(f.steep.near.x, f.steep.near.y),
          new Point2I(f.steep.far.x, f.steep.far.y));
      shallow = new Line2I(
          new Point2I(f.shallow.near.x, f.shallow.near.y),
          new Point2I(f.shallow.far.x, f.shallow.far.y));
      steepBump = f.steepBump;
      shallowBump = f.shallowBump;
    }
View Full Code Here

    {
      int dx = x - sx;
      dx = dx > 0 ? dx : -dx;
      int dy = y - sy;
      dy = dy > 0 ? dy : -dy;
      visitedNotObs.add(new Point2I(dx, dy));
    }
    //DEBUG
//    b.visit(x, y);
  }
View Full Code Here

TOP

Related Classes of transientlibs.rlforj.math.Point2I

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.