Class GestureMapping.DefaultMapping

java.lang.Object
net.paulhertz.pixelaudio.curves.GestureMapping.DefaultMapping
All Implemented Interfaces:
GestureMapping
Enclosing interface:
GestureMapping

public static final class GestureMapping.DefaultMapping extends Object implements GestureMapping
Default: interpret p as pixel coordinates and mappingSnapshot as width*height raster.
  • Field Details

    • width

      private final int width
    • height

      private final int height
  • Constructor Details

    • DefaultMapping

      public DefaultMapping(int width, int height)
  • Method Details

    • pointToSnapshotIndex

      public int pointToSnapshotIndex(processing.core.PVector p, int[] mappingSnapshot)
      Specified by:
      pointToSnapshotIndex in interface GestureMapping
      Parameters:
      p - gesture point (typically in pixel coordinates)
      mappingSnapshot - array of mapped buffer indices (immutable snapshot)
      Returns:
      an index into mappingSnapshot (NOT the sample value), or -1 if invalid
    • clamp

      private static int clamp(int v, int lo, int hi)