pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    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="3hhdnfd" 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="tvvltnf" 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="dph3bth" 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. 主站蜘蛛池模板: 天津货架厂_穿梭车货架_重型仓储货架_阁楼货架定制-天津钢力仓储货架生产厂家_天津钢力智能仓储装备 | 热回收盐水机组-反应釜冷水机组-高低温冷水机组-北京蓝海神骏科技有限公司 | 立式硫化罐-劳保用品硫化罐-厂家直销-山东鑫泰鑫硫化罐厂家 | 锻造液压机,粉末冶金,拉伸,坩埚成型液压机定制生产厂家-山东威力重工官方网站 | 洗地机_全自动洗地机_手推式洗地机【上海滢皓环保】 | 盘扣式脚手架-附着式升降脚手架-移动脚手架,专ye承包服务商 - 苏州安踏脚手架工程有限公司 | 小型气象站_车载气象站_便携气象站-山东风途物联网 | 西装定制/做厂家/公司_西装订做/制价格/费用-北京圣达信西装 | 广州活动策划公司-15+年专业大型公关活动策划执行管理经验-睿阳广告 | 旋转/数显粘度计-运动粘度测定仪-上海平轩科学仪器 | 手术室净化厂家_成都实验室装修公司_无尘车间施工单位_洁净室工程建设团队-四川华锐16年行业经验 | 井式炉-台车式回火炉-丹阳市电炉厂有限公司| 北京模型公司-军事模型-工业模型制作-北京百艺模型沙盘公司 | 南京泽朗生物科技有限公司-液体饮料代加工_果汁饮料代加工_固体饮料代加工 | 分轨 | 上传文件,即刻分离人声和伴奏 | 手板-手板模型-手板厂-手板加工-生产厂家,[东莞创域模型] | 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 校园文化空间设计-数字化|中医文化空间设计-党建|法治廉政主题文化空间施工-山东锐尚文化传播公司 | 智能监控-安防监控-监控系统安装-弱电工程公司_成都万全电子 | 车牌识别道闸_停车场收费系统_人脸识别考勤机_速通门闸机_充电桩厂家_中全清茂官网 | 陶瓷砂磨机,盘式砂磨机,棒销式砂磨机-无锡市少宏粉体科技有限公司 | 气动隔膜泵-电动隔膜泵-循环热水泵-液下排污/螺杆/管道/化工泵「厂家」浙江绿邦 | 西安展台设计搭建_西安活动策划公司_西安会议会场布置_西安展厅设计西安旭阳展览展示 | 焊接减速机箱体,减速机箱体加工-淄博博山泽坤机械厂 | 医养体检包_公卫随访箱_慢病随访包_家签随访包_随访一体机-济南易享医疗科技有限公司 | 西安烟道厂家_排气道厂家_包立管厂家「陕西西安」推荐西安天宇烟道 | 企业彩铃制作_移动、联通、电信集团彩铃上传开通_彩铃定制_商务彩铃管理平台-集团彩铃网 | 活性氧化铝|无烟煤滤料|活性氧化铝厂家|锰砂滤料厂家-河南新泰净水材料有限公司 | 会议会展活动拍摄_年会庆典演出跟拍_摄影摄像直播-艾木传媒 | 事迹材料_个人事迹名人励志故事| 模具钢_高速钢_不锈钢-万利钢金属材料 | 二氧化碳/活性炭投加系统,次氯酸钠发生器,紫外线消毒设备|广州新奥 | 软文发布-新闻发布推广平台-代写文章-网络广告营销-自助发稿公司媒介星 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | PSI渗透压仪,TPS酸度计,美国CHAI PCR仪,渗透压仪厂家_价格,微生物快速检测仪-华泰和合(北京)商贸有限公司 | 全自动包装秤_全自动上袋机_全自动套袋机_高位码垛机_全自动包装码垛系统生产线-三维汉界机器(山东)股份有限公司 | 福兰德PVC地板|PVC塑胶地板|PVC运动地板|PVC商用地板-中国弹性地板系统专业解决方案领先供应商! 福建成考网-福建成人高考网 | 耐压仪-高压耐压仪|徐吉电气 | 时代北利离心机,实验室离心机,医用离心机,低速离心机DT5-2,美国SKC采样泵-上海京工实业有限公司 工业电炉,台车式电炉_厂家-淄博申华工业电炉有限公司 | 污水处理设备维修_污水处理工程改造_机械格栅_过滤设备_气浮设备_刮吸泥机_污泥浓缩罐_污水处理设备_污水处理工程-北京龙泉新禹科技有限公司 | 编织人生 - 权威手工编织网站,编织爱好者学习毛衣编织的门户网站,织毛衣就上编织人生网-编织人生 |