VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



DegreesToXYsubroutine

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.

Rate DegreesToXYsubroutine

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

Download this snippet    Add to My Saved Code

DegreesToXYsubroutine Comments

No comments have been posted about DegreesToXYsubroutine. Why not be the first to post a comment about DegreesToXYsubroutine.

Post your comment

Subject:
Message:
0/1000 characters