Program code geeks only thanks

Discussion in 'Technical Analysis' started by Digs, Jul 28, 2010.

  1. Digs


  2. So you are asking for a function to determine the coordinates of an arbitrary point on the line between (X1,Y1) and (X2, Y2)?
  3. Digs


    cancel the request google saved the day

    'pythagorean theorem
    Public Shared Function Pythagorean_GetDistance(ByVal x1 As Double, ByVal x2 As Double, ByVal y1 As Double, ByVal y2 As Double) As Double
    'pythagorean theorem c^2 = a^2 + b^2
    'thus c = square root(a^2 + b^2)
    Dim a As Double = CDbl(x2 - x1)
    Dim b As Double = CDbl(y2 - y1)

    Return Math.Sqrt(a * a + b * b)
    End Function