久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='1LRV3'><tr id='1LRV3'><dt id='1LRV3'><q id='1LRV3'><span id='1LRV3'><b id='1LRV3'><form id='1LRV3'><ins id='1LRV3'></ins><ul id='1LRV3'></ul><sub id='1LRV3'></sub></form><legend id='1LRV3'></legend><bdo id='1LRV3'><pre id='1LRV3'><center id='1LRV3'></center></pre></bdo></b><th id='1LRV3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1LRV3'><tfoot id='1LRV3'></tfoot><dl id='1LRV3'><fieldset id='1LRV3'></fieldset></dl></div>
  • <small id='1LRV3'></small><noframes id='1LRV3'>

      • <bdo id='1LRV3'></bdo><ul id='1LRV3'></ul>
      <legend id='1LRV3'><style id='1LRV3'><dir id='1LRV3'><q id='1LRV3'></q></dir></style></legend>

      1. <tfoot id='1LRV3'></tfoot>

        檢查一個(gè)多邊形點(diǎn)是否在傳單中的另一個(gè)內(nèi)部

        Check if a polygon point is inside another in leaflet(檢查一個(gè)多邊形點(diǎn)是否在傳單中的另一個(gè)內(nèi)部)
        <tfoot id='K6Y2q'></tfoot>

      2. <small id='K6Y2q'></small><noframes id='K6Y2q'>

          <i id='K6Y2q'><tr id='K6Y2q'><dt id='K6Y2q'><q id='K6Y2q'><span id='K6Y2q'><b id='K6Y2q'><form id='K6Y2q'><ins id='K6Y2q'></ins><ul id='K6Y2q'></ul><sub id='K6Y2q'></sub></form><legend id='K6Y2q'></legend><bdo id='K6Y2q'><pre id='K6Y2q'><center id='K6Y2q'></center></pre></bdo></b><th id='K6Y2q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='K6Y2q'><tfoot id='K6Y2q'></tfoot><dl id='K6Y2q'><fieldset id='K6Y2q'></fieldset></dl></div>

                  <bdo id='K6Y2q'></bdo><ul id='K6Y2q'></ul>
                  <legend id='K6Y2q'><style id='K6Y2q'><dir id='K6Y2q'><q id='K6Y2q'></q></dir></style></legend>
                    <tbody id='K6Y2q'></tbody>

                • 本文介紹了檢查一個(gè)多邊形點(diǎn)是否在傳單中的另一個(gè)內(nèi)部的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我從傳單 geoJSON 地圖中選擇了兩組多邊形坐標(biāo).父子坐標(biāo)是坐標(biāo)是:

                  I'm having two sets of polygon coordinates selected from leaflet geoJSON map. The parent and child coordinates are coordinates are:

                  var parentCoordinates=[
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ]
                  ]
                  var childCoordinates=[
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ]
                  ]
                  

                  child在父區(qū)域內(nèi)繪制如圖:

                  The child is drawn inside the parent area as shown in the picture:

                  使用 Ray Casting 算法 來(lái)確定是否點(diǎn)位于多邊形內(nèi),我無(wú)法確定,因?yàn)槲业玫降慕Y(jié)果是錯(cuò)誤的.請(qǐng)讓我知道我做錯(cuò)了什么或任何其他方式來(lái)確定解決方案.謝謝

                  Using Ray Casting algorithm to determine if the point lies inside polygon I 'm not able to determine as the result I'm getting is false. Please let me know where I'm doing wrong or any other way to determine the solution.Thanks

                  推薦答案

                  我嘗試了你的算法和另一個(gè)在這里找到的 https://rosettacode.org/wiki/Ray-casting_algorithm 并且都返回正確的值.

                  I tried with your algorithm and another found here https://rosettacode.org/wiki/Ray-casting_algorithm and both return the right value.

                  也許這個(gè)小提琴可以幫助你實(shí)現(xiàn):

                  Maybe this fiddle can help you in the implementation :

                  https://jsfiddle.net/4psL2hoo/1/

                  您的算法

                  // Data
                  var parentCoordinates=[
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.308044824292978
                      ],
                      [
                          32.06134255975485,
                          -28.31004731142091
                      ],
                      [
                          32.05898221582174,
                          -28.31004731142091
                      ]
                  ]
                  var childCoordinates=[
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.308743809931784
                    ],
                    [
                      32.06089194864035,
                      -28.30970726909422
                    ],
                    [
                      32.059904895722866,
                      -28.30970726909422
                    ]
                  ]
                  
                  // Other algo
                  function test(point, vs) {
                      // ray-casting algorithm based on
                      // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
                  
                      var x = point[0], y = point[1];
                  
                      var inside = false;
                      for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
                          var xi = vs[i][0], yi = vs[i][1];
                          var xj = vs[j][0], yj = vs[j][1];
                  
                          var intersect = ((yi > y) != (yj > y))
                              && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
                          if (intersect) inside = !inside;
                      }
                  
                      return inside;
                  };
                  
                  for (var i = 0; i < childCoordinates.length; i++) {
                       var testPoint = childCoordinates[i];
                       console.log(JSON.stringify(testPoint) + '	in parentCoordinate	' + test(testPoint, parentCoordinates));
                  }
                  

                  Rosetta 代碼算法

                  //https://rosettacode.org/wiki/Ray-casting_algorithm
                  function contains(bounds, lat, lng) {
                      //https://rosettacode.org/wiki/Ray-casting_algorithm
                      var count = 0;
                      for (var b = 0; b < bounds.length; b++) {
                          var vertex1 = bounds[b];
                          var vertex2 = bounds[(b + 1) % bounds.length];
                          if (west(vertex1, vertex2, lng, lat))
                              ++count;
                      }
                      return count % 2;
                  
                      /**
                       * @return {boolean} true if (x,y) is west of the line segment connecting A and B
                       */
                      function west(A, B, x, y) {
                          if (A.y <= B.y) {
                              if (y <= A.y || y > B.y ||
                                  x >= A.x && x >= B.x) {
                                  return false;
                              } else if (x < A.x && x < B.x) {
                                  return true;
                              } else {
                                  return (y - A.y) / (x - A.x) > (B.y - A.y) / (B.x - A.x);
                              }
                          } else {
                              return west(B, A, x, y);
                          }
                      }
                  }
                  
                  var square = {name: 'square', bounds: [{x: 32.05898221582174, y: -28.31004731142091}, {x: 32.05898221582174, y: -28.308044824292978}, {x: 32.06134255975485, y: -28.308044824292978}, {x: 32.06134255975485, y: -28.31004731142091}]};
                  
                  var shapes = [square];
                  var testPoints = [{lng: 32.059904895722866, lat: -28.30970726909422}, {lng: 32.059904895722866, lat: -28.308743809931784}, {lng: 32.06089194864035, lat: -28.308743809931784},
                      {lng: 32.06089194864035, lat: -28.30970726909422}];
                  
                  for (var s = 0; s < shapes.length; s++) {
                      var shape = shapes[s];
                      for (var tp = 0; tp < testPoints.length; tp++) {
                          var testPoint = testPoints[tp];
                          console.log(JSON.stringify(testPoint) + '	in ' + shape.name + '	' + contains(shape.bounds, testPoint.lat, testPoint.lng));
                      }
                  }
                  

                  這篇關(guān)于檢查一個(gè)多邊形點(diǎn)是否在傳單中的另一個(gè)內(nèi)部的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標(biāo)記群集圖標(biāo)顏色,繼承其余默認(rèn) CSS 屬性)
                  Trigger click on leaflet marker(觸發(fā)點(diǎn)擊傳單標(biāo)記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認(rèn)加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側(cè)邊欄)
                  Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標(biāo)記的緯度和經(jīng)度)
                • <tfoot id='aBBiL'></tfoot>
                  <legend id='aBBiL'><style id='aBBiL'><dir id='aBBiL'><q id='aBBiL'></q></dir></style></legend>

                  <i id='aBBiL'><tr id='aBBiL'><dt id='aBBiL'><q id='aBBiL'><span id='aBBiL'><b id='aBBiL'><form id='aBBiL'><ins id='aBBiL'></ins><ul id='aBBiL'></ul><sub id='aBBiL'></sub></form><legend id='aBBiL'></legend><bdo id='aBBiL'><pre id='aBBiL'><center id='aBBiL'></center></pre></bdo></b><th id='aBBiL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aBBiL'><tfoot id='aBBiL'></tfoot><dl id='aBBiL'><fieldset id='aBBiL'></fieldset></dl></div>
                    <bdo id='aBBiL'></bdo><ul id='aBBiL'></ul>

                          <small id='aBBiL'></small><noframes id='aBBiL'>

                              <tbody id='aBBiL'></tbody>

                          • 主站蜘蛛池模板: 欧美激情五月 | av色站| 亚洲乱码一区二区三区在线观看 | 国产一级大片 | 久久网一区二区 | 亚洲综合一区二区三区 | 国产一区久久久 | 黄网站在线观看 | 在线国产一区二区 | 亚洲综合天堂网 | 久久精品国产一区二区三区 | 国产一区二区三区免费 | 最新黄色毛片 | 精品亚洲一区二区三区四区五区高 | 成人在线视频看看 | 国产一区二区麻豆 | 亚洲成人精品一区二区 | 午夜一级做a爰片久久毛片 精品综合 | 国产高清一区二区三区 | 日本精品视频 | 婷婷精品| 亚洲综合一区二区三区 | 日本三级电影在线观看视频 | 成人欧美一区二区三区黑人孕妇 | 色婷婷av一区二区三区软件 | 中文字幕不卡在线观看 | 在线观看中文字幕视频 | 婷婷成人在线 | 久久久久亚洲精品 | 视频一区二区三区在线观看 | 国产专区在线 | 男女下面一进一出网站 | 中文字幕在线第一页 | 插插插干干干 | 国产99精品 | 成人影视网 | 天堂一区二区三区 | 日韩二区 | 国产视频久久 | 欧美黑人一区二区三区 | 亚洲国产成人在线 |