绘制圆柱钻孔,本来连续的为什么中间差很多

Cesium源码 · godlike · 于 4年前 发布 · 4370 次阅读

绘制圆柱钻孔,本来连续的为什么中间差很多呢?

共收到 2 条回复
godlike#14年前 0 个赞
Cesium.Math.setRandomNumberSeed(1234);

var viewer = new Cesium.Viewer('cesiumContainer', { infoBox : false });
var entities = viewer.entities;

var i;
var height;
var positions;
var stripeMaterial = new Cesium.StripeMaterialProperty({
    evenColor : Cesium.Color.WHITE.withAlpha(0.5),
    oddColor : Cesium.Color.BLUE.withAlpha(0.5),
    repeat : 5.0
});

entities.add({
    position : Cesium.Cartesian3.fromDegrees(116.472305, 35.416434, -965),
    cylinder : {      
            length: 200,
            topRadius: 10,
            bottomRadius: 10,
        material : Cesium.Color.fromRandom({alpha : 1.0})
    }
});

entities.add({
    position : Cesium.Cartesian3.fromDegrees(116.472305, 35.416434, -600),
    cylinder : {      
            length: 145,
            topRadius: 10,
            bottomRadius: 10,
        material : Cesium.Color.fromRandom({alpha : 1.0})
    }
});


entities.add({
    position : Cesium.Cartesian3.fromDegrees(116.472305, 35.416434, -455),
    cylinder : {      
            length: 155,
            topRadius: 10,
            bottomRadius: 10,
        material : Cesium.Color.fromRandom({alpha : 1.0})
    }
});


entities.add({
    position : Cesium.Cartesian3.fromDegrees(116.472305, 35.416434, -300),
    cylinder : {      
            length: 150,
            topRadius: 10,
            bottomRadius: 10,
        material : Cesium.Color.fromRandom({alpha : 1.0})
    }
});


entities.add({
    position : Cesium.Cartesian3.fromDegrees(116.472305, 35.416434, -150),
    cylinder : {      
            length: 185,
            topRadius: 10,
            bottomRadius: 10,
        material : Cesium.Color.fromRandom({alpha : 1.0})
    }
});


viewer.zoomTo(viewer.entities);

sogrey#24年前 1 个赞

你是看到了有断开的部分,其实你应该发现上面几个圆柱已经重合了。

拿第一段来说:

entities.add({
    position : Cesium.Cartesian3.fromDegrees(116.472305, 35.416434, -965),
    cylinder : {      
            length: 200,
            topRadius: 10,
            bottomRadius: 10,
        material : Cesium.Color.fromRandom({alpha : 1.0})
    }
});

高程为 -965,高度为 200,那么这段圆柱的最低点高程为 -965-200/2 = -1065;最高点高程为 -965+200/2 = -865;也就是说它是以 -965 为中心向两头延伸。

因此该这么计算

https://sogrey.top/Cesium-start-Example/examples/other/cylinders.html

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics