by Found on the World Wide Web (15 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (5 Votes)
The DegreesToXYsubroutine, calculates the X (horizontal) and Y (vertical) coordinates of any point, measured in degrees, on the circumference of a circle or ellipse.
Inputs
Pass the subroutine the center X, Y of your ellipse, the degree position,
and the horizontal and vertical radii (if they are equal, you're specifying a
circle, if not, it is an elongated ellipse).
Code Returns
Returns the coordinates in the X and Y parameters.
Public Sub DegreesToXY(CenterX As _
Long, CenterY As Long, degree _
As Double, radiusX As Long, _
radiusY As Long, X As Long, Y _
As Long)
Dim convert As Double
convert = 3.141593 / 180
'pi divided by 180
X = CenterX - (Sin(-degree * _
convert) * radiusX)
Y = CenterY - (Sin((90 + _
(degree)) * convert) * radiusY)
End Sub