Results 1 to 6 of 6

Thread: How to rotate a circle?!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112

    How to rotate a circle?!

    hi! How do I rotate a circle on the X and Y Axis?!

    here is the code I use to draw the circle..

    VB Code:
    1. Dim t As Double, x As Double, y As Double, r As Double, i As Integer
    2.    Const pi As Double = 3.14159265358979
    3.    r = 32
    4.    Me.Picture1.Cls
    5.    Me.Picture1.Circle (64, 64), r, vbRed 'original red circle of r=32 and center (64,64)
    6.    For i = 0 To 359
    7.       t = (i * pi) / 180 'angle of rotation, in radians
    8.       x = 64 + (r * Cos(t))
    9.       y = 64 + (r * Sin(t))
    10.       SetPixel Me.Picture1.hdc, x, y, vbYellow 'draw the circle point by point
    11.       DoEvents
    12.    Next i
    [vbcode]
    SetLayeredWindowAttributes hWnd, 0, 220, LWA_ALPHA
    [/vbcode]

  2. #2
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771
    A rotated circle is still a circle, you use the same code. What do you mean exactly? A 3D rotation?

  3. #3
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    What are you trying to do?

    you print a circle in red, OK
    after that
    you print a circle point by point in yellow,
    if your system is slow you maybe seeing the drawing, otherwise it will just look like you did draw a yellow circle

    But rotating the circle?, where is you startingpoint?, since you have no such point marked, the circle could be spinning, you would not see it!

    What'S the point??
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    Yes.. I want to make a 3d rotation.. (and dont bother about the red circle )

    I attach a picture to describe the rotation (hehe Im realy bad at painting )

    the radius of the circle should always be thesame, although it looks like an elipse!
    Attached Images Attached Images  
    Last edited by meteor; Apr 9th, 2003 at 08:07 AM.
    [vbcode]
    SetLayeredWindowAttributes hWnd, 0, 220, LWA_ALPHA
    [/vbcode]

  5. #5
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Start drawing the cirlce, erase it and draw an elipse (just the circle pressed topgether in the middle) ,erase that and draw an even more "pressed circle" cont. until you have a line and restart from there.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    I need the radius of the circle to be the same.

    Here is my little program..

    And when I turn left or right I want the planet to move
    in a circle around the ship...
    Attached Files Attached Files
    [vbcode]
    SetLayeredWindowAttributes hWnd, 0, 220, LWA_ALPHA
    [/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width