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

How to use
sqrt
method
in
processing.core.PApplet

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

origin: poqudrof/PapARt

public float strength(int i, float[] re, float[] im) {
  return sqrt(re[i] * re[i] + im[i] * im[i]);
}
origin: org.processing/core

float ny = v12z * v10x - v10z * v12x;
float nz = v12x * v10y - v10x * v12y;
float d = PApplet.sqrt(nx * nx + ny * ny + nz * nz);
nx /= d;
ny /= d;
origin: org.processing/core

float ny = v12z * v10x - v10z * v12x;
float nz = v12x * v10y - v10x * v12y;
float d = PApplet.sqrt(nx * nx + ny * ny + nz * nz);
nx /= d;
ny /= d;
origin: ajavamind/Processing-Cardboard

float ny = v12z * v10x - v10z * v12x;
float nz = v12x * v10y - v10x * v12y;
float d = PApplet.sqrt(nx * nx + ny * ny + nz * nz);
nx /= d;
ny /= d;
origin: mirador/mirador

 private void calcPlotTimeCN(int time) {
  plotTimesCN.add(time);
  if (targetClockSize < plotTimesCN.size()) {
   plotTimesCN.remove(0);
  }
  clockUpdateCN++;
  if (clockUpdateCN == targetClockSize) {
   float meanTime = 0;
   synchronized (plotTimesCN) {
    Iterator i = plotTimesCN.iterator(); // Must be in synchronized block
    while (i.hasNext()) {
     int value = (Integer)i.next();
     meanTime += value;
    }
   }
   meanTime /= plotTimesCN.size();
   if (meanTime < 0.5 * project.maxPlotTime || project.maxPlotTime < meanTime) {
    float f = PApplet.min(PApplet.sqrt(project.maxPlotTime / meanTime), 2);
    maxPlotSliceSizeCN = PApplet.max((int)(maxPlotSliceSizeCN * f), 1000);
   }
   clockUpdateCN = 0;
  }
 }
}
origin: mirador/mirador

private void calcPlotTimeNN(int time) {
 plotTimesNN.add(time);
 if (targetClockSize < plotTimesNN.size()) {
  plotTimesNN.remove(0);
 }
 clockUpdateNN++;
 if (clockUpdateNN == targetClockSize) {
  float meanTime = 0;
  synchronized (plotTimesNN) {
   Iterator i = plotTimesNN.iterator(); // Must be in synchronized block
   while (i.hasNext()) {
    int value = (Integer)i.next();
    meanTime += value;
   }
  }
  meanTime /= plotTimesNN.size();
  if (meanTime < 0.5 * project.maxPlotTime || project.maxPlotTime < meanTime) {
   float f = PApplet.min(PApplet.sqrt(project.maxPlotTime / meanTime), 2);
   maxPlotSliceSizeNN = PApplet.max((int)(maxPlotSliceSizeNN * f), 1000);
  }
  clockUpdateNN = 0;
 }
}
origin: org.processing/core

/**
 * @nowebref
 */
 public void rotate(float angle, float v0, float v1, float v2) {
  checkMatrix(3);
  float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
  if (Math.abs(norm2 - 1) > EPSILON) {
   // The rotation vector is not normalized.
   float norm = PApplet.sqrt(norm2);
   v0 /= norm;
   v1 /= norm;
   v2 /= norm;
  }
  matrix.rotate(angle, v0, v1, v2);
 }

origin: mirador/mirador

private void calcPlotTimeCC(int time) {
 plotTimesCC.add(time);
 if (targetClockSize < plotTimesCC.size()) {
  plotTimesCC.remove(0);
 }
 clockUpdateCC++;
 if (clockUpdateCC == targetClockSize) {
  float meanTime = 0;
  synchronized (plotTimesCC) {
   Iterator i = plotTimesCC.iterator(); // Must be in synchronized block
   while (i.hasNext()) {
    int value = (Integer)i.next();
    meanTime += value;
   }
  }
  meanTime /= plotTimesCC.size();
  if (meanTime < 0.5 * project.maxPlotTime || project.maxPlotTime < meanTime) {
   float f = PApplet.min(PApplet.sqrt(project.maxPlotTime / meanTime), 2);
   maxPlotSliceSizeCC = PApplet.max((int)(maxPlotSliceSizeCC * f), 1000);
  }
  clockUpdateCC = 0;
 }
}
origin: ajavamind/Processing-Cardboard

/**
 * @nowebref
 */
 public void rotate(float angle, float v0, float v1, float v2) {
  checkMatrix(3);
  float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
  if (Math.abs(norm2 - 1) > EPSILON) {
   // The rotation vector is not normalized.
   float norm = PApplet.sqrt(norm2);
   v0 /= norm;
   v1 /= norm;
   v2 /= norm;
  }
  matrix.rotate(angle, v0, v1, v2);
 }

origin: org.processing/core

static public final float dist(float x1, float y1, float x2, float y2) {
 return sqrt(sq(x2-x1) + sq(y2-y1));
}
origin: ajavamind/Processing-Cardboard

static public final float dist(float x1, float y1, float x2, float y2) {
  return sqrt(sq(x2 - x1) + sq(y2 - y1));
}
origin: poqudrof/PapARt

/**
 * *
 * Get the Rotations, in the Unity3D format. [WARNING] Work in progress.
 * http://planning.cs.uiuc.edu/node103.html
 *
 * @param mat
 * @return
 */
