Class ShapeMapper

java.lang.Object
spacefiller.shapemapper.ShapeMapper

public class ShapeMapper extends Object
Top level class for the Shape Mapper library. Allows configuration of mapped shapes and control over the Shape Mapper GUI.
  • Constructor Details

    • ShapeMapper

      public ShapeMapper(processing.core.PApplet parent)
      Initialize the library with no starting shape. Shapes can be subsequently added via addShape(PShape).
      Parameters:
      parent -
    • ShapeMapper

      public ShapeMapper(processing.core.PApplet parent, processing.core.PShape shape)
      Initialize the library with a single shape. The shape will have a single mapping automatically attached. If you want to create more than one mapping, use ShapeMapper(PApplet) followed by addShape(String, PShape, int).
      Parameters:
      parent -
      shape -
  • Method Details

    • addShape

      public MappedShape addShape(processing.core.PShape shape)
      Add the passed shape with the default name and attaching 1 mapping.
      Parameters:
      shape -
      Returns:
    • addShape

      public MappedShape addShape(String name, processing.core.PShape shape)
      Add the passed shape, assigning it the passed name, and attaching 1 mapping.
      Parameters:
      name -
      shape -
      Returns:
    • addShape

      public MappedShape addShape(String name, processing.core.PShape shape, int mappings)
      Add the passed shape, assigning it the passed name, and attaching the provided number of mappings. These mappings can then be calibrated at runtime.
      Parameters:
      name -
      shape -
      mappings -
      Returns:
    • getShape

      public MappedShape getShape(String name)
      Parameters:
      name -
      Returns:
      Shape with the passed name, if it exists.
    • clearCalibrations

      public void clearCalibrations()
      Clear all calibration data from memory and disk.
    • calibrateMode

      public void calibrateMode()
      Switch to calibration mode. Reveals the GUI and enabled key event listening.
    • renderMode

      public void renderMode()
      Switch to render mode. Disables GUI.
    • getShapes

      public Iterable<MappedShape> getShapes()
      Returns all the shapes currently managed by library.
      Returns:
    • hideGui

      public void hideGui()
      Hide the library GUI.
    • showGui

      public void showGui()
      Show the library GUI.
    • beginMapping

      public void beginMapping()
      Apply the estimated projection mapping. Any calls to Processing graphics functions after a call to beginMapping() will be transformed according to the projection mapping. Note that you must also call endMapping() after.

      This version of beginMapping() only works if you are mapping a single shape with a single projector. If you are mapping multiple shapes, then you must call MappedShape.beginMapping() on each mapped shape individually. If you are mapping with multiple projectors, you must call Mapping.beginMapping() on each mapping separately. See example code packaged with the library or how-to docs for examples.

    • endMapping

      public void endMapping()
      Stop applying the estimated projection mappping.