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

Small Wall or Verticle Polygon not rendering properly #2897

Closed
bmckilligan opened this issue Jul 22, 2015 · 3 comments
Closed

Small Wall or Verticle Polygon not rendering properly #2897

bmckilligan opened this issue Jul 22, 2015 · 3 comments

Comments

@bmckilligan
Copy link

-using PolygonGeomety, if the shape is too short in the vertical height, it renders as a triangle
-using WallGeometry, if the shape is too short in the horizontal direction, it won't render

sandcastle example:


var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;

var instances = [],
dLong = -0.00001,
dLat = 0.00000001 ,
longitude =-122.95287197,
latitude = 49.16011209,
polyLength = 6,
startElevation = 5,
elevationFrom_m = 5,
elevationTo_m,
deltaElevation = 0,
i = 1,
polyPositions = [],
primitives;

for ( i = 1; i <= 30; i++) {
deltaElevation = 0.05 * i;

elevationTo_m = elevationFrom_m + deltaElevation;

polyPositions = [ Cesium.Cartesian3.fromDegrees(longitude + 0 * polyLength * dLong, latitude + 0 * polyLength * dLat, elevationFrom_m),
Cesium.Cartesian3.fromDegrees(longitude - 1 * polyLength * dLong, latitude - 1 * polyLength * dLat, elevationFrom_m),
Cesium.Cartesian3.fromDegrees(longitude - 1 * polyLength * dLong, latitude - 1 * polyLength * dLat, elevationTo_m),
Cesium.Cartesian3.fromDegrees(longitude + 0 * polyLength * dLong, latitude + 0 * polyLength * dLat, elevationTo_m)];

instances.push( new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry.fromPositions({
positions: polyPositions,
perPositionHeight: true,
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromRandom({alpha : 1}))
}
}) );

instances.push( new Cesium.GeometryInstance({
geometry: new Cesium.WallGeometry({
positions: [
Cesium.Cartesian3.fromDegrees(longitude, latitude),
Cesium.Cartesian3.fromDegrees(longitude + polyLength * dLong, latitude + polyLength * dLat)],
maximumHeights: [elevationTo_m,elevationTo_m],
minimumHeights: [elevationFrom_m,elevationFrom_m],
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromRandom({alpha : 1}))
}
}) );
elevationFrom_m = elevationTo_m;
polyLength = polyLength - 0.1;
}

scene.primitives.add( new Cesium.Primitive({
geometryInstances: instances,
appearance: new Cesium.PerInstanceColorAppearance({ flat: true }),
show: true
}));

var center = Cesium.Cartesian3.fromDegrees(longitude, latitude , startElevation),
heading = Cesium.Math.toRadians(0),
pitch = Cesium.Math.toRadians(-20.0),
range = 40.0;

viewer.camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));

@hpinkos
Copy link
Contributor

hpinkos commented Jul 22, 2015

@bmckilligan I don't think a vertical polygon is officially supported. Our PolygonGeometry is really meant for drawing polygons on the ellipsoid surface. @bagnell?
For the wall geometry, I believe we just have to change a threshold value somewhere. I'll take a look at it.
Thanks for reporting this!

@bagnell
Copy link
Contributor

bagnell commented Jul 24, 2015

@hpinkos is right. Cesium only supports polygons that conform to the surface of an ellipsoid. For a vertical polygon you would need to create a custom geometry. The issue with the walls has been fixed and will be in the 1.12 release.

@bagnell bagnell closed this as completed Jul 24, 2015
@bmckilligan
Copy link
Author

I have had pretty good results with polygons defined in the vertical plane so far.

Complex geometries with several thousand points have had some some issues , the attached image is a visualization of soil/mud data in a pond with depth %Solids and %water on the left, and some other material properties measured on the right

capture

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

No branches or pull requests

3 participants