public static PVector getRotations(PMatrix3D mat) {
  PVector r = new PVector();
  r.z = PApplet.atan(mat.m10 / mat.m00);
  r.y = PApplet.atan(-mat.m21 / PApplet.sqrt(mat.m21 * mat.m21 + mat.m22 * mat.m22));
  r.x = PApplet.atan(-mat.m21 / PApplet.sqrt(mat.m21 * mat.m21 + mat.m22 * mat.m22));
  return null;
}
origin: ajavamind/Processing-Cardboard

static public final float dist(float x1, float y1, float z1,
                float x2, float y2, float z2) {
  return sqrt(sq(x2 - x1) + sq(y2 - y1) + sq(z2 - z1));
}
origin: org.processing/core

public void rotate(float angle, float v0, float v1, float v2) {
 float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
 if (norm2 < PConstants.EPSILON) {
  // The vector is zero, cannot apply rotation.
  return;
 }
 if (Math.abs(norm2 - 1) > PConstants.EPSILON) {
  // The rotation vector is not normalized.
  float norm = PApplet.sqrt(norm2);
  v0 /= norm;
  v1 /= norm;
  v2 /= norm;
 }
 float c = cos(angle);
 float s = sin(angle);
 float t = 1.0f - c;
 apply((t*v0*v0) + c, (t*v0*v1) - (s*v2), (t*v0*v2) + (s*v1), 0,
    (t*v0*v1) + (s*v2), (t*v1*v1) + c, (t*v1*v2) - (s*v0), 0,
    (t*v0*v2) - (s*v1), (t*v1*v2) + (s*v0), (t*v2*v2) + c, 0,
    0, 0, 0, 1);
}
origin: ajavamind/Processing-Cardboard

public void rotate(float angle, float v0, float v1, float v2) {
 float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
 if (norm2 < PConstants.EPSILON) {
  // The vector is zero, cannot apply rotation.
  return;
 }
 if (Math.abs(norm2 - 1) > PConstants.EPSILON) {
  // The rotation vector is not normalized.
  float norm = PApplet.sqrt(norm2);
  v0 /= norm;
  v1 /= norm;
  v2 /= norm;
 }
 float c = cos(angle);
 float s = sin(angle);
 float t = 1.0f - c;
 apply((t*v0*v0) + c, (t*v0*v1) - (s*v2), (t*v0*v2) + (s*v1), 0,
    (t*v0*v1) + (s*v2), (t*v1*v1) + c, (t*v1*v2) - (s*v0), 0,
    (t*v0*v2) - (s*v1), (t*v1*v2) + (s*v0), (t*v2*v2) + c, 0,
    0, 0, 0, 1);
}
origin: org.processing/core

/**
  * ( begin auto-generated from dist.xml )
  *
  * Calculates the distance between two points.
  *
  * ( end auto-generated )
  * @webref math:calculation
  * @param x1 x-coordinate of the first point
  * @param y1 y-coordinate of the first point
  * @param z1 z-coordinate of the first point
  * @param x2 x-coordinate of the second point
  * @param y2 y-coordinate of the second point
  * @param z2 z-coordinate of the second point
  */
 static public final float dist(float x1, float y1, float z1,
                 float x2, float y2, float z2) {
  return sqrt(sq(x2-x1) + sq(y2-y1) + sq(z2-z1));
 }

origin: poqudrof/PapARt

public PVector createRayFrom(PVector pixels) {
  double[] out = device.undistort(pixels.x, pixels.y);
  float norm = PApplet.sqrt(PApplet.pow((float) out[0], 2)
      + PApplet.pow((float) out[1], 2)
      + 1.0f);
  PVector v = new PVector((float) out[0] / norm,
      (float) out[1] / norm,
      1.f / norm);
  return v;
}
origin: org.processing/core

protected void rotateImpl(float angle, float v0, float v1, float v2) {
 float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
 if (zero(norm2)) {
  // The vector is zero, cannot apply rotation.
  return;
 }
 if (diff(norm2, 1)) {
  // The rotation vector is not normalized.
  float norm = PApplet.sqrt(norm2);
  v0 /= norm;
  v1 /= norm;
  v2 /= norm;
 }
 modelview.rotate(angle, v0, v1, v2);
 invRotate(modelviewInv, angle, v0, v1, v2);
 updateProjmodelview(); // Possibly cheaper than doing projmodelview.rotate()
}
origin: ajavamind/Processing-Cardboard

protected void rotateImpl(float angle, float v0, float v1, float v2) {
 float norm2 = v0 * v0 + v1 * v1 + v2 * v2;
 if (zero(norm2)) {
  // The vector is zero, cannot apply rotation.
  return;
 }
 if (diff(norm2, 1)) {
  // The rotation vector is not normalized.
  float norm = PApplet.sqrt(norm2);
  v0 /= norm;
  v1 /= norm;
  v2 /= norm;
 }
 modelview.rotate(angle, v0, v1, v2);
 invRotate(modelviewInv, angle, v0, v1, v2);
 updateProjmodelview(); // Possibly cheaper than doing projmodelview.rotate()
}
origin: mirador/mirador

float scalex = PApplet.constrain(width / tw, 0.9f, 1.2f);
float scaley = PApplet.constrain(height / th, 0.8f, 1.0f);
float scalexy = PApplet.sqrt(scalex * scaley);
processing.corePAppletsqrt

Javadoc

( begin auto-generated from sqrt.xml ) Calculates the square root of a number. The square root of a number is always positive, even though there may be a valid negative root. The square root s of number a is such that s*s = a. It is the opposite of squaring. ( 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,
  • unhex,
  • arrayCopy,
  • ceil,
  • checkExtension

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • setScale (BigDecimal)
  • findViewById (Activity)
  • Menu (java.awt)
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for WebStorm
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