Tabnine Logo
PApplet.map
Code IndexAdd Tabnine to your IDE (free)

How to use
map
method
in
processing.core.PApplet

Best Java code snippets using processing.core.PApplet.map (Showing top 20 results out of 315)

origin: mirador/mirador

protected int mixColors(int col0, int col1, float f) {
 int a = (int)PApplet.map(f, 0, 1, col0 >> 24 & 0xFF, col1 >> 24 & 0xFF);
 int r = (int)PApplet.map(f, 0, 1, col0 >> 16 & 0xFF, col1 >> 16 & 0xFF);
 int g = (int)PApplet.map(f, 0, 1, col0 >>  8 & 0xFF, col1 >>  8 & 0xFF);
 int b = (int)PApplet.map(f, 0, 1, col0       & 0xFF, col1       & 0xFF);    
 return (a << 24) | (r << 16) | (g << 8) | b;
} 

origin: mirador/mirador

public void scale(float x0, float y0, float w0, float h0) {
 x = PApplet.map(x, 0, 1, x0, x0 + w0);
 y = PApplet.map(y, 0, 1, y0, y0 + h0);     
 w = PApplet.map(w, 0, 1, 0, w0);
 h = PApplet.map(h, 0, 1, 0, h0);
 
 if (x < x0) {
  h -= x0 - x;
  x = x0;        
 }
 if (x0 + w0 < x + w) w = x0 + w0 - x;
 
 if (y < y0) {
  h -= y0 - y;
  y = y0; 
 }
 if (y0 + h0 < y + h) h = y0 + h0 - y;      
}

origin: mirador/mirador

protected void initSelHandles() {
 float x0 = rightm;
 float x1 = x0 + width - leftm - rightm;
 float y0 = topm - 10;
 float y1 = y0 + height - bottomm - topm;
 
 float selx1 = PApplet.map(selRangeRight, 0, 1, x0, x1);
 selRightHandle = new SelectionHandle(selx1, y1 + handleY, handlew, handleh, SelectionHandle.RIGHT);
}
 
origin: mirador/mirador

