Examples of PMatrix3D


Examples of processing.core.PMatrix3D

    this.transCenterX = centerX - offsetX;
    this.transCenterY = centerY - offsetY;
  }

  protected void calculateMatrix() {
    PMatrix3D invMatrix = new PMatrix3D();
    invMatrix.apply(matrix);
    invMatrix.invert();

    float originalCenterX = invMatrix.multX(transCenterX, transCenterY);
    float originalCenterY = invMatrix.multY(transCenterX, transCenterY);

    matrix = new PMatrix3D();
    matrix.translate(transCenterX, transCenterY);
    matrix.scale(scale);
    matrix.rotate(angle);
    matrix.translate(-originalCenterX, -originalCenterY);
  }
View Full Code Here

Examples of processing.core.PMatrix3D

  }
 
  PMatrix3D matrix = new PMatrix3D();
 
  public void doMatrix(float x, float y) {
    PMatrix3D invMatrix = new PMatrix3D();
    invMatrix.apply(matrix);
    invMatrix.invert();
    float oldX = invMatrix.multX(x, y);
    float oldY = invMatrix.multY(x, y);
   
    fill(255, 0, 0, 100);
    ellipse(oldX, oldY, 15, 15);

    matrix = new PMatrix3D();
    matrix.translate(x, y);
    matrix.rotate(angle);
    matrix.translate(-oldX, -oldY);
  }
View Full Code Here

Examples of processing.core.PMatrix3D

  protected void calculateMatrix(float x, float y) {
    // Calculates original position by inverting the current matrix.
    // As the matrix incorporates that position, it stores every transformation, even though
    // the matrix is created anew.

    PMatrix3D invMatrix = new PMatrix3D();
    invMatrix.apply(matrix);
    invMatrix.invert();
    float origX = invMatrix.multX(x, y);
    float origY = invMatrix.multY(x, y);

    matrix = new PMatrix3D();
    matrix.translate(x, y);
    matrix.scale(scale);
    matrix.rotate(angle);
    matrix.translate(-origX, -origY);
  }
View Full Code Here

Examples of processing.core.PMatrix3D

      info = addWindow(app);
      if(app.g.is2D())
        info.orgMatrix = new PMatrix2D();
      else
        info.orgMatrix =
          new PMatrix3D(
              1, 0, 0, -0.5f * app.width,
              0, 1, 0, -0.5f * app.height,
              0, 0, 1, -0.5f * app.height / (float)Math.tan(Math.PI / 6.0),
              0, 0, 0, 1
          );
View Full Code Here

Examples of processing.core.PMatrix3D

    this.frustum = new Frustum(pa);
    this.frustum.setCamDef(this.getPosition(), this.getViewCenterPos(),  xAxisUp, -yAxisUp, zAxisUp); //new Vector3D(xAxisUp, -yAxisUp, zAxisUp));
   
    this.p3d = ((PGraphics3D)pa.g);
    this.dirty = true;
    this.cameraMat       = new PMatrix3D();
    this.cameraInvMat     = new PMatrix3D();
    this.cameraMatrix     = new Matrix();
    this.cameraInvMatrix   = new Matrix();
  }
View Full Code Here

Examples of processing.core.PMatrix3D

//        projectionM.apply(modelView);
       
        //Ergebnis invertieren
//        PMatrix inv = projectionM.invert();
       
        PMatrix3D modelView   = new PMatrix3D(applet.g.getMatrix());
        PMatrix3D projectionM   = new PMatrix3D(((PGraphics3D)applet.g).projection);
       
        projectionM.apply(modelView);
        projectionM.invert();
       
        float[] result = new float[4];
        float[] factor = new float[]{  ((2 * testpoint.getX())  / applet.width-1,
                         ((2 * testpoint.getY())  / applet.height) -1, //screenH - y?
                        (2 * testpoint.getZ()) -1 ,
                         1,};
        //Matrix mit Vector multiplizieren
        projectionM.mult(factor, result);
       
        //System.out.println("\nResult2: ");
        for (int i = 0; i < result.length; i++) {
          //W auf 1 machen!?
          result[i] /= result[result.length-1]; //normalize so w(4th coord) is 1
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.