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

How to use
atan2
method
in
processing.core.PApplet

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

origin: poqudrof/PapARt

/**
 * Return the x,y positions of a 3D location projected onto a given
 * reference. The Z axis is the angle (in radians) given by the rotation of
 * the positionToFind.
 *
 * @param positionToFind
 * @param reference
 * @return
 */
public PVector projectPositionTo2D(PMatrix3D positionToFind,
    PMatrix3D reference,
    float referenceHeight) {
  PMatrix3D referenceInv = reference.get();
  referenceInv.invert();
  PMatrix3D relative = positionToFind.get();
  relative.preApply(referenceInv);
  PMatrix3D positionToFind2 = positionToFind.get();
  positionToFind2.translate(100, 0, 0);
  PMatrix3D relative2 = positionToFind2.get();
  relative2.preApply(referenceInv);
  PVector out = new PVector();
  float x = relative.m03 - relative2.m03;
  float y = relative.m13 - relative2.m13;
  out.z = PApplet.atan2(x, y);
  out.x = relative.m03;
  out.y = referenceHeight - relative.m13;
  return out;
}
origin: poqudrof/PapARt

/**
 * Return the x,y positions of a 3D location projected onto a given
 * reference. The Z axis is the angle (in radians) given by the rotation of
 * the positionToFind.
 *
 * @param positionToFind
 * @param reference
 * @return
 */
public PVector projectPositionTo(PMatrix3D positionToFind,
    PaperScreen reference) {
  PMatrix3D referenceInv = reference.getLocation().get();
  referenceInv.invert();
  PMatrix3D relative = positionToFind.get();
  relative.preApply(referenceInv);
  PMatrix3D positionToFind2 = positionToFind.get();
  positionToFind2.translate(100, 0, 0);
  PMatrix3D relative2 = positionToFind2.get();
  relative2.preApply(referenceInv);
  PVector out = new PVector();
  float x = relative.m03 - relative2.m03;
  float y = relative.m13 - relative2.m13;
  out.z = PApplet.atan2(x, y);
  out.x = relative.m03;
  out.y = reference.drawingSize.y - relative.m13;
  return out;
}
origin: poqudrof/PapARt

  public void drawOnTable() {
    if (!isDrawingOnDisplay) {
      return;
    }

//        PMatrix3D location = this.getLocation().get();
//        PMatrix3D t = tableInv.get();
//        t.apply(location);
//        PVector tableRelativePos = new PVector(t.m03, t.m13, t.m23);
    PVector p2 = getRelativePos(new PVector(20, 20, 0));
    PVector tableRelativePos = getRelativePos(new PVector(0, 0, 0));

    float r = PApplet.atan2(p2.y - tableRelativePos.y, p2.x - tableRelativePos.x);

    PMatrix3D locationInv = this.getLocation().get();
    locationInv.invert();
    currentGraphics.scale(1, -1, 1);
    currentGraphics.translate(0, -getSize().y, 0);
    currentGraphics.applyMatrix(locationInv);
    currentGraphics.applyMatrix(table);
    currentGraphics.translate(tableRelativePos.x, tableRelativePos.y);
    currentGraphics.rotate(r);
    currentGraphics.scale(1, -1, 1);
  }

origin: org.processing/core

phi1 = PApplet.atan2(sy, sx);
phiDelta = (((PApplet.atan2(ty, tx) - phi1) % TWO_PI) + TWO_PI) % TWO_PI;
if (!fs) phiDelta -= TWO_PI;
processing.corePAppletatan2

Javadoc

( begin auto-generated from atan2.xml ) Calculates the angle (in radians) from a specified point to the coordinate origin as measured from the positive x-axis. Values are returned as a float in the range from PI to -PI. The atan2() function is most often used for orienting geometry to the position of the cursor. Note: The y-coordinate of the point is the first parameter and the x-coordinate is the second due the the structure of calculating the tangent. ( 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

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • JList (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • 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