• Advertisement

Archived

This topic is now archived and is closed to further replies.

Spinning Line!!

This topic is 6072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can some one plz explain to me how to make a simple line spin in visual basic? I''ve been looking for a way for days now, and am coming up empty handed! If someone write the code that would be a little better.. thx

Share this post


Link to post
Share on other sites
Advertisement
Well, I don''t know how to do it in Visual Basic, but, regardless, it''ll take a little Trig.

Basically, you''ll want to have 2 variables: Degree of Line (between 0 and 360) and Radius of circle(the length of the line).

Then, what you''ll do is this:
You have an X,Y which is center of your circle, and Radius.

You basically loop through, incrementing the degree of the angle, then figure out where the end of the line is and draw it
ie:
Xlength = Cos (angle in radians)/Radius
Ylength = Sin (angle in radians)/Radius

DrawLine(X, Y, X + Xlength, Y + Ylength);

to get radians, you take the degrees and multiply by Pi/180

Hope that helps some.

Share this post


Link to post
Share on other sites

  • Advertisement