Closed liyangis closed 4 years ago
Can you post a screenshot of what you're seeing? The outline seems to correct match here:
Also, for general questions like this please use the Cesium forum. We try to keep GitHub issues for specific bug reports or feature requests.
I test it used the sandcastle demo called Terrain Clipping Planes,and I add three polygons in the function called loadCesiumMan,I find that other added polygons will affect the green one. the function is appended like bellow: function loadCesiumMan() { var position = Cesium.Cartesian3.fromRadians(-2.0862979473351286, 0.6586620013036164, 1400.0);
var entity = viewer.entities.add({
position : position,
box : {
dimensions : new Cesium.Cartesian3(1400.0, 1400.0, 2800.0),
material : Cesium.Color.WHITE.withAlpha(0.3),
outline : true,
outlineColor : Cesium.Color.WHITE
}
});
viewer.entities.add({
position : position,
model : {
uri : '../SampleData/models/CesiumMan/Cesium_Man.glb',
minimumPixelSize : 128,
maximumScale : 800
}
});
var lon=Cesium.Math.toDegrees(-2.0862979473351286);
var lat=Cesium.Math.toDegrees(0.6586620013036164);
var polygon = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([lon-0.01, lat-0.01,
lon+0.01, lat-0.01,
lon+0.01, lat+0.01,
lon-0.01, lat+0.01]),
material : Cesium.Color.RED.withAlpha(0.5),
classificationType : Cesium.ClassificationType.BOTH,
height:2000,//
}
});
var polygon_1 = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([lon-0.001, lat-0.01,
lon+0.001, lat-0.01,
lon+0.001, lat+0.01,
lon-0.001, lat+0.01]),
material : Cesium.Color.YELLOW.withAlpha(0.9),
classificationType : Cesium.ClassificationType.BOTH,
height:2000,//
heightReference:Cesium.HeightReference.NONE,
extrudedHeight:0,
//extrudedHeightReference:Cesium.HeightReference.RELATIVE_TO_GROUND
}
});
var polygon1 = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([lon-0.01, lat-0.01,
lon+0.01, lat-0.01,
lon+0.01, lat+0.01,
lon-0.01, lat+0.01]),
material : Cesium.Color.RED.withAlpha(0.5),
classificationType : Cesium.ClassificationType.BOTH,
height:3000,//
}
});
var polygon2 = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([lon-0.01, lat-0.01,
lon-0.03, lat-0.01,
lon-0.03, lat+0.01,
lon-0.01, lat+0.01]),
material : Cesium.Color.GREEN.withAlpha(0.8),
classificationType : Cesium.ClassificationType.BOTH,
height:1500,
//heightReference:Cesium.HeightReference.RELATIVE_TO_GROUND,
extrudedHeight:0,
extrudedHeightReference:Cesium.HeightReference.RELATIVE_TO_GROUND ,
outline : true,
outlineColor : Cesium.Color.WHITE
}
});
globe.depthTestAgainstTerrain = true;
globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
modelMatrix : entity.computeModelMatrix(Cesium.JulianDate.now()),
planes : [
new Cesium.ClippingPlane(new Cesium.Cartesian3( 1.0, 0.0, 0.0), -700.0),
new Cesium.ClippingPlane(new Cesium.Cartesian3(-1.0, 0.0, 0.0), -700.0),
new Cesium.ClippingPlane(new Cesium.Cartesian3( 0.0, 1.0, 0.0), -700.0),
new Cesium.ClippingPlane(new Cesium.Cartesian3( 0.0, -1.0, 0.0), -700.0)
],
edgeWidth: edgeStylingEnabled ? 1.0 : 0.0,
edgeColor: Cesium.Color.WHITE,
enabled : clippingPlanesEnabled
});
viewer.trackedEntity = entity;
}
Other question is that when extrudedHeight:0, extrudedHeightReference:Cesium.HeightReference.RELATIVE_TO_GROUND the extended polygon 's height is not correct also.
var polygon_1 = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([lon-0.001, lat-0.01,
lon+0.001, lat-0.01,
lon+0.001, lat+0.01,
lon-0.001, lat+0.01]),
material : Cesium.Color.YELLOW.withAlpha(0.9),
classificationType : Cesium.ClassificationType.BOTH,
height:2000,//
heightReference:Cesium.HeightReference.NONE,
extrudedHeight:0,
extrudedHeightReference:Cesium.HeightReference.RELATIVE_TO_GROUND
}
});
Can you post a screenshot of what you're seeing? The outline seems to correct match here:
Also, for general questions like this please use the Cesium forum. We try to keep GitHub issues for specific bug reports or feature requests.
Thank you for you reply,but my screenshot is up,you can try it again.
hi, everybody! I have a question,I want to extrude a polygon ,but the outline is't match up whith the extruded polygon,the outline is bigger than the extruded polygon,my codes likes that bellow:
var viewer = new Cesium.Viewer('cesiumContainer', { skyAtmosphere: false, shouldAnimate : true, terrainProvider: Cesium.createWorldTerrain(), scene3DOnly: true }); var lon=Cesium.Math.toDegrees(-2.0862979473351286); var lat=Cesium.Math.toDegrees(0.6586620013036164); var polygon = viewer.entities.add({ polygon : { hierarchy : Cesium.Cartesian3.fromDegreesArray([lon-0.01, lat-0.01, lon-0.03, lat-0.01, lon-0.03, lat+0.01, lon-0.01, lat+0.01]), material : Cesium.Color.GREEN.withAlpha(0.8), classificationType : Cesium.ClassificationType.BOTH, height:2500, extrudedHeight: 5500, extrudedHeightReference:Cesium.HeightReference.RELATIVE_TO_GROUND, outline : true, outlineColor : Cesium.Color.WHITE } });
viewer.trackedEntity = polygon ;