- Home
·
- Math/Dates
·
- Draws a line from XStart, YStart at the angle passed in Degrees. LineLen is the length, and LineCol
Draws a line from XStart, YStart at the angle passed in Degrees. LineLen is the length, and LineCol
Draws a line from XStart, YStart at the angle passed in Degrees. LineLen is the length, and LineColor is the color of the line in QBColor
Rate Draws a line from XStart, YStart at the angle passed in Degrees. LineLen is the length, and LineCol
(2(2 Vote))
YStart As Integer, LineLen As Integer, LineColor As Byte)
' Draws a line from XStart, YStart at the angle passed in Degrees.
' LineLen is the length, and LineColor is the color of the line
' in QBColor values from 0 to 15.
' This assumes that zero degrees is up from the center, and
' increasing numbers are in a clockwise direction.
Dim LineXEnd As Integer
Dim LineYEnd As Integer
Dim Radians As Single
Dim PI As Single
PI = 3.141592654
Do Until Degrees < 360
Degrees = Degrees - 360
Loop
Select Case Degrees
Case 0
LineXEnd = XStart
LineYEnd = YStart - LineLen
Case Is > 0 And Degrees < 90
Radians = Degrees * (PI / 180)
LineXEnd = XStart + (Sin(Radians) * LineLen)
LineYEnd = YStart - (Cos(Radians) * LineLen)
Case 90
LineXEnd = XStart + LineLen
LineYEnd = YStart
Case Is > 90 And Degrees < 180
Radians = Degrees * (PI / 180)
LineXEnd = XStart + (Sin(Radians) * LineLen)
LineYEnd = YStart - (Cos(Radians) * LineLen)
Case 180
LineXEnd = XStart
LineYEnd = YStart + LineLen
Case Is > 180 And Degrees < 270
Radians = Degrees * (PI / 180)
LineXEnd = XStart + (Sin(Radians) * LineLen)
LineYEnd = YStart - (Cos(Radians) * LineLen)
Case 270
Radians = Degrees * (PI / 180)
LineXEnd = XStart + (Sin(Radians) * LineLen)
LineYEnd = YStart - (Cos(Radians) * LineLen)
Case Else
Radians = Degrees * (PI / 180)
LineXEnd = XStart + (Sin(Radians) * LineLen)
LineYEnd = YStart - (Cos(Radians) * LineLen)
End Select
Me.Line (XStart, YStart)-(LineXEnd, LineYEnd), QBColor(LineColor)
End Sub
Draws a line from XStart, YStart at the angle passed in Degrees. LineLen is the length, and LineCol Comments
No comments yet — be the first to post one!
Post a Comment