Android Open Source - MakeWithMotoSampleApp Canvas Utils






From Project

Back to project page MakeWithMotoSampleApp.

License

The source code is released under:

GNU General Public License

If you think the Android project MakeWithMotoSampleApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.makewithmoto.views;
/*from   ww  w .  j  a  va2 s.c  o m*/
/*
 * Taken from processing.org source code 
 * 
 */

public class CanvasUtils {

  static public final float lerp(float start, float stop, float amt) {
    return start + (stop - start) * amt;
  }

  /**
   * Normalize a value to exist between 0 and 1 (inclusive). Mathematically
   * the opposite of lerp(), figures out what proportion a particular value is
   * relative to start and stop coordinates.
   */
  static public final float norm(float value, float start, float stop) {
    return (value - start) / (stop - start);
  }

  /**
   * Convenience function to map a variable from one coordinate space to
   * another. Equivalent to unlerp() followed by lerp().
   */
  static public final float map(float value, float istart, float istop, float ostart, float ostop) {
    return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
  }


}




Java Source Code List

android_serialport_api.SerialPort.java
com.makewithmoto.boards.MAKr.java
com.makewithmoto.boards.MIOIOListener.java
com.makewithmoto.bt.BluetoothSerialService.java
com.makewithmoto.bt.BluetoothViewer.java
com.makewithmoto.bt.DeviceListActivity.java
com.makewithmoto.bt.SimpleBT.java
com.makewithmoto.example.ActivityBT.java
com.makewithmoto.example.ActivityMAKr.java
com.makewithmoto.example.ActivityMOIO.java
com.makewithmoto.example.Application.java
com.makewithmoto.example.LauncherActivity.java
com.makewithmoto.extras.AccelerometerManager.java
com.makewithmoto.extras.CustomSensorListener.java
com.makewithmoto.extras.CustomSensorManager.java
com.makewithmoto.extras.WhatIsRunningInterface.java
com.makewithmoto.extras.WhatIsRunning.java
com.makewithmoto.fragments.CameraFragment.java
com.makewithmoto.fragments.DebugFragment.java
com.makewithmoto.fragments.EmptyFragment.java
com.makewithmoto.fragments.GraphFragment.java
com.makewithmoto.fragments.ImageFragment.java
com.makewithmoto.fragments.Utils.java
com.makewithmoto.fragments.VideoPlayerFragment.java
com.makewithmoto.fragments.VideoTextureFragment.java
com.makewithmoto.views.CanvasUtils.java
com.makewithmoto.views.PlotView.java