标签:scene art cross 地形 view ping cli cart nec
var points = [ Cesium.Cartesian3.fromDegrees(116.5,40.8), Cesium.Cartesian3.fromDegrees(116.9,40.8), Cesium.Cartesian3.fromDegrees(116.9,41.5) ]; var pointsLength = points.length; var clippingPlanes = []; // 存储ClippingPlane集合 for (var i = 0; i < pointsLength; ++i) { var nextIndex = (i + 1) % pointsLength; var midpoint = Cesium.Cartesian3.add(points[i], points[nextIndex], new Cesium.Cartesian3()); midpoint = Cesium.Cartesian3.multiplyByScalar(midpoint, 0.5, midpoint); var up = Cesium.Cartesian3.normalize(midpoint, new Cesium.Cartesian3()); var right = Cesium.Cartesian3.subtract(points[nextIndex], midpoint, new Cesium.Cartesian3()); right = Cesium.Cartesian3.normalize(right, right); var normal = Cesium.Cartesian3.cross(right, up, new Cesium.Cartesian3()); normal = Cesium.Cartesian3.normalize(normal, normal); var originCenteredPlane = new Cesium.Plane(normal, 0.0); var distance = Cesium.Plane.getPointDistance(originCenteredPlane, midpoint); clippingPlanes.push(new Cesium.ClippingPlane(normal, distance)); } viewer.scene.globe.clippingPlanes = new Cesium.ClippingPlaneCollection({ planes:clippingPlanes, edgeWidth: 1.0, edgeColor: Cesium.Color.YELLOW });
待解决
标签:scene art cross 地形 view ping cli cart nec
原文地址:https://www.cnblogs.com/pumpkin-123/p/12001716.html