Algoritmo de dibujo lineal de Bresenham VB.NET
Algoritmo de dibujo lineal de Bresenham EN VISUAL BASIC.NET Public Sub DrawLine(ByRef btmp As Bitmap, ByVal x As Integer, ByVal y As Integer, _ ByVal endX As Integer, ByVal endY As Integer, ByVal newColor As Color) Dim dx As Integer = Math.Abs(endX - x) ' calculate the change in x Dim dy As Integer = Math.Abs(endY - y) ' calculate the change in y Dim sx As Integer = Math.Sign(endX - x) ' calculate the sign of the change in x (pos/neg) Dim sy As Integer = Math.Sign(endY - y) ' calculate the sign of the change in y (pos/neg) Dim err As Integer = dx - dy ' calculate error (change in x minus change in y) Dim e2 As Integer = 0 ' initialize twice error to zero ' while the (x,y) vertex is not equal ' to any of the (endX,endY) coord...