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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

三个点拟合圆形的函数C#

發布時間:2023/12/10 C# 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 三个点拟合圆形的函数C# 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

三個點擬合圓形的函數

函數說明

public void FitCircleFromThreePoints(double1X, double1Y, double2X, double2Y, double3X, double3Y, out double 圓心X坐標, out double 圓心Y坐標, out double 圓形半徑大小) public void FitCircleFromThreePoints(double Points1X, double Points1Y, double Points2X, double Points2Y, double Points3X, double Points3Y, out double Col, out double Row, out double Rad){try{//先判斷一下這三個點是否共線,如果共線就不求了。if ((Points1X - Points2X) / (Points1Y - Points2Y) == (Points2X - Points3X) / (Points2Y - Points3Y)){Col = 0;Row = 0;Rad = 0;return ;}//求圓形double x1, y1, x2, y2, x3, y3;double a, b, c, g, h, f;x1 = Points1X;y1 = Points1Y;x2 = Points2X;y2 = Points2Y;x3 = Points3X;y3 = Points3Y;h = 2 * (x2 - x1);f = 2 * (y2 - y1);g = x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1;a = 2 * (x3 - x2);b = 2 * (y3 - y2);c = x3 * x3 - x2 * x2 + y3 * y3 - y2 * y2;Col = (g * b - c * f) / (h * b - a * f);Row = (a * g - c * h) / (a * f - b * h);Rad = Math.Sqrt((Col - x1) * (Col - x1) + (Row - y1) * (Row - y1));}catch{Col = 0;Row = 0;Rad = 0;}}

不懂可以問我哈,底下評論留言,看到第一時間回復。覺得有用點贊哦。

PS

我的博客不定時分享日常工作中覺得有價值的內容,包括C#、C++、halcon、運動控制等等內容,喜歡的點贊,關注我。

總結

以上是生活随笔為你收集整理的三个点拟合圆形的函数C#的全部內容,希望文章能夠幫你解決所遇到的問題。

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