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

How to use
dist
method
in
processing.core.PApplet

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

origin: ajavamind/Processing-Cardboard

protected void lightNormal(int num, float dx, float dy, float dz) {
 // Applying normal matrix to the light direction vector, which is the
 // transpose of the inverse of the modelview.
 float nx =
  dx*modelviewInv.m00 + dy*modelviewInv.m10 + dz*modelviewInv.m20;
 float ny =
  dx*modelviewInv.m01 + dy*modelviewInv.m11 + dz*modelviewInv.m21;
 float nz =
  dx*modelviewInv.m02 + dy*modelviewInv.m12 + dz*modelviewInv.m22;
 float d = PApplet.dist(0, 0, 0, nx, ny, nz);
 if (0 < d) {
  float invn = 1.0f / d;
  lightNormal[3 * num + 0] = invn * nx;
  lightNormal[3 * num + 1] = invn * ny;
  lightNormal[3 * num + 2] = invn * nz;
 } else {
  lightNormal[3 * num + 0] = 0;
  lightNormal[3 * num + 1] = 0;
  lightNormal[3 * num + 2] = 0;
 }
}
origin: org.processing/core

protected void lightNormal(int num, float dx, float dy, float dz) {
 // Applying normal matrix to the light direction vector, which is the
 // transpose of the inverse of the modelview.
 float nx =
  dx*modelviewInv.m00 + dy*modelviewInv.m10 + dz*modelviewInv.m20;
 float ny =
  dx*modelviewInv.m01 + dy*modelviewInv.m11 + dz*modelviewInv.m21;
 float nz =
  dx*modelviewInv.m02 + dy*modelviewInv.m12 + dz*modelviewInv.m22;
 float d = PApplet.dist(0, 0, 0, nx, ny, nz);
 if (0 < d) {
  float invn = 1.0f / d;
  lightNormal[3 * num + 0] = invn * nx;
  lightNormal[3 * num + 1] = invn * ny;
  lightNormal[3 * num + 2] = invn * nz;
 } else {
  lightNormal[3 * num + 0] = 0;
  lightNormal[3 * num + 1] = 0;
  lightNormal[3 * num + 2] = 0;
 }
}
origin: mirador/mirador

public void mouseMoved() {
 hoverVar = null;
 for (Variable var: points.keySet()) {
  SoftPoint pt = points.get(var);
  if (pt == null) continue;
  if (PApplet.dist(pt.x(), pt.y(), mouseX, mouseY) < 15) {
   hoverVar = var;
   hoverAlpha.setTarget(100);
   break;
  }
 }
 if (hoverVar == null) hoverAlpha.set(255);
}
origin: mirador/mirador

public Selection getSelection(double valx, double valy, boolean shift) {
 if (canDraw()) {
  if (points.size() < 500) {
   int count = PApplet.min(500, points.size());
   float rad = PApplet.map(count, 0, 500, 0.05f, 0.01f);
   for (Value2D pt : points) {
    float px = (float) pt.x;
    float py = 1 - (float) (pt.y);
    if (PApplet.dist((float) valx, (float) valy, px, py) < rad) {
     Selection sel = new Selection(px, py, rad, rad);
     sel.isEllipse = true;
     sel.setLabel(pt.label);
     return sel;
    }
   }
   return null;
  } else {
   // TODO: needs some kind of tree representation of the data to search
   // efficiently when there are many data points.
   return null;
  }
 } else {
  return getUnavailableSelection();
 }
}
origin: org.processing/core

int span = (int) PApplet.dist(tx1, ty1, tx2, ty2) * ACCURACY;
if (span <= 0) {
origin: org.processing/core

for (int j = 0; j < h; j++) {
 for (int i = 0; i < w; i++) {
  float distance = PApplet.dist(cx, cy, x + i, y + j);
  int which = PApplet.min((int) (distance * ACCURACY), interp.length-1);
origin: org.processing/core

if (0 < PApplet.dist(vert[PGraphics.NX],
           vert[PGraphics.NY],
           vert[PGraphics.NZ], 0, 0, 0)) {
origin: ajavamind/Processing-Cardboard

if (0 < PApplet.dist(vert[PGraphics.NX],
           vert[PGraphics.NY],
           vert[PGraphics.NZ], 0, 0, 0)) {
origin: ajavamind/Processing-Cardboard

       (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) /
       POINT_ACCURACY_FACTOR)));
float inc = (float) SINCOS_LENGTH / accuracy;
origin: org.processing/core

       (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) /
       POINT_ACCURACY_FACTOR)));
float inc = (float) SINCOS_LENGTH / accuracy;
origin: ajavamind/Processing-Cardboard

       (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) /
       POINT_ACCURACY_FACTOR)));
inc = PApplet.max(1, SINCOS_LENGTH / accuracy);
origin: org.processing/core

       (int) (TWO_PI * PApplet.dist(sx1, sy1, sx2, sy2) /
       POINT_ACCURACY_FACTOR)));
inc = PApplet.max(1, SINCOS_LENGTH / accuracy);
processing.corePAppletdist

Javadoc

( begin auto-generated from dist.xml ) Calculates the distance between two points. ( end auto-generated )

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
  • getSupportFragmentManager (FragmentActivity)
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • BoxLayout (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Best IntelliJ 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