in vb.net or C# How can I program this ref:http://www.cc.gatech.edu/gvu/multimedia/nsfmmedia/graphics/elabor/math/mathfaq_lines.html x1,y1 x2,y2 The distance between two points (x1,y1) and (x2,y2) is found by using the Pythagorean Theorem: Distance = sqrt((x2-x1)^2 + (y2-y1)^2) I am using pixels integer at x and y
So you are asking for a function to determine the coordinates of an arbitrary point on the line between (X1,Y1) and (X2, Y2)?
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