Search Tools Links Login

DegreesToXYsubroutine


Visual Basic 6, or VB Classic

The DegreesToXYsubroutine, calculates the X (horizontal) and Y (vertical) coordinates of any point, measured in degrees, on the circumference of a circle or ellipse.

Original Author: Found on the World Wide Web

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).

Returns

Returns the coordinates in the X and Y parameters.

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 115 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.