Package org.earth3d.jearth.math

Examples of org.earth3d.jearth.math.Quaternion


  void rotate(float angle) {
    stopAutoNavigation();

    /* rotate the up vector around the direction vector */
    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    quat.createFromAxisAngle((float) direction.x, (float) direction.y, (float) direction.z, angle);
    quat.createMatrix(matrix);
    Matrix mMatrix = new Matrix(matrix);
   
    up = mMatrix.multvector(up);
  }
View Full Code Here


  void rotateLeftRight(float angle) {
    stopAutoNavigation();

    /* rotate the direction vector around the up vector */
    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    quat.createFromAxisAngle((float) up.x, (float) up.y, (float) up.z, angle);
    quat.createMatrix(matrix);
    Matrix mMatrix = new Matrix(matrix);
   
    direction = mMatrix.multvector(direction);
  }
View Full Code Here

  void rotateOnSurface(float angle) {
    stopAutoNavigation();

    /* rotate the direction vector around the up vector */
    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    Point3D viewnorm = viewer.normalize();

    quat.createFromAxisAngle((float) viewnorm.x, (float) viewnorm.y, (float) viewnorm.z, angle);
    quat.createMatrix(matrix);
    Matrix mMatrix = new Matrix(matrix);
   
    direction = mMatrix.multvector(direction);
    up = mMatrix.multvector(up);
  }
View Full Code Here

   
    Point3D upxdir = up.DotP3D(direction);
    upxdir = upxdir.normalize();

    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    quat.createFromAxisAngle((float) upxdir.x, (float) upxdir.y, (float) upxdir.z, angle);
    quat.createMatrix(matrix);
   
    Matrix mMatrix = new Matrix(matrix);
    direction = mMatrix.multvector(direction);
    up = mMatrix.multvector(up);
  }
View Full Code Here

  }

  void strafe(float factor) {
    /* rotate the direction by 90 degrees */
    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    Point3D norm = viewer.normalize();

    quat.createFromAxisAngle((float) norm.x, (float) norm.y, (float) norm.z, 90);
    quat.createMatrix(matrix);
   
    Matrix mMatrix = new Matrix(matrix);
    Point3D strafedirection = mMatrix.multvector(direction);

    viewer = viewer.add(strafedirection.multiply(factor).multiply(viewer.length()-1));
View Full Code Here

    double alpha = Math.acos(viewer.normalize().skalarproduct(v1n));

    Point3D r = (v2.minus(v1)).crossproduct(v2);

    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    Point3D norm = r.normalize();

    quat.createFromAxisAngle((float) norm.x, (float) norm.y, (float) norm.z, (float) alpha);
    quat.createMatrix(matrix);
   
    Matrix mMatrix = new Matrix(matrix);
    direction = mMatrix.multvector(direction);
    up = mMatrix.multvector(up);
  }
View Full Code Here

    Point3D v1n = v1.normalize();
    double alpha = Math.acos(viewer.normalize().skalarproduct(v1n));
    Point3D r = (v2.minus(v1)).crossproduct(v2);

    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    Point3D norm = r.normalize();

    quat.createFromAxisAngle((float) norm.x, (float) norm.y, (float) norm.z, (float) alpha);
    quat.createMatrix(matrix);

    Matrix mMatrix = new Matrix(matrix);
    direction = mMatrix.multvector(direction);
    up = mMatrix.multvector(up);
  }
View Full Code Here

    if (p+angle < -90.0angle = -90.0f - p;


    /* rotate the direct vector and up vector around the rotateAxes vector */
    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    quat.createFromAxisAngle((float) rotateAxes.x, (float) rotateAxes.y, (float) rotateAxes.z, angle);
    quat.createMatrix(matrix);
   
    Matrix mMatrix = new Matrix(matrix);
    direction = mMatrix.multvector(direction);
    up = mMatrix.multvector(up);
    dirToIsect = mMatrix.multvector(dirToIsect);
View Full Code Here

    Point3D dirToIsect;
    dirToIsect = isect.sub(viewer);

    /* rotate the direct vector and up vector around the isect vector */
    float matrix[] = new float[16];
    Quaternion quat = new Quaternion();
    quat.createFromAxisAngle((float) isect.x, (float) isect.y, (float) isect.z, angle);
    quat.createMatrix(matrix);
   
    Matrix mMatrix = new Matrix(matrix);
   
    direction = mMatrix.multvector(direction);
    up = mMatrix.multvector(up);
View Full Code Here

        Point3D axis = norm_oldmouse.crossproduct(norm_newmouse);
        axis = axis.normalize();

        //     axis = Point3D(0,1,0);
        float matrix[] = new float[16];
        Quaternion quat = new Quaternion();
        quat.createFromAxisAngle((float) axis.x, (float) axis.y, (float) axis.z, len);
        quat.createMatrix(matrix);

        nav.stopAutoNavigation();

        Matrix mMatrix = new Matrix(matrix);
View Full Code Here

TOP

Related Classes of org.earth3d.jearth.math.Quaternion

Copyright © 2018 www.massapicom. 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.