Package org.matheusdev

Examples of org.matheusdev.PosIterationCallback


      for (int j = 0; j < offsets.length; j++) {
        offsets[j] = Math.abs(rand.nextInt() % 174174);
      }

      vals.each(new PosIterationCallback() {
        @Override
        public void call(int[] pos) {
          for (int i = 0; i < newPos.length; i++) {
            newPos[i] = (pos[i] + offsets[i]) % vals.getDimensions()[i];
          }
View Full Code Here


  public SimplexNoiseLayerN gen() {
    final int[] dims = values.getDimensions();

    final SimplexNoiseLayerN that = this;

    each(new PosIterationCallback() {
      @Override
      public void call(int[] pos) {
        that.values.set(that.rand.nextBoolean() ? -1f : 1f, pos);
      }
    }, new int[dims.length], dims.length, 0, new int[dims.length], dims, density);

    // Defined here for pooling:
    final int[] nextPos = new int[dims.length];

    each(new PosIterationCallback() {
      @Override
      public void call(int[] pos) {
        // Increased next position (to interpolate with the current one):
        for (int ii = 0; ii < nextPos.length; ii++) {
          nextPos[ii] = (pos[ii] + density);
        }

        final int[][] edges = buildEdges(pos, nextPos);

        each(new PosIterationCallback() {
          @Override
          public void call(int[] pos) {
            that.values.set(
                interpolate(pos, edges, values, interpolator, dims.length-1),
                pos);
View Full Code Here

TOP

Related Classes of org.matheusdev.PosIterationCallback

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.