/**
  * Paste from the clipboard.
  *
  * @param editSession
  * @param newOrigin Position to paste it from
  * @param noAir True to not paste air
  * @throws MaxChangedBlocksException
  */
 public void paste(EditSession editSession, Vector newOrigin, boolean noAir, boolean entities)
     throws MaxChangedBlocksException {
   place(editSession, newOrigin.add(offset), noAir);
   if (entities) {
     pasteEntities(newOrigin.add(offset));
   }
 }
  @Override
  public void shift(Vector change) throws RegionOperationException {
    pos1 = pos1.add(change);
    pos2 = pos2.add(change);

    recalculate();
  }
  private Vector addAnchorString(Vector list, String field, boolean fullCompare) {
    Vector topIndex = new Vector();
    Hashtable topIndexParms, currEntry;
    String lastValue, currValue;

    if (list.size() == 0) return null;

    currEntry = (Hashtable) list.get(0);
    lastValue = (String) currEntry.get(field);
    if (lastValue == null || lastValue.length() == 0) lastValue = "  ";
    lastValue = lastValue.toUpperCase();

    for (int i = 1; i < list.size(); i++) {
      currEntry = (Hashtable) list.get(i);
      currValue = (String) currEntry.get(field);
      currValue = currValue.toUpperCase();
      if (currValue == null || currValue == "") continue;
      try {
        if (fullCompare) {
          if (lastValue.compareTo(currValue) != 0) {
            // Values for navigation line
            topIndexParms = new Hashtable();
            topIndexParms.put("HREF", Convert.toString(i));
            topIndexParms.put("TEXT", currValue);
            topIndex.add(topIndexParms);
            // add anchor entry to list
            currEntry.put("ANCHORNAME", Convert.toString(i));
            currEntry.put("ANCHORTEXT", currValue);
          } else {
            // clear value from previous run
            currEntry.put("ANCHORNAME", "");
            currEntry.put("ANCHORTEXT", "");
          }
        } else {
          if (lastValue.charAt(0) != currValue.charAt(0)) {
            // Values for navigation line
            topIndexParms = new Hashtable();
            topIndexParms.put("HREF", Convert.toString(i));
            topIndexParms.put("TEXT", currValue.charAt(0) + " ");
            topIndex.add(topIndexParms);
            // add anchor entry to list
            currEntry.put("ANCHORNAME", Convert.toString(i));
            currEntry.put("ANCHORTEXT", currValue.charAt(0) + " ");
          } else {
            // clear value from previous run
            currEntry.put("ANCHORNAME", "");
            currEntry.put("ANCHORTEXT", "");
          }
        }
        list.set(i, currEntry);
        lastValue = currValue;
      } catch (Exception e) {
        continue;
      }
    }
    return topIndex;
  }
  @Command(
      aliases = {"/paste"},
      usage = "",
      flags = "sao",
      desc = "Paste the clipboard's contents",
      help =
          "Pastes the clipboard's contents.\n"
              + "Flags:\n"
              + "  -a skips air blocks\n"
              + "  -o pastes at the original position\n"
              + "  -s selects the region after pasting",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.clipboard.paste")
  @Logging(PLACEMENT)
  public void paste(
      Player player,
      LocalSession session,
      EditSession editSession,
      @Switch('a') boolean ignoreAirBlocks,
      @Switch('o') boolean atOrigin,
      @Switch('s') boolean selectPasted)
      throws WorldEditException {

    ClipboardHolder holder = session.getClipboard();
    Clipboard clipboard = holder.getClipboard();
    Region region = clipboard.getRegion();

    Vector to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
    Operation operation =
        holder
            .createPaste(editSession, editSession.getWorld().getWorldData())
            .to(to)
            .ignoreAirBlocks(ignoreAirBlocks)
            .build();
    Operations.completeLegacy(operation);

    if (selectPasted) {
      Vector clipboardOffset =
          clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
      Vector realTo = to.add(holder.getTransform().apply(clipboardOffset));
      Vector max =
          realTo.add(
              holder
                  .getTransform()
                  .apply(region.getMaximumPoint().subtract(region.getMinimumPoint())));
      RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
      session.setRegionSelector(player.getWorld(), selector);
      selector.learnChanges();
      selector.explainRegionAdjust(player, session);
    }

    player.print("The clipboard has been pasted at " + to);
  }
  @Command(
      aliases = {"/hsphere"},
      usage = "<block> <radius> [raised?] ",
      desc = "Generate a hollow sphere",
      min = 2,
      max = 3)
  @CommandPermissions({"worldedit.generation.sphere"})
  @Logging(PLACEMENT)
  public static void hsphere(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Pattern block = we.getBlockPattern(player, args.getString(0));
    double radius = Math.max(1, args.getDouble(1));
    boolean raised =
        args.argsLength() > 2
            ? (args.getString(2).equalsIgnoreCase("true")
                || args.getString(2).equalsIgnoreCase("yes"))
            : false;

    Vector pos = session.getPlacementPosition(player);
    if (raised) {
      pos = pos.add(0, radius, 0);
    }

    int affected = editSession.makeSphere(pos, block, radius, false);
    player.findFreePosition();
    player.print(affected + " block(s) have been created.");
  }
Exemple #6
0
 /**
  * Get the distance between a point and this cuboid.
  *
  * @param pos
  * @return
  */
 public double distance(Vector pos) {
   Vector max = origin.add(new Vector(width, height, length));
   int closestX = Math.max(origin.getBlockX(), Math.min(max.getBlockX(), pos.getBlockX()));
   int closestY = Math.max(origin.getBlockY(), Math.min(max.getBlockY(), pos.getBlockY()));
   int closestZ = Math.max(origin.getBlockZ(), Math.min(max.getBlockZ(), pos.getBlockZ()));
   return pos.distance(new Vector(closestX, closestY, closestZ));
 }
  private Vector addAnchorString(Vector list, String field, double diff) {
    Vector topIndex = new Vector();
    Hashtable topIndexParms, currEntry;
    double lastValue, currValue;

    if (list.size() == 0) return null;

    currEntry = (Hashtable) list.get(0);
    lastValue = Common.parseDouble((String) currEntry.get(field)) + diff;

    for (int i = 1; i < list.size(); i++) {
      currEntry = (Hashtable) list.get(i);
      currValue = Common.parseDouble((String) currEntry.get(field));
      if (currValue >= lastValue) {
        // Values for navigation line
        topIndexParms = new Hashtable();
        topIndexParms.put("HREF", Convert.toString(i));
        topIndexParms.put("TEXT", Convert.toString(lastValue));
        topIndex.add(topIndexParms);
        // add anchor entry to list
        currEntry.put("ANCHORNAME", Convert.toString(i));
        currEntry.put("ANCHORTEXT", Convert.toString(lastValue));
        lastValue = currValue + diff;
      } else {
        // clear value from previous run
        currEntry.put("ANCHORNAME", "");
        currEntry.put("ANCHORTEXT", "");
      }
      list.set(i, currEntry);
    }
    return topIndex;
  }
  public static void main(String[] args) {

    Circle circle = new Circle(25);

    circle.printCircle();
    System.out.println("Check if point [2,1] is inside of circle: " + circle.isPointInCircle(2, 1));
    System.out.println(
        "Check if point [2,45] is inside of circle: " + circle.isPointInCircle(2, 45));

    // after cirle moved the check breaks, to be fixed in next commit
    circle.moveCircle(5, 12);

    Vector vector = new Vector(5);

    System.out.println("Task 1 ");
    vector.printValues();

    System.out.println("delete 4th element ");
    vector.remove(4);
    vector.printValues();

    System.out.println("delete 0 element ");
    vector.remove(0);
    vector.printValues();

    System.out.println("append element ");
    vector.add("new string");
    ;
    vector.printValues();
  }
  // $ANTLR start "color"
  // D:\\Pamela\\Quinto semestre\\Computación  Gráfica\\RayTracer\\RayTracer.g:112:1: color :
  // TYPE_COLOR ;
  public final RayTracerParser.color_return color() throws RecognitionException {
    RayTracerParser.color_return retval = new RayTracerParser.color_return();
    retval.start = input.LT(1);

    Token TYPE_COLOR5 = null;

    try {
      // D:\\Pamela\\Quinto semestre\\Computación  Gráfica\\RayTracer\\RayTracer.g:112:7: (
      // TYPE_COLOR )
      // D:\\Pamela\\Quinto semestre\\Computación  Gráfica\\RayTracer\\RayTracer.g:112:9: TYPE_COLOR
      {
        TYPE_COLOR5 = (Token) match(input, TYPE_COLOR, FOLLOW_TYPE_COLOR_in_color265);
        color += (TYPE_COLOR5 != null ? TYPE_COLOR5.getText() : null);
        double[] color1 = new double[3];
        if (color.equals("Yellow")) {
          color1[0] = 1.0;
          color1[1] = 1.0;
          color1[2] = 0.0;
        } else if (color.equals("Blue")) {
          color1[0] = 0.0;
          color1[1] = 0.0;
          color1[2] = 1.0;
        } else if (color.equals("Red")) {
          color1[0] = 1.0;
          color1[1] = 0.0;
          color1[2] = 0.0;
        } else if (color.equals("Green")) {
          color1[0] = 0.0;
          color1[1] = 1.0;
          color1[2] = 0.0;
        } else if (color.equals("White")) {
          color1[0] = 1.0;
          color1[1] = 1.0;
          color1[2] = 1.0;
        }
        color = "";
        switch (typeObject) {
          case 4:
            ligths.add(color1);
            break;
          case 5:
            for (int i = 0; i < 3; i++) {
              ambientLight[i] = color1[i];
            }
            break;
          default:
            break;
        }
      }

      retval.stop = input.LT(-1);

    } catch (RecognitionException re) {
      reportError(re);
      recover(input, re);
    } finally {
    }
    return retval;
  }
 private void applyForces(final double dt) {
   for (final Object object : this.particles.keySet()) {
     final Particle particle = this.particles.get(object);
     final Vector oldSpeed = particle.getSpeed();
     final Vector newSpeed = oldSpeed.add(this.forces.get(object).scale(dt / particle.getMass()));
     particle.setSpeed(newSpeed);
   }
 }
Exemple #11
0
  /*
  Gives values in the row. Helper method for options

  @param row Row of spot
  @return Vector<Integer> Integers already in that row
  */
  public Vector<Integer> rowValues(int row) {
    Vector<Integer> r = new Vector<Integer>();
    for (int i = 0; i < 9; i++) {
      if (values[row][i] != 0) {
        r.add(values[row][i]);
      }
    }
    return r;
  }
Exemple #12
0
  /*
  Gives values in the column. Helper method for options

  @param col Column of spot
  @return Vector<Integer> Integers already in that column
  */
  private Vector<Integer> colValues(int col) {
    Vector<Integer> c = new Vector<Integer>();
    for (int i = 0; i < 9; i++) {
      if (values[i][col] != 0) {
        c.add(values[i][col]);
      }
    }
    return c;
  }
 private void calculateReflectionVector() {
   r =
       Vector.add(
           l,
           Vector.multiplyVector(
                   n, (2 * Vector.dotProduct(l, n) / (Math.pow(n.getMagnitude(), 2))))
               .neg());
   r.normalize();
 }
Exemple #14
0
 public Vector multiply(Vector vector) {
   Vector result = new Vector(dim1);
   for (int i = 0; i < dim1; i++) {
     for (int j = 0; j < dim2; j++) {
       result.add(i, get(i, j) * vector.get(j));
     }
   }
   return result;
 }
Exemple #15
0
  // ! renvoie les composantes d'un vecteur dont la direction est representee
  // en coordonnees polaires, dans la base x, y, z.
  public static Vector sphericalDirection(
      float sintheta, float costheta, float phi, Vector x, Vector y, Vector z) {
    Vector v1 = x.productVector((float) Math.cos(phi) * sintheta);
    Vector v2 = y.productVector(sintheta * (float) Math.sin(phi));
    Vector v3 = z.productVector(costheta);

    v1.add(v2);
    v1.add(v3);

    return v1;
  }
Exemple #16
0
 // length of vectors gives you number of options
 public Vector<Integer> options(int row, int col) {
   Vector<Integer> o = new Vector<Integer>();
   o.add(1);
   o.add(2);
   o.add(3);
   o.add(4);
   o.add(5);
   o.add(6);
   o.add(7);
   o.add(8);
   o.add(9);
   for (int i : colValues(col)) {
     o.remove(new Integer(i)); // if that number is in the column, it removes it from the options
   }
   for (int j : rowValues(row)) {
     o.remove(new Integer(j)); // if that number is in the row, it removes it from the options
   }
   for (int k : boxValues(row, col)) {
     o.remove(new Integer(k)); // if that number is in the box, it removes it from the options
   }
   return o;
 }
Exemple #17
0
  private void update(Particle particle) {

    float intervalInSecs = (float) intervalInMillis / 1000f; // e.g. 0.033

    // position
    Vector velocity = particle.getVelocity().clone();
    velocity.multiply(intervalInSecs);
    Vector newPosition = particle.getPosition();
    newPosition.add(velocity);
    particle.setPosition(newPosition);

    // velocity
    float dampPowTime = (float) Math.pow(particle.getMass(), intervalInSecs);
    Vector velocityMult = particle.getVelocity().clone();
    velocityMult.multiply(dampPowTime);

    Vector acceleration = particle.getAcceleration().clone();
    acceleration.multiply(intervalInSecs);

    velocityMult.add(acceleration);
    particle.setVelocity(velocityMult);
  }
Exemple #18
0
  /** Make the copy from world. */
  public void copy() {
    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        for (int z = 0; z < length; z++) {
          int index = y * width * length + z * width + x;
          blocks[index] = (byte) CraftBook.getBlockID(origin.add(x, y, z));
          data[index] = (byte) CraftBook.getBlockData(origin.add(x, y, z));
        }
      }
    }

    findTestOffset();
  }
  /** 逻辑 */
  private void logic() {
    // 简单移动
    x += speedX;
    y += speedY;

    if (x >= getWidth() || x < 0) {
      speedX = -speedX;
    }
    if (y >= getHeight() || y < 0) {
      speedY = -speedY;
    }

    // 向量移动
    speed.limit(50);
    speed.add(acc);
    loca.add(speed);

    if (loca.x >= getWidth() || loca.x < 0) {
      speed.x = -speed.x;
      acc.x = -acc.x;
    }
    if (loca.y >= getHeight() || loca.y < 0) {
      speed.y = -speed.y;
      acc.y = -acc.y;
    }

    rect1X = x;
    rect1Y = y;
    // 碰撞检测
    // 矩形与矩形
    //        isColl = rectAndRect(rect1X, rect1Y, rect1Width, rect1Height, rectX, rectY,
    //                rectWidth, rectHeight);
    // 圆与圆
    //        isColl = circleAndCircle(x, y, radius, loca.x, loca.y, radius);
    // 圆与矩形
    isColl = circleAndRect(loca.x, loca.y, radius, rectX, rectY, rectWidth, rectHeight);
  }
