Package org.earth3d.jearth.math

Examples of org.earth3d.jearth.math.Point2D


    return(mappos);
  }

  void gpsCoordinatesSlot() {
    /* view gps coordinates */
    Point2D worldcoord = getWorldCoordinates(contextPos.x, contextPos.y);

    System.out.println("GPS coordinates: "+(worldcoord.x*360-180)+" "+(-(worldcoord.y*180-90)));
  }
 
View Full Code Here


    System.out.println("GPS coordinates: "+(worldcoord.x*360-180)+" "+(-(worldcoord.y*180-90)));
  }

  void showMarkerSlot() {
    /* show an XML marker of the current position and copy it to the clipboard */
    Point2D v = getCurrentCoordinates();
    double x = v.x;
    double y = v.y;
    double z = nav.getViewer().length();
    Point3D dir = nav.getDirection();
    dir = nav.getEarthIntersection(dir, nav.getViewer());
View Full Code Here

    if (!done) {
      /* zoom to selected point */

      if (matrix_valid) {
        Point2D newcoordinates = getWorldCoordinates(e.getX(), e.getY());
        Point3D newcoordinates3D = sphere.getPoint(newcoordinates, 1.);
//        newcoordinates3D = nav.getViewer().add(newcoordinates3D.sub(nav.getViewer()).multiply(0.5));

        Point2D currentcoordinates = getCurrentCoordinates();
        Point2D destcoordinates = newcoordinates/*+currentcoordinates)*//*2.*/;

        moveToPosition(new Point3D(destcoordinates.x, destcoordinates.y, (nav.getViewer().length()-1)/2+1), new Point3D(0,0,0), nav.getUp(), false);
//        moveToCoordinate(newcoordinates3D, nav.getDirection(), nav.getUp(), false);
      }
    }
View Full Code Here

  protected double getDistance(Point3D p, Rect2D rect) {
    double surfacedistance = p.length()-Global.DRAWRADIUS-0.01; // distance is distance from surface
    if (surfacedistance<0.0000001) surfacedistance=0.0000001;

    /* get sphere coordinates */
    Point2D coord = gSphere.inverse(p);
    Point2D result2d = new Point2D(); // nearest point

//    printf("coord: %f, %f\n", coord.x, coord.y);

    /* get coordinate of nearest point in 2D grid */
    if (coord.x>rect.p.x && coord.x<rect.p.x+rect.size.x) {
View Full Code Here

    try {
      if (!userInteraction) { // do not change the geometry or load data while moving
        System.out.println("new geometry");
        /* start selecting the nodes */
        checkNode(currentNode, selectedNodes, viewer, virtualviewer, new Rect2D(new Point2D(0,0), new Point2D(1,1)), projmodelmatrix, modelview, 0, (float) distsurface, direction, windowSize);

      } else {
        // when the user moves the map, display the old geometry
        for(MapTileTreeNode node : wasSelectedNodes) {
          selectNode(node, selectedNodes, true);
View Full Code Here

//        gl.glTranslatef(hcore.vertexorigin.x, hcore.vertexorigin.y, hcore.vertexorigin.z);
//        gl.glScalef(hcore.vertexscale, hcore.vertexscale, hcore.vertexscale);
//        }

        Point3D vertexarray[] = hcore.vertexarray;
        Point2D texcoordarray[] = hcore.texcoordarray;

        float heightblendvalue = node.getInterpolationCounter();
        Point3D vertex[] = hcore.getInterpolationVertexArray(heightblendvalue); // vertexarray;
        int vertex_i = 0;
        Point2D texcoord[] = texcoordarray;
        int texcoord_i = 0;

        /* Initialize texture units */
        gl.glActiveTexture(GL.GL_TEXTURE0);
        gl.glClientActiveTexture(GL.GL_TEXTURE0);
        gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
        gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
        gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
        gl.glEnable(GL.GL_COLOR_MATERIAL);
        gl.glColor4f(1.f, 1.f, 1.f, 1.f);

        /* Set second texture only if the user wants multitexturing */
        if (Global.cacheUseMultiTexturing) {
          gl.glActiveTexture(GL.GL_TEXTURE1);
          gl.glClientActiveTexture(GL.GL_TEXTURE1);
          gl.glEnable(GL.GL_TEXTURE_2D);
          gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);

          Texture interpolationtextureID = null;
          try {
            interpolationtextureID = core.getInterpolationTextureID(gl);
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (interpolationtextureID == null) {
            blendvalue = 0;
          }
          else {
            gl.glColor4f(blendvalue, blendvalue, blendvalue, 1.f);
            gl.glEnable(GL.GL_TEXTURE_2D);
            interpolationtextureID.bind();
          }
        }
        else {
          blendvalue = 0;
        }


        for(int row=0; row<hcore.vertexcount/hcore.stripsize; row++) {
          gl.glActiveTexture(GL.GL_TEXTURE0);
          gl.glClientActiveTexture(GL.GL_TEXTURE0);
         
          DoubleBuffer db = hcore.getVertexDb();
          db.position(vertex_i*3);
          gl.glVertexPointer(3, GL.GL_DOUBLE, 0, db);
          gl.glNormalPointer(GL.GL_DOUBLE, 0, db);
         
          DoubleBuffer texDb = hcore.getTexDb();
          texDb.position(texcoord_i*2);
          gl.glTexCoordPointer(2, GL.GL_DOUBLE, 0, texDb);

          // TODO can be removed when texture blending is not used
          gl.glActiveTexture(GL.GL_TEXTURE1);
          gl.glClientActiveTexture(GL.GL_TEXTURE1);
          gl.glTexCoordPointer(2, GL.GL_DOUBLE, 0, texDb);

          gl.glActiveTexture(GL.GL_TEXTURE0);
          gl.glClientActiveTexture(GL.GL_TEXTURE0);

//          #ifdef LINE_MODE
//gl.glDrawArrays(GL.GL_LINE_STRIP, 0, hcore.stripsize);
//          #else
          if (Global.maptiledrawtype==0) {
            gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, hcore.stripsize);
          }
          else {
            if (Global.maptiledrawtype==1) {
              gl.glDrawArrays(GL.GL_LINE_STRIP, 0, hcore.stripsize);
            }
            else {
              gl.glBegin(GL.GL_LINE_STRIP);
              gl.glVertex3d(hcore.vertex[0].x, hcore.vertex[0].y, hcore.vertex[0].z);
              gl.glVertex3d(hcore.vertex[1].x, hcore.vertex[1].y, hcore.vertex[1].z);
              gl.glVertex3d(hcore.vertex[2].x, hcore.vertex[2].y, hcore.vertex[2].z);
              gl.glVertex3d(hcore.vertex[3].x, hcore.vertex[3].y, hcore.vertex[3].z);
              gl.glVertex3d(hcore.vertex[0].x, hcore.vertex[0].y, hcore.vertex[0].z);
              gl.glEnd();
            }
          }
//          #endif
          vertex_i+=hcore.stripsize;
          texcoord_i+=hcore.stripsize;
        }

        /* draw fans */
        for(int direction=0; direction<4; direction++) {
          Point3D fanvertexarray[] = hcore.fanvertexarray[direction];
          Point2D fantexcoordarray[] = hcore.fantexcoordarray[direction];
//          glColor3f(0.f, 1.f, 0.f);
//          glBindTexture(GL.GL_TEXTURE_2D, null);

          vertex = fanvertexarray;
          vertex_i = 0;
View Full Code Here

    TextureTreeNodeCore newTextureCore = new TextureTreeNodeCore(mtree);
    newTextureCore.setRequestID(((TextureTreeNodeCore)(currentNode.getCore(0))).getChildRequestID(childnr));

    /* Calculate angle rectangle of child node */
    newTextureCore.setVertex(0, getPointOnSphere(newNodeRect.p));
    newTextureCore.setVertex(1, getPointOnSphere(new Point2D(newNodeRect.p.x+newNodeRect.size.x, newNodeRect.p.y)));
    newTextureCore.setVertex(2, getPointOnSphere(new Point2D(newNodeRect.p.x+newNodeRect.size.x, newNodeRect.p.y+newNodeRect.size.y)));
    newTextureCore.setVertex(3, getPointOnSphere(new Point2D(newNodeRect.p.x, newNodeRect.p.y+newNodeRect.size.y)));

    /* generate data for core */
    TextureTreeNodeCore currentTextureCore = (TextureTreeNodeCore) currentNode.getCore(0);

    int newWidth, newHeight;
View Full Code Here

TOP

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

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.