Package de.fhpotsdam.unfolding.texture

Source Code of de.fhpotsdam.unfolding.texture.RippleDistorter

package de.fhpotsdam.unfolding.texture;

import processing.core.PApplet;
import processing.core.PVector;

/**
* Distorts the z value of the coordinate based on the sinus value of x.
*/
public class RippleDistorter implements Distorter {

  @Override
  public void distort(PVector origCoord, PVector distCoord, int value) {
    distCoord.x = origCoord.x;
    distCoord.y = origCoord.y;

    PApplet p = PAppletFactory.getInstance();

    // Wave / Ripple
    distCoord.z = (float) Math.sin(distCoord.x * 1.1f) * 5f;
  }

TOP

Related Classes of de.fhpotsdam.unfolding.texture.RippleDistorter

TOP
Copyright © 2018 www.massapi.com. 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.