Methods
计算三点的角度(0-180之间)
Name | Type | Description |
---|---|---|
p1 |
Cartesian3 | 顶点1 |
p2 |
Cartesian3 | 顶点2 |
p3 |
Cartesian3 | 顶点3 |
笛卡尔世界坐标数组转经纬度degree数组
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 笛卡尔世界坐标数组 |
result |
Array.<Number> | optional 经纬度(含高度)度数组 |
Returns:
经纬度数组
计算 polygon 面积
Name | Type | Description |
---|---|---|
points |
Array.<Cartesian3> | polygon顶点集 |
Returns:
static Cesium.AlgorithmLib.computeTileInPolygon(tile, positions) → Intersect|false
判断tile与绘制范围是否相交
Name | Type | Description |
---|---|---|
tile |
Array.<MapGISM3DSet> | |
positions |
Array.<Cartesian3> | 范围坐标点序列 |
Returns:
Intersect.OUTSIDE, Intersect.INTERSECTING, or Intersect.INSIDE表示完全包围、相交和在外部.false表示计算失败
深度拷贝对象
Name | Type | Description |
---|---|---|
o |
object | 被拷贝对象 |
Returns:
static Cesium.AlgorithmLib.getCenterFromPoints(positions) → Array.<Cartesian3>
根据输入笛卡尔坐标数组,计算中心点
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 坐标点序列 |
Returns:
根据坐标点序列计算出的中心点
static Cesium.AlgorithmLib.getCenterOfCartesian3Points(points, useHeight) → Cartesian3
计算Cartesian3数组的中心
Name | Type | Description |
---|---|---|
points |
Array.<Cartesian3> | |
useHeight |
Boolean | 是否使用高度 |
Returns:
static Cesium.AlgorithmLib.getCenterOfGravityPoint(points) → Cartesian3
计算Cartesian3数组的重心
Name | Type | Description |
---|---|---|
points |
Array.<Cartesian3> |
Returns:
计算屏幕坐标相对于地表某点垂直(或平行方向XY)的位置
Name | Type | Description |
---|---|---|
viewer |
Number | 视图 |
point |
Cartesian3 | 地表点 |
windowPosition |
Cartesian2 | 屏幕坐标 |
Returns:
与经过地表点的垂直地表的平面的交点,endPositionX表示X方向(经线方向)的面的交点位置(世界坐标),endPositionY表示Y方向(纬线方向)的面的交点位置(世界坐标),XYZLocPosition表示在地表点坐标系下局部坐标系XYZ方向的坐标
获取当前场景下,每米占据多少个像素值
Name | Type | Description |
---|---|---|
scene |
Scene |
Returns:
pixel/m
static Cesium.AlgorithmLib.getPointOntoLine(ellipsoid, pointA, pointB, pointP, result) → Cartesian3
计算三维场景中,直线外一点在直线上的投影点
Name | Type | Description |
---|---|---|
ellipsoid |
Ellipsoid | 椭球参数 |
pointA |
Cartesian3 | 直线上的点 A 经纬度 |
pointB |
Cartesian3 | 直线上的点 B 经纬度 |
pointP |
Cartesian3 | 直线外的点 P 经纬度 |
result |
Cartesian3 | 返回结果,直线上的投影点 |
Returns:
result 经纬度坐标
static Cesium.AlgorithmLib.getPointOntoLineByWorldPosition(pointA, pointB, pointP, result) → Cartesian3
计算三维场景中,直线外一点在直线上的投影点
Name | Type | Description |
---|---|---|
pointA |
Cartesian3 | 直线上一点A,世界坐标 |
pointB |
Cartesian3 | 直线上一点B,世界坐标 |
pointP |
Cartesian3 | 直线外一点P,世界坐标 |
result |
Cartesian3 | 直线外一点,到直线的垂足点,世界坐标 |
Returns:
result
static Cesium.AlgorithmLib.getPointOntoPlane(ellipsoid, originPoint, normal, outPoint, result) → Cartesian3
计算平面(此平面由一个点,与法线构成)外一点到此平面上的投影点
Name | Type | Description |
---|---|---|
ellipsoid |
Ellipsoid | 椭球参数 |
originPoint |
Cartesian3 | 平面上的一个点,世界坐标 |
normal |
Cartesian3 | 平面的法线 |
outPoint |
Cartesian3 | 平面外一点,世界坐标 |
result |
Cartesian3 | 平面外一点在平面上的投影,世界坐标 |
Returns:
result 平面外一点在平面上的投影,世界坐标
static Cesium.AlgorithmLib.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 返回随机点数集合
static Cesium.AlgorithmLib.getRect3DPointsByLine(direct, p1, p2, result) → Array.<Cartesian3>
根据两点,确定一个平行于视窗的矩形
顶点顺序为:
0---3
| \ |
1---2
Name | Type | Description |
---|---|---|
direct |
Cartesian3 | 朝向,使用时一般用相机朝右的朝向 |
p1 |
Cartesian3 | 起始点,世界坐标 |
p2 |
Cartesian3 | 绘制结束点,世界坐标 |
result |
Array | undefined | 返回值,矩形的4个顶点 |
Returns:
result
static Cesium.AlgorithmLib.getSquarePointsByLine(p1, p2, result) → Array.<Cartesian3>
通过两点确定一个正方形
顶点顺序为:
0---3
| \ |
1---2
Name | Type | Description |
---|---|---|
p1 |
Cartesian3 | 起始点, 值类型为世界坐标 |
p2 |
Cartesian3 | 结束点, 值类型为世界坐标 |
result |
Array | 返回值 |
Returns:
result 正方形四个顶点, 值类型为世界坐标
static Cesium.AlgorithmLib.getTransform(longitude, latitude, height) → Matrix4
计算矩阵
Name | Type | Description |
---|---|---|
longitude |
Number | 角度制经度 |
latitude |
Number | 角度制纬度 |
height |
Number | 高程 |
Returns:
计算是否为凸多边形
Name | Type | Description |
---|---|---|
points |
Array.<Cartesian3> | 点坐标 |
Returns:
result 0:数量小于2;-1:凹多边形;1:凸多边形;
static Cesium.AlgorithmLib.linearInterpolate(positions, step) → Array.<Cartesian2>
线性插值(二维坐标)
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian2> | 坐标点序列 |
step |
Number | 步长 |
Returns:
插值后的坐标点序列
static Cesium.AlgorithmLib.linearInterpolate3D(positions, step) → Array.<Cartesian3>
线性插值(三维坐标)
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 坐标点序列 |
step |
Number | 步长 |
Returns:
插值后的坐标点序列
static Cesium.AlgorithmLib.mergeLayersBoundingSphere(layers) → BoundingSphere
获取 M3D 缓存图层组合并后的包围球
Name | Type | Description |
---|---|---|
layers |
Array.<MapGISM3DSet> |
Returns:
boundingSphere 包围球
static Cesium.AlgorithmLib.pickFromRay(scene, viewPosition, options) → Cartesian3|undefined
射线求交
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
scene |
Scene | |||||||||||||||||||||
viewPosition |
Cartesian3 | |||||||||||||||||||||
options |
options |
|
Returns:
返回射线物体相交的第一个交点坐标,没有交点则返回undefined
点是否在范围内(多边形)
Name | Type | Description |
---|---|---|
positions |
Array.<Cartographic> | 多边形坐标点序列 |
point |
Cartographic | 点 |
Returns:
true在范围内,false不在范围内。
static Cesium.AlgorithmLib.polygonInterpolate(positions, step) → Array.<Cartesian3>
区域插值(多边形)
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 坐标点序列 |
step |
Number | 步长 |
Returns:
插值后的坐标点序列
获取区间范围内的随机数
Name | Type | Description |
---|---|---|
minNum |
Number | 区间最小值 |
maxNum |
Number | 区间最大值 |
Returns:
result 在范围[minNum, maxNum]内的随机数
根据地形设置二维坐标的高程值
Name | Type | Description |
---|---|---|
TerrainProvider |
CesiumTerrainProvider | 地形 |
level |
Number | 以地形的级数为基准 |
positions |
Array.<Cartesian2> | 需设置高程的二维坐标点序列 |
Returns:
设置成功后的回调
static Cesium.AlgorithmLib.simplifyLine(positions) → Array.<Cartesian3>
化简抽稀(用于折线路绘制)
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | 坐标点序列 |
Returns:
抽稀后的坐标点序列
计算球面 投影面积方法
Name | Type | Description |
---|---|---|
points |
Array.<Cartesian3> | polygon顶点集 |