Thread: Circles!! help

Results 1 to 5 of 5
  1. #1
    -Bl00d-'s Avatar
    Join Date
    Sep 2011
    Gender
    female
    Location
    Imma girl what about it?
    Posts
    481
    Reputation
    10
    Thanks
    53
    My Mood
    Twisted

    Circles!! help

    im trying to get a perfect circle going here
    im using this code below.
    its not exactly a perfect circle though
    more like a Octacontagon its circular but with rough edges
    any suggestions?

    Code:
    void circle(int rx, int ry, int r)
    {
    int x,y;
    double d;//detail
    const double pi = 3.14159265; //more or less
    for(d=0; d<=2*pi; d+=0.01) //you can play with the value to be added to d
    {
    x=rx+sin(d)*r;
    y=ry+sin(d+(pi/2))*r;
    putpixel(x,y);
    }
    }

    Successful buys: 20
    Successful sells: 4
    Successful trades: 9
    Scammed: 4

     
    https://www.mpgh.net/forum/490-vouches/560562-vouches.html

    ^^^^^^^^^^^
    vouche for me?

  2. #2
    Saltine's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    493
    Reputation
    104
    Thanks
    629
    Quote Originally Posted by -Bl00d- View Post
    im trying to get a perfect circle going here
    im using this code below.
    its not exactly a perfect circle though
    more like a Octacontagon its circular but with rough edges
    any suggestions?

    Code:
    void circle(int rx, int ry, int r)
    {
    int x,y;
    double d;//detail
    const double pi = 3.14159265; //more or less
    for(d=0; d<=2*pi; d+=0.01) //you can play with the value to be added to d
    {
    x=rx+sin(d)*r;
    y=ry+sin(d+(pi/2))*r;
    putpixel(x,y);
    }
    }

    If this is for a directX game construct 360 vertices one from each degree of rotation and then allow directX to render the necessary lines.
    Example code (i just wrote this up here, so there may be errors0
    Code:
    void render(int xLoc, int yLoc, int rad){
    //create pLine here, dont feel like looking up params list for D3DXCreateLine()
    D3DXVECTOR2 vec[360];
    for(int i = 0; i < 360; ++i){
    vec[i].x=xLoc+(rad*cos((i)*(PI/180)));
    vec[i].y=yLoc+(rad*sin((i)*(PI/180)));
    }
    pLine->Begin(); 
    pLine->Draw(vec,360,D3DCOLOR_XRGB(10,200,10)); 
    pLine->End(); 
    }

    Oh no! Vortex is gay!

  3. The Following User Says Thank You to Saltine For This Useful Post:

    -Bl00d- (01-14-2013)

  4. #3
    -Bl00d-'s Avatar
    Join Date
    Sep 2011
    Gender
    female
    Location
    Imma girl what about it?
    Posts
    481
    Reputation
    10
    Thanks
    53
    My Mood
    Twisted
    ahhh! Saltine your awesome dude!
    Successful buys: 20
    Successful sells: 4
    Successful trades: 9
    Scammed: 4

     
    https://www.mpgh.net/forum/490-vouches/560562-vouches.html

    ^^^^^^^^^^^
    vouche for me?

  5. The Following 2 Users Say Thank You to -Bl00d- For This Useful Post:

    kittens4life (01-14-2013),Saltine (01-14-2013)

  6. #4
    Saltine's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    493
    Reputation
    104
    Thanks
    629
    Quote Originally Posted by -Bl00d- View Post
    ahhh! Saltine your awesome dude!
    Oh, if you do create pLine every function call don't forget to do pLine->Release(); at the end of the function or it will leak memory like a bitch

    Oh no! Vortex is gay!

  7. The Following 3 Users Say Thank You to Saltine For This Useful Post:

    -Bl00d- (01-14-2013),[MPGH]Flengo (01-14-2013),kittens4life (01-14-2013)

  8. #5
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,591
    Reputation
    5180
    Thanks
    14,178
    My Mood
    Inspired
    I was about to mention Saltine to this thread since I know he loves circles. Guess he already got to it

    /Solved
    /Closed
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  9. The Following User Says Thank You to Flengo For This Useful Post:

    Saltine (01-14-2013)

Similar Threads

  1. [Help Request] Combat arms Vid help
    By djw111 in forum Combat Arms Help
    Replies: 4
    Last Post: 12-24-2011, 05:06 PM
  2. [Help Request] AFK Bot [help]
    By fet in forum Combat Arms Help
    Replies: 7
    Last Post: 04-28-2011, 03:17 AM
  3. [Help Request] Ajuda / Help
    By - Battery' in forum Combat Arms BR Coding Help
    Replies: 3
    Last Post: 04-22-2011, 07:15 PM
  4. [Help Request] Help my!
    By Windowns7 in forum Combat Arms BR Coding Help
    Replies: 2
    Last Post: 04-18-2011, 01:41 PM
  5. C++ help...I'm running in Circles
    By breakstuff2much in forum General Game Hacking
    Replies: 3
    Last Post: 05-05-2009, 09:31 PM