多边形中的最大内切圆

时间:2019-06-14 06:47:44

标签: javascript geometry

我需要在多边形中绘制最大内切圆。经过很少的搜寻,我发现了一个图书馆-https://github.com/PieceMaker/max-inscribed-circle。我必须做一些错误的事情,因为我的解释返回了错误的结果(圆圈应该更靠右,半径对我来说很奇怪):

enter image description here

var coords = [
    [49.0138, 15],
    [49.0138, 15.0167],
    [49.0153, 15.0167]
];

var polygon = {
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [coords]
     },
     "properties": {
        "id": 1
     }
};

console.log(maxInscribedCircle(polygon, 7));

返回

{
  geometry: {
    coordinates: [49.0143, 15.011133333333333],
    type: "Point"
  },
  properties: {
    radius: 0.0004823742421792941,
    units: "degrees"
  }
}

我尝试切换[lat,lon]顺序,但是得到相同的结果。

问题Largest circle inside a non-convex polygon不能解决此问题,因为它描述了不同的算法-它没有使用https://github.com/PieceMaker/max-inscribed-circle库。

任何想法,为什么位置错误?如何正确解释半径-“度”如何成为长度单位?

0 个答案:

没有答案