Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking of ellipsoids still not quite working. #4929

Closed
emackey opened this issue Jan 27, 2017 · 4 comments
Closed

Tracking of ellipsoids still not quite working. #4929

emackey opened this issue Jan 27, 2017 · 4 comments

Comments

@emackey
Copy link
Contributor

emackey commented Jan 27, 2017

Not sure if this is an incomplete fix for #4866, or something new. Check out this demo:

var czml = [
  {
    "id":"document",
    "version":"1.0",
    "clock":{
      "interval":"2016-09-01T00:00:00Z/2016-09-01T23:59:59.99Z",
      "currentTime":"2016-09-01T12:00:00Z",
      "multiplier":60,
      "range":"LOOP_STOP"
    }
  },
  {
    "id":"Test Object",
    "availability":"2016-09-01T00:00:00Z/2016-09-02T00:00:00Z",
    "name":"Test Object",
    "label":{
      "show":true,
      "text":"Test Object",
      "font":"bold 32px \"Droid Sans\",sans-serif",
      "style":"FILL_AND_OUTLINE",
      "scale":0.5,
      "pixelOffset":{
        "cartesian2":[
          5,0
        ]
      },
      "horizontalOrigin":"LEFT",
      "verticalOrigin":"CENTER",
      "fillColor":{
        "rgba":[
          255,255,0,255
        ]
      },
      "outlineColor":{
        "rgba":[
          0,0,0,255
        ]
      },
      "outlineWidth":2.4
    },
    "path":{
      "show":true,
      "width":2,
      "resolution":300,
      "leadTime":0,
      "trailTime":172800,
      "material":{
        "solidColor":{
          "color":{
            "rgba":[
              255,255,0,255
            ]
          }
        }
      }
    },
    "point":{
      "pixelSize":7,
      "color":{
        "rgba":[
          255,255,0,255
        ]
      }
    },
    "ellipsoid":{
      "radii":{
        "epoch":"2016-09-01T00:00:00Z",
        "cartesian":[
          0,279.0,632.0,17831.0,
          86400,283.0,653.0,21218.0
        ]
      },
      "material":{
        "grid":{
          "color":{
            "rgba":[
              255,255,0,255
            ]
          },
          "lineCount":{
            "cartesian2":[
              12,12
            ]
          }
        }
      }
    },
    "position":{
      "interpolationAlgorithm":"LAGRANGE",
      "interpolationDegree":5,
      "epoch":"2016-09-01T00:00:00Z",
      "cartesian":[
        0,41693056.0,-224455.0,-6354563.0,
        8640,42169152.0,-764133.0,-615413.0,
        17280,41814675.0,-1393089.0,5359758.0,
        25920,41119469.0,-1258304.0,9278534.0,
        34560,41040625.0,-560533.0,9635776.0,
        43200,41677063.0,-270318.0,6291754.0,
        51840,42135688.0,-779539.0,529501.0,
        60480,41775147.0,-1360532.0,-5436236.0,
        69120,41098752.0,-1184293.0,-9312281.0,
        77760,41054134.0,-480334.0,-9610528.0,
        86400,41713762.0,-222890.0,-6218657.0
      ]
    }
  }
];

var viewer = new Cesium.Viewer('cesiumContainer');
Cesium.CzmlDataSource.load(czml).then(function(dataSource) {
    viewer.dataSources.add(dataSource);
    viewer.selectedEntity = dataSource.entities.getById('Test Object');
    viewer.scene.camera.setView({
        destination: Cesium.Cartesian3.fromDegrees(-8, 0, 7.7e7)
    });
    viewer.clock.multiplier = 7200;
});
@emackey
Copy link
Contributor Author

emackey commented Jan 27, 2017

badboundingsphere_v5

@emackey
Copy link
Contributor Author

emackey commented Jan 30, 2017

The red sphere above is a bit of a red herring, the real problem is the selection indicator (and the trackedEntity camera, not shown above, but which completely agrees with the portrayed selection indicator) are not correct.

If it looks like the green crosshairs are hanging out at some kind of midpoint between the entity's position and its original position, you're correct, it's the midpoint.

What's happening here is that at load time, a new bounding sphere is created for the Ellipsoid graphics, just once, based on whatever currentTime happens to be when the primitive is constructed. After that, as time animates, only the modelMatrix changes on the ellipsoid (incorporating not just size changes, but deltas from the load position as well, apparently). The ellipsoid's bounding sphere was calculated and cached into an "attributes" cache, and it never changes.

Prior to the fix in #4907, dynamic graphics would recalculate their bounding sphere every frame, by pulling a copy of the cached attribute bounding sphere and transforming it by the current modelMatrix. But the fix removed this modelMatrix transform, and as a result the ellipsoid's bounding sphere is frozen in time, correct only for the time of construction of the ellipsoid.

At a higher level, Viewer is trying to figure out what to track or select, and asks the entity. The entity then enumerates its primitives, and combines their bounding spheres. In this case, the entity's point graphics are reporting their own bounding sphere, with the correct center point, and the ellipsoid graphics are reporting an out-dated bounding sphere, with an out-dated center point. The entity then combines these two bounding spheres, and finds a center point halfway between the current position and the out-dated position. This then becomes the selected/tracked location.

@hpinkos
Copy link
Contributor

hpinkos commented Feb 15, 2017

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 18, 2017

I labeled this next release; I don't think we'll be able to do it for 1.31, but we'll try for 1.32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants