Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Finding a Point on a Circle

Finding a Point on a Circle

Scheduled Pinned Locked Moved C#
csharpcssvisual-studiohelpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    max29297
    wrote on last edited by
    #1

    This is kind of a tough problem... I'm trying to make a function that will give me the point (in x, y format) on a circle at x degrees. I was thinking somewhere along the lines of...

    public Point GetPointOnCircle(int circleX, int circleY, int circleWidth, int circleHeight, int degrees) {
    // do some calculating...
    return new Point(x, y);
    }

    I've tried to make it on my own, but it's just not working for me... Does anyone have any ideas?

    ----- *** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***

    C B 2 Replies Last reply
    0
    • M max29297

      This is kind of a tough problem... I'm trying to make a function that will give me the point (in x, y format) on a circle at x degrees. I was thinking somewhere along the lines of...

      public Point GetPointOnCircle(int circleX, int circleY, int circleWidth, int circleHeight, int degrees) {
      // do some calculating...
      return new Point(x, y);
      }

      I've tried to make it on my own, but it's just not working for me... Does anyone have any ideas?

      ----- *** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The way to do this is trig. If you know the centre point, then you can build right angle triangles from there and use trig to determine both the x and y point of the triangle for a given angle, use the radius as the length of the hypotenuse. In this way, you can plot your points by stepping around in a circle.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • M max29297

        This is kind of a tough problem... I'm trying to make a function that will give me the point (in x, y format) on a circle at x degrees. I was thinking somewhere along the lines of...

        public Point GetPointOnCircle(int circleX, int circleY, int circleWidth, int circleHeight, int degrees) {
        // do some calculating...
        return new Point(x, y);
        }

        I've tried to make it on my own, but it's just not working for me... Does anyone have any ideas?

        ----- *** Never give me an answer having anything to do with Visual Studio. I don't have this because I have two computers, one being my dad's mac, which is connected to the internet, the other being my pc, which is, sadly, not connected to the internet. The setup for the Visual C# program I think is called a "bootstrap" program, and it needs to connect to the internet to install the program. THEREFORE I cannot install this program onto my pc.***

        B Offline
        B Offline
        blackjack2150
        wrote on last edited by
        #3

        It's not tough at all if you've done some algebra in high-school. What you want is to convert polar coordinates to rectangular coordinates. Skipping all the explanations, the coordinates of the point will be: x = r * cos(u) y = r * sin(u) ,where r is the radius of the circle and u is the angle measured beginning from "3 o'clock" and going counterclockwise.

        M 1 Reply Last reply
        0
        • B blackjack2150

          It's not tough at all if you've done some algebra in high-school. What you want is to convert polar coordinates to rectangular coordinates. Skipping all the explanations, the coordinates of the point will be: x = r * cos(u) y = r * sin(u) ,where r is the radius of the circle and u is the angle measured beginning from "3 o'clock" and going counterclockwise.

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          One small additional hint: the angle has to be in radians ( 0 - 2*π ), not degrees. I think this must be said because max12345 seems not to be familiar with elementary trigonometry at all.

          Regards, mav -- Black holes are the places where God divided by 0...

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups