SuperMap iClient3D for WebGL教程-CylinderGraphics

CylinderGraphics翻譯過來就是圓柱對象,只是這個圓柱對象比較特別,可分別指定上下圓柱面的半徑,從而可以衍生出圓錐和圓臺對象,下面小編就來講解下CylinderGraphics如何使用。
首先還是老規(guī)矩,先看下對象的所有屬性。


CylinderGraphics屬性

這里小編對幾個比較特別的屬性進(jìn)行講解
length:圓柱的長度,也就是圓柱的上下圓面間的空間距離
topRadius:上圓面半徑
bottomRadius:下圓面半徑
numberOfVerticalLines:邊框豎線數(shù)量
slices:上下圓面切邊數(shù)量
下面小編分別設(shè)置上下圓面的大小來實現(xiàn)圓柱、圓臺、圓錐

//圓柱
var greenCylinder = viewer.entities.add({
    name : 'Green cylinder with black outline',
    position: Cesium.Cartesian3.fromDegrees(-100.0, 40.0, 200000.0),
    cylinder : {
        length : 400000.0,
        topRadius : 200000.0,
        bottomRadius : 200000.0,
        material : Cesium.Color.GREEN.withAlpha(0.5),
        outline : true,
        outlineColor : Cesium.Color.DARK_GREEN
    }
});
//圓臺
var blueCylinder = viewer.entities.add({
    name : 'Green cylinder with black outline',
    position: Cesium.Cartesian3.fromDegrees(-110.0, 40.0, 200000.0),
    cylinder : {
        length : 400000.0,
        topRadius : 100000.0,
        bottomRadius : 200000.0,
        material : Cesium.Color.BLUE.withAlpha(0.5),
        outline : true,
        outlineColor : Cesium.Color.DARK_GREEN
    }
});
//圓錐
var redCone = viewer.entities.add({
    name : 'Red cone',
    position: Cesium.Cartesian3.fromDegrees(-105.0, 40.0, 200000.0),
    cylinder : {
        length : 400000.0,
        topRadius : 0.0,
        bottomRadius : 200000.0,
        outline : true,
        material : Cesium.Color.RED.withAlpha(0.5)
    }
});
CylinderGraphics

下面設(shè)置下邊框豎線數(shù)量,是是圓柱對象在顯示邊框的情況下,邊線的數(shù)量。邊框豎線數(shù)量并不會影響對象的形狀。


CylinderGraphics邊框豎線

上下圓面切邊數(shù)量設(shè)置,圓都是由一段段細(xì)線構(gòu)成,小編這里做了一個極限測試,將切邊設(shè)置為4,圓面會不會變成正方形面,下面來看下效果:


CylinderGraphics圓面切邊

果然和預(yù)想效果一樣,切邊數(shù)量設(shè)置為3,也會變成正三角形
CylinderGraphics圓面切邊

CylinderGraphics的使用就先介紹到這里,小節(jié)教程再見。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容