Exemple #20
0
  /** Paste to world. */
  public void paste(BlockBag bag) throws BlockSourceException {
    DoubleArrayList<Vector, byte[]> queueAfter = new DoubleArrayList<Vector, byte[]>(false);
    DoubleArrayList<Vector, byte[]> queueLast = new DoubleArrayList<Vector, byte[]>(false);

    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        for (int z = 0; z < length; z++) {
          int index = y * width * length + z * width + x;
          Vector pt = origin.add(x, y, z);

          if (BlockType.shouldPlaceLast(CraftBook.getBlockID(pt))) {
            CraftBook.setBlockID(pt, 0);
          }

          if (BlockType.shouldPlaceLast(blocks[index])) {
            queueLast.put(pt, new byte[] {blocks[index], data[index]});
          } else {
            queueAfter.put(pt, new byte[] {blocks[index], data[index]});
          }
        }
      }
    }

    for (Map.Entry<Vector, byte[]> entry : queueAfter) {
      byte[] v = entry.getValue();
      try {
        bag.setBlockID(entry.getKey(), v[0]);
        if (BlockType.usesData(v[0])) {
          CraftBook.setBlockData(entry.getKey(), v[1]);
        }
      } catch (OutOfBlocksException e) {
        // Eat error
      }
    }

    for (Map.Entry<Vector, byte[]> entry : queueLast) {
      byte[] v = entry.getValue();
      try {
        bag.setBlockID(entry.getKey(), v[0]);
        if (BlockType.usesData(v[0])) {
          CraftBook.setBlockData(entry.getKey(), v[1]);
        }
      } catch (OutOfBlocksException e) {
        // Eat error
      }
    }

    bag.flushChanges();
  }
Exemple #21
0
 private Vector input(final Vector x, final boolean update) {
   final Vector result = x.copy();
   for (int i = 0; i < this.avgInputs.size(); i++) {
     final SignalSmoother avgInput = this.avgInputs.get(i);
     if (avgInput != null) {
       if (update) {
         final double oldAvgInput = avgInput.getSmoothedValue();
         avgInput.addValue(x.get(i));
         this.offset += this.coefficients.get(i) * (avgInput.getSmoothedValue() - oldAvgInput);
       }
       result.add(i, -avgInput.getSmoothedValue());
     }
   }
   return result;
 }
Exemple #22
0
  /*
  Gives values in the box. Helper method for options

  @param row Row of spot
  @param col Column of spot
  @return Vector<Integer> Integers already in that box
  */
  private Vector<Integer> boxValues(int row, int col) {
    Vector<Integer> b = new Vector<Integer>();
    int startrow = row - (row % 3);
    int startcol = col - (col % 3);
    int endrow = startrow + 3;
    int endcol = startcol + 3;
    while (startrow < endrow) {
      startcol = endcol - 3;
      while (startcol < endcol) {
        b.add(values[startrow][startcol]);
        startcol++;
      }
      startrow++;
    }
    return b;
  }
    public static Line create(Vector p1, Vector p2, Vector v1, Vector v2, int f) {

      Function func;

      switch (f) {
        case Function.CURVE:
          func = new Curve(p1, p2, v1, v2);
          break;
        case Function.CURVE_LL:
          v1 = new Vector(0, 0);
          func = new Curve(p1, p2, v1, v2);
          break;
        case Function.CURVE_LR:
          v2 = new Vector(0, 0);
          func = new Curve(p1, p2, v1, v2);
          break;
        case Function.CURVE_T:
          v2 = Vector.sub(Vector.add(p1, v1), p2);
          func = new Curve(p1, p2, v1, v2);
          break;
        case Function.LINEAR:
          func = new Linear(p1, p2);
          break;
        case Function.HALF_SINE:
          func = new HalfSine(p1, p2, v1);
          break;
        case Function.CONSTANT:
          func = new Constant(p1);
          break;

        default:
          return null;
      }

      float dx = p2.x - p1.x;
      float step;
      if (dx > 0) {
        step = 1 / dx;
      } else {
        step = 0;
      }

      return new Line(func, step);
    }
  private void calculateForces() {
    this.forces.clear();

    for (final Object object : this.particles.keySet()) {
      final Particle particle = this.particles.get(object);
      Vector totalForce = new Vector(0.0, 0.0);

      for (final Object otherObject : this.particles.keySet()) {
        if (otherObject != object) {
          final Particle otherParticle = this.particles.get(otherObject);
          final double attraction = this.attractionFunction.evaluate(particle, otherParticle);
          final Vector positionDifference = particle.position.subtract(otherParticle.position);
          final Vector force = positionDifference.setLength(attraction);
          totalForce = totalForce.add(force);
        }
      }

      this.forces.put(object, totalForce);
    }
  }
  private void parseCoordinatesLine() {
    StringTokenizer exBlock = new StringTokenizer(strData, " ");
    StringTokenizer numbers;
    String lat = new String();
    String lon = new String();

    String test = new String();

    while (exBlock.hasMoreTokens()) {
      test = exBlock.nextToken();
      // Vm.debug("==> " + test + " <==");
      numbers = new StringTokenizer(test, ",");
      // Vm.debug(numbers.nextToken());
      // Vm.debug(numbers.nextToken());
      lon = numbers.nextToken();
      lat = numbers.nextToken();
      point = new CWPoint(Convert.parseDouble(lat), Convert.parseDouble(lon));
      points.add(point);
    }
  }
  /**
   * Adds a position to be used a source.
   *
   * @param pos
   * @return
   */
  public void addSourcePosition(Vector pos) {
    int ox = pos.getBlockX();
    int oy = pos.getBlockY();
    int oz = pos.getBlockZ();

    for (int x = -3; x <= 3; x++) {
      for (int y = -3; y <= 3; y++) {
        for (int z = -3; z <= 3; z++) {
          Vector cur = pos.add(x, y, z);

          if (CraftBook.getBlockID(cur) == BlockType.CHEST) {
            ComplexBlock complexBlock = etc.getServer().getComplexBlock(ox + x, oy + y, oz + z);

            if (complexBlock instanceof Chest) {
              Chest chest = (Chest) complexBlock;
              Item[] itemArray = chest.getContents();
              boolean occupied = false;

              // Got to make sure that at least one slot is occupied
              for (int i = 0; itemArray.length > i; i++) {
                if (itemArray[i] != null) {
                  // Found an item
                  if (itemArray[i].getAmount() > 0) {
                    occupied = true;
                    break;
                  }
                }
              }

              if (occupied) {
                chests.add(new ComparableComplexBlock<Chest>(cur.toBlockVector(), chest));
              }
            }
          }
        }
      }
    }
  }
