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

    1. <tfoot id='khPka'></tfoot>
      <legend id='khPka'><style id='khPka'><dir id='khPka'><q id='khPka'></q></dir></style></legend>

      • <bdo id='khPka'></bdo><ul id='khPka'></ul>

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

        查找坐標(biāo)以在線的末端繪制箭頭(等腰三角形)

        Find coordinates to draw arrow head (isoscele triangle) at the end of a line(查找坐標(biāo)以在線的末端繪制箭頭(等腰三角形))

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

                <bdo id='jvXww'></bdo><ul id='jvXww'></ul>

                  <tbody id='jvXww'></tbody>
              • <legend id='jvXww'><style id='jvXww'><dir id='jvXww'><q id='jvXww'></q></dir></style></legend>
                  <tfoot id='jvXww'></tfoot>
                  本文介紹了查找坐標(biāo)以在線的末端繪制箭頭(等腰三角形)的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在嘗試創(chuàng)建一個(gè)函數(shù),該函數(shù)將返回我想在行尾繪制的箭頭(等腰三角形)的 3 點(diǎn)坐標(biāo).

                  I am trying to create a function that will return the 3 points coordinates of arrow head (isoscele triangle) that I want to draw at the end of a line.

                  挑戰(zhàn)在于線的方向(角度)可以在象限中的 0 到 360 度之間變化.

                  The challenge is in the orientation (angle) of the line that can vary between 0 and 360 degree in the quadrant.

                  我有以下價(jià)值觀:

                  //start coordinates of the line
                  var x0 = 100;
                  var y0 = 100;
                  
                  //end coordinates of the line
                  var x1 = 200;
                  var y1 = 200;
                  
                  //height of the triangle
                  var h = 10;
                  //width of the base of the triangle
                  var w = 30 ;
                  

                  到目前為止,這是我的函數(shù),它返回三角形底邊的兩點(diǎn)坐標(biāo):

                  This is my function until now that returns the two point coordinates of the base of the triangle:

                  var drawHead = function(x0, y0, x1, y1, h, w){
                      var L = Math.sqrt(Math.pow((x0 - x1),2)+Math.pow((y0 - y1),2));
                  
                      //first base point coordinates
                      var base_x0 = x1 + (w/2) * (y1 - y0) / L;
                      var base_y0 = y1 + (w/2) * (x0 - x1) / L;
                  
                      //second base point coordinates
                      var base_x1 = x1 - (w/2) * (y1 - y0) / L;
                      var base_y1 = y1 - (w/2) * (x0 - x1) / L;
                  
                      //now I have to find the last point coordinates ie the top of the arrow head
                  }
                  

                  如何根據(jù)線的角度確定三角形頂部的坐標(biāo)?

                  How can I determine the coordinates of the top of the triangle considering the angle of the line?

                  推薦答案

                  箭頭的頭部與箭頭的主體在同一條線上.因此,(x1, y1) 和 (head_x, head_y) 之間的線段的斜率將與 (x0, y0) 和 (x1, y1) 之間的線段的斜率相同.假設(shè) dx = head_x - x1 和 dy = head_y - y1 和斜率 = (y1 - y0)/(x1 - x0).因此,dy/dx = 斜率.我們也知道 dx^2 + dy^2 = h^2.我們可以根據(jù)斜率和 h 求解 dx.那么,dy = dx * 斜率.一旦你有了 dx 和 dy,你就可以將它們添加到 x1 和 y1 來獲得頭點(diǎn).一些偽代碼:

                  The head of the arrow will lie along the same line as the body of the arrow. Therefore, the slope of the line segment between (x1, y1) and (head_x, head_y) will be the same as the slope of the line segment between(x0, y0) and (x1, y1). Let's say that dx = head_x - x1 and dy = head_y - y1 and slope = (y1 - y0) / (x1 - x0). Therefore, dy / dx = slope. We also know that dx^2 + dy^2 = h^2. We can solve for dx in terms of slope and h. Then, dy = dx * slope. Once you have dx and dy, you can just add those to x1 and y1 to get the head point. Some pseudocode:

                  if x1 == x0: #avoid division by 0
                      dx = 0
                      dy = h
                      if y1 < y0:
                          dy = -h #make sure arrow head points the right way
                      else:
                          dy = h
                  else:
                      if x1 < x0: #make sure arrow head points the right way
                          h = -h
                      slope = (y1 - y0) / (x1 - x0)
                      dx = h / sqrt(1 + slope^2)
                      dy = dx * slope
                  head_x = x1 + dx
                  head_y = y1 + dy
                  

                  這篇關(guān)于查找坐標(biāo)以在線的末端繪制箭頭(等腰三角形)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項(xiàng)目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數(shù)據(jù)更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動(dòng)態(tài)元素 - Angular 2 amp;離子2)

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

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

                          <tfoot id='alEN7'></tfoot>
                            <tbody id='alEN7'></tbody>

                          1. 主站蜘蛛池模板: 国产高清免费 | 精品久久久久久久久久久下田 | 色呦呦网站 | 国产欧美精品一区 | 欧美一级电影免费 | 爱高潮www亚洲精品 中文字幕免费视频 | 欧美一级三级 | 亚洲欧美激情网 | 91精品久久久久 | 亚洲国产一区二区三区在线观看 | 免费在线观看av的网站 | 亚洲综合五月天婷婷 | 九九久久久 | 久久久久久99 | 久久精品久久久久久 | 欧美视频在线一区 | 成人午夜精品一区二区三区 | 一区二区三区日韩精品 | 91麻豆精品国产91久久久久久久久 | 国产亚洲欧美另类一区二区三区 | 国产精品久久久久久网站 | 久在线精品视频 | 日本精品在线观看 | 久久久久国产一区二区三区四区 | 国产高清在线观看 | 亚洲精品一区二区 | 91av国产在线视频 | 久久a久久 | 亚洲精品一区二区在线观看 | 中文字幕第一页在线 | www,黄色,com| 色约约视频 | 午夜激情小视频 | 国产高清在线精品一区二区三区 | 欧美激情一区二区三区 | 国产在线一区二区三区 | 国产精品视频一二三区 | 国产成人啪免费观看软件 | 亚洲第一色站 | 天天射网站 | 成人激情视频免费在线观看 |