求一点到另外两点所构成的直线的距离 |
您所在的位置:网站首页 › 点组成线段的公式有哪些 › 求一点到另外两点所构成的直线的距离 |
点到直线的距离公式。 求点到直线的距离。 假如知道两点startPt 和endPt ,可以求出第三点Pt到startPt 和endPt 所构成的直线的距离dis。 Public Function CalDistanc(ByVal PtList As List(Of Point3d)) Dim startPt As Point3d = PtList(0) Dim endPt As Point3d = PtList(1) Dim Pt As Point3d = PtList(2) Dim S1 As Double = Math.Sqrt((startPt.X - endPt.X) * (startPt.X - endPt.X) + (startPt.Y - endPt.Y) * (startPt.Y - endPt.Y)) Dim S2 As Double = Math.Sqrt((Pt.X - endPt.X) * (Pt.X - endPt.X) + (Pt.Y - endPt.Y) * (Pt.Y - endPt.Y)) Dim S3 As Double = Math.Sqrt((startPt.X - Pt.X) * (startPt.X - Pt.X) + (startPt.Y - Pt.Y) * (startPt.Y - Pt.Y)) Dim p As Double = (S1 + S2 + S3) / 2 Dim S As Double = Math.Sqrt(p * (p - S1) * (p - S2) * (p - S3)) Dim dis As Double = 2 * S / S1 Return dis End Function |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |