久久久久久久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'>

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

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

        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>
                  本文介紹了查找坐標以在線的末端繪制箭頭(等腰三角形)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試創建一個函數,該函數將返回我想在行尾繪制的箭頭(等腰三角形)的 3 點坐標.

                  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.

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

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

                  我有以下價值觀:

                  //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 ;
                  

                  到目前為止,這是我的函數,它返回三角形底邊的兩點坐標:

                  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
                  }
                  

                  如何根據線的角度確定三角形頂部的坐標?

                  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) 之間的線段的斜率相同.假設 dx = head_x - x1 和 dy = head_y - y1 和斜率 = (y1 - y0)/(x1 - x0).因此,dy/dx = 斜率.我們也知道 dx^2 + dy^2 = h^2.我們可以根據斜率和 h 求解 dx.那么,dy = dx * 斜率.一旦你有了 dx 和 dy,你就可以將它們添加到 x1 和 y1 來獲得頭點.一些偽代碼:

                  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
                  

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

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

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 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 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - 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. 主站蜘蛛池模板: 欧美成人免费 | 中文字幕综合在线 | 国产一级电影网 | 国产小视频在线观看 | 4h影视 | 亚洲 中文 欧美 日韩 在线观看 | www.天天操| 激情欧美日韩一区二区 | 人和拘一级毛片c | 久久久精品网 | 国产精品精品视频一区二区三区 | 天堂久久久久久久 | 婷婷五月色综合香五月 | 免费特级黄毛片 | 久久99精品久久久久久青青日本 | 人操人免费视频 | 久久精品久久综合 | 日日夜夜精品视频 | 久久久91精品国产一区二区三区 | 国产.com | 最新午夜综合福利视频 | 91干b| 日日夜夜av | 亚洲成人精品 | 天天操操| 欧美视频二区 | 亚洲国产精品成人无久久精品 | 日韩色在线 | 一区二区三区欧美 | 成人一区二区视频 | 久久国内精品 | 久久久久国产一区二区三区四区 | 亚洲一区二区三区桃乃木香奈 | 亚洲精品综合一区二区 | 日韩久久久久 | 天天天操操操 | 日本亚洲欧美 | 国产一级片av | 色久五月 | 欧美a在线| 国产粉嫩尤物极品99综合精品 |