Announcement

Collapse
No announcement yet.

Understanding View Concepts

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • jjreilly
    started a topic Understanding View Concepts

    Understanding View Concepts

    I am not a graphics programmer. I have inherited a mess of an application that uses WW 2.1 for display and I'm struggling with the concepts.

    BasicOrbitView is being used to show a simulation involving satellites.

    I'm trying to understand:

    Center position: this is the center of the view? what is altitude 0? the surface of the Earth? so to do an Earth-centered view, i'd want to set the altitude to the Earth radius?

    Eye position: this is the place where my camera is located? and it always looks at the center position?

    BasicOrbitView: what is its purpose? it seems that it wants to look down from space onto a point on the Earth's surface. left-click the mouse chooses that point as the new center point, and so the eye position always wants to look there?

    heading, roll, pitch: what are they relative to? i mean, i only think of them in relation to an aircraft. i don't quite get what they mean to me in WW.

    thanks for any help. i read the code, but if i don't understand the concepts, the manipulations mean nothing to me. and tragically, i'm using a giant application with a lot of extra "stuff" (to be polite), so it is REALLY hard to experiment.

    -reilly.

  • price5583
    replied
    The basic idea is to resist the urge to directly set the camera's position, tilt, heading, etc. and instead define the geographical lat lon for the globe that you want in the center of the screen. Then define how far away, what heading, and at what tilt you want the camera to be.

    It's a bit funky to get used to at first, but I think the idea was to try to simplify the situation where you want to look at a placemark on the surface of the globe. You already have the lat lon of the placemark from the placemark itself, so that becomes your lookat location for your view, then all you have to do is define the heading, distance, and tilt and you're done. Which, is great in certain situations like that, but is a huge pain if you want to directly control the exact lat lon and alt of the camera itself.

    Here are two methods that should help a lot that work for WorldWind JAVA and should be very similar for the old C Sharp World Wind as well. We use these two methods as the core of a feature that lets the user save their current view as one of their favorite views, then later jump back to any of their favorite views.

    Note: in the following code we use getWWd() and that is simply getting the view from the WWPanel that World Wind sits in.

    //The following gets the user's current view
    BasicOrbitView bov = (BasicOrbitView) getWWd().getView(); //Gets the current view (Which is an Orbit View)(as opposed to a Fly View)
    Position centerPosition = bov.getCenterPosition(); //Gets the currently being viewed center position
    Angle heading = bov.getHeading(); //Gets the current view heading (i.e. the direction the user is currently facing)
    Angle pitch = bov.getPitch(); //Gets the current Pitch (i.e. the tilt angle the user is currently tilted at)
    double eyeToCenterPositionDistance = bov.getZoom(); //Gets the the current distance from the camera to the center position. The term Zoom is used as this value refers to the distance we have zoomed the camera out from the center location that we are looking at.


    //Those values can then later, when desired, be passed into the following method to set the view to go back to that exact view.


    /**
    * This method lets you move your view of the globe from your current position to the
    * position passed in. You also pass in a duration for how long it should take to
    * animate the camera from your current position to the new position specified.
    *
    * @param centerPosition - The position on the surface of the globe that you want the camera to look at. (In the center of the screen)
    * @param heading - The heading you want the camera to be facing
    * @param pitch - The tilt angle of the camera
    * @param eyeToCenterPositionDistance - The distance away to position the camera position from the center position (i.e. How far to move the camera from the location on the surface of the globe that the camera is looking directly at)
    * @param duration - The amount of time in milliseconds that you want it to take to animate from the current location to the location specified. Use 1 for near instantaneous.
    * @param endCenterOnSurface - Whether the center position should be clamped to the surface at the end of the animation.
    */
    public void moveToLocation(Position centerPosition, Angle heading, Angle pitch, double eyeToCenterPositionDistance, long duration, boolean endCenterOnSurface) //Changes the view to the values specified
    {
    BasicOrbitView bov = (BasicOrbitView) getWWd().getView(); //Grab's the view (Which is an Orbit View)(as opposed to a Fly View)

    if (bov != null)
    {
    ((OrbitViewInputHandler) bov.getViewInputHandler()).addPanToAnima tor(
    centerPosition,
    heading,
    pitch,
    eyeToCenterPositionDistance,
    duration,
    endCenterOnSurface);
    }//End of if

    }//End of the moveToLocation method
    Last edited by price5583; 05-06-2019, 07:39 PM.

    Leave a comment:

Working...
X