Exemple #27
0
  /** Clear the area. */
  public void clear(BlockBag bag) throws BlockSourceException {
    List<Vector> queued = new ArrayList<Vector>();

    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        for (int z = 0; z < length; z++) {
          Vector pt = origin.add(x, y, z);
          if (BlockType.shouldPlaceLast(CraftBook.getBlockID(pt))) {
            bag.setBlockID(pt, 0);
          } else {
            // Can't destroy these blocks yet
            queued.add(pt);
          }
        }
      }
    }

    for (Vector pt : queued) {
      bag.setBlockID(pt, 0);
    }

    bag.flushChanges();
  }
 /**
  * Make a cuboid from the center.
  *
  * @param origin the origin
  * @param apothem the apothem, where 0 is the minimum value to make a 1x1 cuboid
  * @return a cuboid region
  */
 public static CuboidRegion fromCenter(Vector origin, int apothem) {
   checkNotNull(origin);
   checkArgument(apothem >= 0, "apothem => 0 required");
   Vector size = new Vector(1, 1, 1).multiply(apothem);
   return new CuboidRegion(origin.subtract(size), origin.add(size));
 }
  @Override
  public void contract(Vector... changes) {
    checkNotNull(changes);

    for (Vector change : changes) {
      if (change.getX() < 0) {
        if (Math.max(pos1.getX(), pos2.getX()) == pos1.getX()) {
          pos1 = pos1.add(new Vector(change.getX(), 0, 0));
        } else {
          pos2 = pos2.add(new Vector(change.getX(), 0, 0));
        }
      } else {
        if (Math.min(pos1.getX(), pos2.getX()) == pos1.getX()) {
          pos1 = pos1.add(new Vector(change.getX(), 0, 0));
        } else {
          pos2 = pos2.add(new Vector(change.getX(), 0, 0));
        }
      }

      if (change.getY() < 0) {
        if (Math.max(pos1.getY(), pos2.getY()) == pos1.getY()) {
          pos1 = pos1.add(new Vector(0, change.getY(), 0));
        } else {
          pos2 = pos2.add(new Vector(0, change.getY(), 0));
        }
      } else {
        if (Math.min(pos1.getY(), pos2.getY()) == pos1.getY()) {
          pos1 = pos1.add(new Vector(0, change.getY(), 0));
        } else {
          pos2 = pos2.add(new Vector(0, change.getY(), 0));
        }
      }

      if (change.getZ() < 0) {
        if (Math.max(pos1.getZ(), pos2.getZ()) == pos1.getZ()) {
          pos1 = pos1.add(new Vector(0, 0, change.getZ()));
        } else {
          pos2 = pos2.add(new Vector(0, 0, change.getZ()));
        }
      } else {
        if (Math.min(pos1.getZ(), pos2.getZ()) == pos1.getZ()) {
          pos1 = pos1.add(new Vector(0, 0, change.getZ()));
        } else {
          pos2 = pos2.add(new Vector(0, 0, change.getZ()));
        }
      }
    }

    recalculate();
  }
 public void updateLocation() {
   velocity.add(acceleration);
   velocity.limit(limit);
   location.add(velocity);
 }