public float itemPosition(int idx, float maxd) {
 int tot = colLabels.getTotItemsCount() - 1;
 float x1 = PApplet.map(idx, 0, tot, 0, maxd);
 return x1;
}
public float resize(float news) {
origin: mirador/mirador

public float itemPosition(int idx, float maxd) {
 int tot = rowBrowser.getChildrenCount() - 1;
 float x1 = PApplet.map(idx, 0, tot, 0, maxd);
 return x1;
}
public float resize(float news) {
origin: mirador/mirador

public float itemPosition(int idx, float maxd) {
 int tot = rowBrowser.getTotItemsCount() - 1;
 float y1 = PApplet.map(idx, 0, tot, 0, maxd);
 return y1;
}
public float resize(float news) {
origin: mirador/mirador

public float initPosition(float maxd) {
 int tot = rowBrowser.getChildrenCount() - 1;
 int idx = rowBrowser.current;
 float x0 = PApplet.map(idx, 0, tot, 0, maxd);
 return x0;
}
private void goTo(int idx) {
origin: mirador/mirador

 float y() {
  return PApplet.map(y.get(), 1, 0, topm + softPointY, height - bottomm - softPointY * 2);
 }    
}
origin: mirador/mirador

float x() {
 return PApplet.map(x.get(), 0, 1, rightm + softPointX, width - leftm - softPointX);
}

origin: mirador/mirador

public String getLabelX(double valx, double valy) {
 // We need to find which bin the value valx falls into, with the bin width
 // representing the probability of the bin
 float x0 = 0;
 for (int bx = 0; bx < binCountX; bx++) {
  float dx = marginalDensity[bx];
  if (x0 <= valx && valx <= x0 + dx) {
   float val0 = binSizeX * bx;
   float val1 = binSizeX * (bx + 1);
   float val = PApplet.map((float)(valx - x0) / dx, 0, 1, val0, val1);
   return varx.formatValue(val, ranges);
  }
  x0 += dx;
 }
 return ""; 
}

origin: mirador/mirador

 public float initPosition(float maxd) {
  int tot = colLabels.getTotItemsCount() - 1;
  int idx = colLabels.getFirstItemIndex();
  float x0 = PApplet.map(idx, 0, tot, 0, maxd);
  return x0;
 }
};
origin: mirador/mirador

 public float initPosition(float maxd) {
  int tot = rowBrowser.getTotItemsCount() - 1;
  int idx = rowBrowser.getFirstItemIndex();
  float y0 = PApplet.map(idx, 0, tot, 0, maxd);
  return y0;
 }
};
origin: mirador/mirador

public float press(float pos, float maxd) {
 float x1 = PApplet.constrain(pos, 0, maxd);
 int tot = rowBrowser.getChildrenCount() - 1;
 int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot));
 goTo(idx);
 return x1;
}
public int pressSlider(float pos, float size) {
origin: mirador/mirador

public float press(float pos, float maxd) {
 float x1 = PApplet.constrain(pos, 0, maxd);
 int tot = colLabels.getTotItemsCount() - 1;
 int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot));
 mira.browser.openColumn(idx);
 return x1;
}
public int pressSlider(float pos, float size) {
origin: mirador/mirador

public float drag(float newp, float maxd) {
 float x1 = PApplet.constrain(newp, 0, maxd);
 int tot = rowBrowser.getChildrenCount() - 1;
 int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot));
 goTo(idx);
 return x1;
}
public void stopDrag() {
origin: mirador/mirador

public float drag(float newp, float maxd) {
 float x1 = PApplet.constrain(newp, 0, maxd);
 int tot = colLabels.getTotItemsCount() - 1;
 int idx = PApplet.round(PApplet.map(x1, 0, maxd, 0, tot));
 mira.browser.openColumn(idx);
 return x1;
}
public void stopDrag() {
origin: mirador/mirador

public float press(float pos, float maxd) {
 float y1 = PApplet.constrain(pos, 0, maxd);
 int tot = rowBrowser.getTotItemsCount() - 1;
 int n = PApplet.round(PApplet.map(y1, 0, maxd, 0, tot - 1));
 RowScroller scroller = rowBrowser.getScroller();
 scroller.jumpTo(n);
 return y1;
}
public int pressSlider(float pos, float size) {
origin: mirador/mirador

protected void drawEikosogram(PGraphics pg) {
 pg.noStroke();
 float x0 = 0;
 for (int bx = 0; bx < binCountX; bx++) {
  float dx = pg.width * marginalDensity[bx];
  float y0 = pg.height;
  for (int by = 0; by < binCountY; by++) {
   float pxy = logY ? logDensity[bx][by] : density[bx][by];
   float dy = pg.width * pg.height * pxy / dx;    
   float f = PApplet.map(by, 0, binCountY - 1, 1, 0);
   pg.fill(mixColors(WHITE, COLOR, f));
   pg.rect(x0, y0, dx, -dy);
   y0 -= dy;
  }
  x0 += dx;
 }
}  

origin: mirador/mirador

public float drag(float newp, float maxd) {
 float y1 = PApplet.constrain(newp, 0, maxd);
 int tot = rowBrowser.getTotItemsCount() - 1;
 int n = PApplet.round(PApplet.map(y1, 0, maxd, 0, tot));
 RowScroller scroller = rowBrowser.getScroller();
 scroller.jumpTo(n);
 return y1;
}
public void stopDrag() {
origin: mirador/mirador

public void draw() {
 noStroke();
 fill(color(172, 210, 237), 240);
 rect(0, padding, width - padding, height - 2 * padding);
      float w = PApplet.map(data.sortProgress(), 0, 1, 0, width - padding);
 noStroke();
 fill(color(39, 141, 210));
 rect(0, padding, w, sortOptH); 
}

processing.corePAppletmap

Javadoc

Convenience function to map a variable from one coordinate space to another. Equivalent to unlerp() followed by lerp().

Popular methods of PApplet

  • constrain
  • createGraphics
    Create an offscreen graphics surface for drawing, in this case for a renderer that writes to a file
  • loadStrings
    ( begin auto-generated from loadStrings.xml ) Reads the contents of a file or url and creates a Stri
  • saveStrings
    ( begin auto-generated from saveStrings.xml ) Writes an array of strings to a file, one line per str
  • abs
  • createImage
    ( begin auto-generated from createImage.xml ) Creates a new PImage (the datatype for storing images)
  • createShape
  • createWriter
    ( begin auto-generated from createWriter.xml ) Creates a new file in the sketch folder, and a PrintW
  • loadImage
  • main
    main() method for running this class from the command line. Usage: PApplet [options] [s
  • max
  • parseInt
  • max,
  • parseInt,
  • random,
  • round,
  • split,
  • sqrt,
  • unhex,
  • arrayCopy,
  • ceil,
  • checkExtension

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • BoxLayout (javax.swing)
  • Join (org.hibernate.mapping)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now