日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

已知两点坐标和三边长度,求三角形第三点的坐标

發布時間:2023/12/20 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 已知两点坐标和三边长度,求三角形第三点的坐标 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

已知兩點坐標和三邊長度,求三角形第三點的坐標

經驗證,該方法在平面中通用。

基本思路或步驟如下:

  • 計算邊AB與Y軸正向的夾角,或者叫做向量AB的航向角;
  • 計算出角CAB的角度;
  • 計算邊AC與Y軸正向的夾角,或者是向量AC的航向角;
  • 根據三角形的一些算法,得到對應的C點坐標
    引用自https://wenku.baidu.com/view/46038b2342323968011ca300a6c30c225801f056.html
    圖片: https://wenku.baidu.com/view/46038b2342323968011ca300a6c30c225801f056.html
  • 以下為代碼

    去博客設置頁面,選擇一款你喜歡的代碼片高亮樣式,下面展示同樣高亮的 代碼片.

    //根據兩點坐標和邊長長度,計算第三點坐標,第三點有兩個 bool AutoExtraLine::Cal3rdPoint(vector<CCVector3d> vecSrcPoints, double ab, double bc, double ca, vector<CCVector3d>& vec3rdPoints) {if (vecSrcPoints.size()<2){return false;}CCVector3d pointA = vecSrcPoints[0];CCVector3d pointB = vecSrcPoints[1];CCVector3d pointC;double dy = pointB.y - pointA.y;double dx = pointB.x - pointA.x;double tmpValue = (ca*ca + ab * ab - bc * bc) / (2 * ca*ab);//AB的方位角double angAB = CalVectorAngleWithY(pointA, pointB);if (angAB>180){// angAB = angAB - 180;}angAB = angAB * (PI / 180);// angAB = atan(dy / dx);//A點對應BC邊的角度double angBC = acos(tmpValue);//AC的方位角double angAC = angAB-angBC;pointC.x = pointA.x + ca * sin(angAC);pointC.y = pointA.y + ca * cos(angAC);vec3rdPoints.push_back(pointC);angAC = angAB + angBC;pointC.x = pointA.x + ca * sin(angAC);pointC.y = pointA.y + ca * cos(angAC);vec3rdPoints.push_back(pointC);return true; } /計算向量ABY軸正方向夾角,角度范圍0~360 double AutoExtraLine::CalVectorAngleWithY(CCVector3d pointA, CCVector3d pointB) {//線段(startPt,firstPt)平行于y軸向上CCVector3d firstPt(pointA.x, pointA.y + 10, pointA.z);double angle = PointAlg::calcAngleByThreePoint(firstPt, pointA, pointB);angle = angle * 180 / PI;if (pointA.x > pointB.x){angle = 360 - angle;}return angle; }

    總結

    以上是生活随笔為你收集整理的已知两点坐标和三边长度,求三角形第三点的坐标的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。