Package org.earth3d.jearth.math

Examples of org.earth3d.jearth.math.Point3D


  public void moveToPosition(Point3D mark, Point3D dir, Point3D up, boolean lowerquality) {
    targetMark = mark;
    targetDir = dir;
    targetUp = up;

    sourceMark = new Point3D(getViewer());

    Point2D sourceMark2D = gSphere.inverse(sourceMark);
    sourceMark.x = sourceMark2D.x;
    sourceMark.y = sourceMark2D.y;
    sourceMark.z = getViewer().length();
View Full Code Here


  {
    stopAutoNavigation();
    float RadianToDegree = 57.29578f;
    float EPSINON = 0.00001f;

    Point3D isect;
    isect = getEarthIsect();

    if (isect == new Point3D(0.0, 0.0, 0.0))
      return false;

    Point3D rotateAxes;
    rotateAxes = up.crossproduct(direction);
    rotateAxes = rotateAxes.normalize();

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

    float p, sinP;
    sinP = (float) (direction.skalarproduct(isect) / (direction.length()*isect.length()));
    if (sinP < -1.0)      sinP = -1.0f;
View Full Code Here

  {
    stopAutoNavigation();
    float RadianToDegree = 57.29578f;
    float EPSINON = 0.00001f;

    Point3D isect;
    isect = getEarthIsect();

    if (isect == new Point3D(0.0, 0.0, 0.0))
      return false;

    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();
View Full Code Here

   * Remarks:             This function is a little different from getEarthIntersection().
   */
  public Point3D getEarthIsect()
  {
    double w;
    Point3D isect;

    double a = direction.skalarproduct(direction);
    double b = 2*(direction.skalarproduct(viewer));
    double c = viewer.skalarproduct(viewer)-1;

    w = b*b - 4*a*c;

    if (w < 0)                    //no intersection
      return new Point3D(0.0, 0.0, 0.0);

    double a1 = -(viewer.skalarproduct(direction))+Math.sqrt(w);
    double a2 = -(viewer.skalarproduct(direction))-Math.sqrt(w);

    a1 = (-b+Math.sqrt(w))/(2*a);
    a2 = (-b-Math.sqrt(w))/(2*a);
    if (a1<0) a1=a2;
    if (a2<0) a2=a1;
    a=Math.min(a1,a2);
    isect = viewer.add(direction.multiply(a));
    isect = isect.normalize();
    return isect;
  }
View Full Code Here

    for(int nr=0; nr<4; nr++) child[nr]=null;
    cores[0]=null;
    cores[1]=null;

    bs.center = new Point3D(0,0,0);
    bs.radius = 100;

    childInterpolates = false;
    thisInterpolates = false;
    interpolationcounter = Global.INTERPOLATIONFRAMES;
View Full Code Here

  }

  public void generateBoundingSphere() {
    if (getCore(0) != null) {
      TextureTreeNodeCore texcore = (TextureTreeNodeCore) getCore(0);
      Point3D center = new Point3D();
      for(int i=0; i<4; i++) {
        center.add(texcore.getVertex(i));
      }
      center = center.divide(4);

      double radius=0, newradius;
      for(int i=0; i<4; i++) {
        newradius = texcore.getVertex(i).sub(center).length();
        if (newradius>radius) radius = newradius;
      }

      if (getCore(1) != null) {
        HeightfieldTreeNodeCore hcore = (HeightfieldTreeNodeCore) getCore(1);
        Point3D vertexarray[] = hcore.vertexarray;
        for(int i=0; i<hcore.vertexcount; i++) {
          newradius = (vertexarray[i].sub(center)).length();
          if (newradius>radius) radius = newradius;
        }
      }
View Full Code Here

    roll = 0;

    clippingPlanes[0]=10;
    clippingPlanes[1]=10;

    nav.setViewer(new Point3D(0,0,3));
    viewCulling = true;
    nav.setDirection(new Point3D(0,0,-1));

    threadStarted = false;
//    start();
    aspect = 1.f;
View Full Code Here

//    if (nav.viewer.length()<1.1) farplane = 0.5;
    if (nav.viewer.length()<1.1) farplane = 1.5f;
    glu.gluPerspective(45.0f,aspect,nearplane,farplane);
    //   gl.gluPerspective(45.0f,aspect,0.01f,10.0f);
    Point3D viewpoint = nav.getDirection().add(nav.viewer);
    glu.gluLookAt(nav.viewer.x, nav.viewer.y, nav.viewer.z, viewpoint.x, viewpoint.y, viewpoint.z, nav.getUp().x, nav.getUp().y, nav.getUp().z);
    //  gl.glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );

    gl.glEnable(GL.GL_DEPTH_TEST);
   
View Full Code Here

        glu.gluUnProject(omx, size().height-omy, depth1, modl, 0, proj, 0, viewport, 0, old_sd, 0);

        //     gl.gluUnProject(mx, size().height()-my, projplane, modl, proj, viewport, &sdx, &sdy, &sdz);
        glu.gluUnProject(mx, size().height-my, depth2, modl, 0, proj, 0, viewport, 0, sd, 0);

        Point3D oldmouse = new Point3D(old_sd[0], old_sd[1], old_sd[2]);
        Point3D newmouse = new Point3D(sd[0], sd[1], sd[2]);

        Point3D vector = newmouse.minus(oldmouse);
        //     float len = sqrt((omx-mx)*(omx-mx)+(omy-my)*(omy-my))*1./(2*M_PI*oldmouse.length());
        float len = (float)(vector.length()*360./(2*Math.PI*oldmouse.length()));
        Point3D norm_oldmouse = oldmouse.normalize();
        Point3D norm_newmouse = newmouse.normalize();


        float angle = (float) Math.acos(norm_oldmouse.skalarproduct(norm_newmouse));
        vector = vector.normalize();
        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);
View Full Code Here

    float depth1 = depthbuffer.get(dy*depthWidth+mx);
   
    double sd[] = new double[4];
    glu.gluUnProject(mx, dy, depth1, modl, 0, proj, 0, viewport, 0, sd, 0);

    Point3D point = new Point3D(sd[0], sd[1], sd[2]);
   
    return point;
  }
View Full Code Here

TOP

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

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.