DistanceToPoint

<Extension()> _
    Public Function DistanceToPoint( _
       ByVal PointA As Point, ByVal PointB As Point) As Single
        Return Math.Sqrt( _
           (PointA.X - PointB.X) ^ 2 + _
           (PointA.Y - PointB.Y) ^ 2)
    End Function
Example:
' Triangle of pythagoras a^2=b^2+c^2
Dim ptA As New Point(3, 4)
Dim ptB As New Point(5, 6)
MsgBox(ptA.DistanceToPoint(ptB))

Description

Calculates the distance between two points

Details

Double click on the code to select all.

 

;