数学2d计算模块
Parameters:
Name | Type | Description |
---|---|---|
params |
object
|
|
viewer |
object
|
cesium 实例 |
cesiumGlobal |
object
|
cesium 全局对象 |
Methods
# computeCircleShap(radius) → {Array}
根据半径获取圆型坐标数据
Parameters:
Name | Type | Description |
---|---|---|
radius |
number
|
半径 |
坐标数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.computeCircleShap(150);
# computeStar2d(arms, rOuter, rInner) → {Array}
计算星型
Parameters:
Name | Type | Description |
---|---|---|
arms |
number
|
角数量 |
rOuter |
number
|
外圆半径 |
rInner |
number
|
内圆半径 |
坐标数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.computeStar2d(5,120,54);
# getAngleOfThreePoints2d(pntA, pntB, pntC) → {number}
通过三个点获取方位角
Parameters:
Name | Type | Description |
---|---|---|
pntA |
Array
|
坐标A |
pntB |
Array
|
坐标A |
pntC |
Array
|
坐标A |
方位角度
number
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getAngleOfThreePoints2d(
[110.16018735617934,31.036076859828338],
[110.17845812703679,31.033686527335444],
[110.19261040403379,31.02892781958261]);
# getAzimuth2d(startPoint, endPoint) → {number}
根据两个矢量获取方位角(地平经度)
Parameters:
Name | Type | Description |
---|---|---|
startPoint |
Array
|
开始坐标 |
endPoint |
Array
|
结束坐标 |
方位角度
number
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getAzimuth2d([110.16018735617934,31.036076859828338],[110.17845812703679,31.033686527335444]);
# getBaseLength2d(points) → {number}
获取基础长度
Parameters:
Name | Type | Description |
---|---|---|
points |
Array
|
多个点的数组 |
长度
number
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getBaseLength2d([[103.8258, 30.58595], [104.252263, 30.87]]);
# getBezierPoints2d(points) → {Array}
获取贝塞尔曲线
Parameters:
Name | Type | Description |
---|---|---|
points |
Array
|
坐标数组 |
贝塞尔曲线数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getBezierPoints2d([110.16018735617934,31.036076859828338],[110.17845812703679,31.033686527335444]);
# getCircleCenterOfThreePoints2d(point1, point2, point3) → {Array}
通过三个点确定一个圆的中心点
Parameters:
Name | Type | Description |
---|---|---|
point1 |
Array
|
坐标点1 |
point2 |
Array
|
坐标点2 |
point3 |
Array
|
坐标点3 |
中心点坐标数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getCircleCenterOfThreePoints2d(
[110.16018735617934,31.036076859828338],
[110.17845812703679,31.033686527335444],
[110.19261040403379,31.02892781958261]);
# getCirclePoints2d(r, ox, oy, count) → {Array}
求圆周上等分点的坐标
Parameters:
Name | Type | Description |
---|---|---|
r |
number
|
r为半径 |
ox |
number
|
圆心坐标y轴 |
oy |
number
|
圆心坐标x轴 |
count |
number
|
等分个数 |
等分后的坐标数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getCirclePoints2d(50,103.8258, 30.58595,20)
# getIntersectPoint2d(pointA, pointB, pointC, pointD) → {Array}
获取交集的点
Parameters:
Name | Type | Description |
---|---|---|
pointA |
Array
|
坐标点A |
pointB |
Array
|
坐标点B |
pointC |
Array
|
坐标点C |
pointD |
Array
|
坐标点D |
相交坐标点数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getIntersectPoint2d(
[110.16018735617934,31.036076859828338],
[110.17845812703679,31.033686527335444],
[110.19261040403379,31.02892781958261],
[110.20775152895165,31.02475678594998]);
# getPointOnLine2d(t, startPnt, endPnt) → {Array}
获取线上的点
Parameters:
Name | Type | Description |
---|---|---|
t |
number
|
线段总长 |
startPnt |
Array
|
开始坐标 |
endPnt |
Array
|
结束坐标 |
坐标点数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.getPointOnLine2d(5,[110.16018735617934,31.036076859828338],[110.17845812703679,31.033686527335444]);
# inherits2d(childCtor, parentCtor) → {object}
函数继承
Parameters:
Name | Type | Description |
---|---|---|
childCtor |
function
|
子函数 |
parentCtor |
function
|
父函数 |
返回继承后的原型对象
object
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const fn1 = function(){}
const fn2 = function(){}
const res = math2d.inherits2d(fn1,fn2);
# isClockWise2d(pnt1, pnt2, pnt3) → {boolean}
判断是否是顺时针
Parameters:
Name | Type | Description |
---|---|---|
pnt1 |
Array
|
坐标1 |
pnt2 |
Array
|
坐标2 |
pnt3 |
Array
|
坐标3 |
是否是顺时针
boolean
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.isClockWise2d(
[110.16018735617934,31.036076859828338],
[110.17845812703679,31.033686527335444],
[110.19261040403379,31.02892781958261]);
# mathDistance2d(pnt1, pnt2) → {number}
计算两个坐标之间的距离
Parameters:
Name | Type | Description |
---|---|---|
pnt1 |
Array
|
坐标点1 |
pnt2 |
Array
|
坐标点2 |
计算后距离
number
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.mathDistance2d([103.8258, 30.58595], [104.252263, 30.87])
# mid2d(point1, point2) → {Array}
求取两个坐标的中间值
Parameters:
Name | Type | Description |
---|---|---|
point1 |
Array
|
坐标1 |
point2 |
Array
|
坐标2 |
中间值坐标数组
Array
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.mid2d([103.8258, 30.58595], [104.252263, 30.87]);
# wholeDistance2d(points) → {number}
计算点集合的总距离
Parameters:
Name | Type | Description |
---|---|---|
points |
Array
|
多个点的数组 |
距离
number
Example
import { Math2d } from 'cesium_dev_kit'
const math2d = new Math2d(viewer,Cesium);
const res = math2d.wholeDistance2d([[103.8258, 30.58595], [104.252263, 30.87]])