-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Comments
@bmckilligan I don't think a vertical polygon is officially supported. Our PolygonGeometry is really meant for drawing polygons on the ellipsoid surface. @bagnell? |
@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. |
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 |
-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));
The text was updated successfully, but these errors were encountered: