CommonFunction

new Cesium.CommonFunction()

通用算法工具集

Methods

staticCesium.CommonFunction.calAngleOf3Pnt(p1, p2, p3)

计算三点的角度(0-180之间)
Name Type Description
p1 Cartesian3 顶点1
p2 Cartesian3 顶点2
p3 Cartesian3 顶点3

staticCesium.CommonFunction.compute_3D_polygon_area(points)Number

计算 polygon 面积
Name Type Description
points Array.<Cartesian3> polygon顶点集
Returns:

staticCesium.CommonFunction.deepCopy(o)object

深度拷贝对象
Name Type Description
o object 被拷贝对象
Returns:

staticCesium.CommonFunction.getCenterOfCartesian3Points(points)Cartesian3

计算Cartesian3数组的中心
Name Type Description
points Array.<Cartesian3>
Returns:

staticCesium.CommonFunction.getCenterOfGravityPoint(points)Cartesian3

计算Cartesian3数组的中心
Name Type Description
points Array.<Cartesian3>
Returns:

staticCesium.CommonFunction.getPixelsPerMeter(scene)Number

获取当前场景下,每米占据多少个像素值
Name Type Description
scene Scene
Returns:
pixel/m

staticCesium.CommonFunction.getPointOntoPlane(originPoint, normal, outPoint, result)Cartesian3

计算平面(此平面由一个点,与法线构成)外一点到此平面上的投影点
Name Type Description
originPoint Cartesian3 平面上的一个点
normal Cartesian3 平面的法线
outPoint Cartesian3 平面外一点
result Cartesian3 平面外一点在平面上的投影
Returns:
result 平面外一点在平面上的投影

staticCesium.CommonFunction.getPointOntoPlaneEx(ellipsoid, originPoint, normal, outPoint, result)Cartesian3

计算平面(此平面由一个点,与法线构成)外一点到此平面上的投影点
Name Type Description
ellipsoid Cartesian3 椭球参数
originPoint Cartesian3 平面上的一个点
normal Cartesian3 平面的法线
outPoint Cartesian3 平面外一点
result Cartesian3 平面外一点在平面上的投影
Returns:
result 平面外一点在平面上的投影

staticCesium.CommonFunction.getRandomPointByRect(west, south, east, north, count, result)Array.<Object>

计算矩形范围内的随机点
Name Type Description
west Number 西向经度数
south Number 南向纬度数
east Number 东向经度数
north Number 北向纬度数
count Number 需要的随机点数
result Array.<Object>
Returns:
result 返回随机点数集合

staticCesium.CommonFunction.getTransform(longitude, latitude, height)Matrix4

计算矩阵
Name Type Description
longitude Number 角度制经度
latitude Number 角度制纬度
height Number 高程
Returns:

staticCesium.CommonFunction.linearInterpolate3D(positions, step)Array.<Cartesian3>

线性插值(三维坐标)
Name Type Description
positions Array.<Cartesian3> 坐标点序列
step Number 步长
Returns:
插值后的坐标点序列

staticCesium.CommonFunction.mergeLayersBoundingSphere(layers)BoundingSphere

获取 M3D 缓存图层组合并后的包围球
Name Type Description
layers Array.<MapGISM3DSet>
Returns:
boundingSphere 包围球

staticCesium.CommonFunction.randomNum(minNum, maxNum)Number

获取区间范围内的随机数
Name Type Description
minNum Number 区间最小值
maxNum Number 区间最大值
Returns:
result 在范围[minNum, maxNum]内的随机数

staticCesium.CommonFunction.setZValueByTerrain(TerrainProvider, level, positions)function

根据地形设置二维坐标的高程值
Name Type Description
TerrainProvider CesiumTerrainProvider 地形
level Number 以地形的级数为基准
positions Array.<Cartesian2> 需设置高程的二维坐标点序列
Returns:
设置成功后的回调

staticCesium.CommonFunction.simplifyLine(positions)Array.<Cartesian3>

化简抽稀(用于折线路绘制)
Name Type Description
positions Array.<Cartesian3> 坐标点序列
Returns:
抽稀后的坐标点序列

staticCesium.CommonFunction.SphericalPolygonAreaMeters(points)Number

计算球面 投影面积方法
Name Type Description
points Array.<Cartesian3> polygon顶点集
Returns: