Corey Ogburn

A Developing Developer

Circle Library

CirclesI started this particular project without an application in mind for the end product. Just one day, I noticed there was a Rectangle and RectangleF class, but no sort of class to help at all with circular representations (if there are, I still haven't found those classes). So I began putting together a couple classes: Circle and CircleF. Given an X,Y location and a radius, there's any multitude of things you can do. One of the more useful methods allows you to pick a point on the Circle given an angle in either Radians or Degrees (I'm lazy, so I made the method that did the Degree/Radian conversion for me so I wouldn't have to remember to do it). Not to mention, there are methods to check if two Circles overlap or if one entirely contains the other one. Also, you with explicit operator overloading, you can simply assign one type to the other and the result is basically the same as casting a float to an int and vice versa.

Regardless that I didn't have an intention for this when I started developing it, I've since found uses for it in a lot of my different projects, especially the Tower Defense I'm working on for you guys. These classes provide easy to use methods for implementing a circular proximity around something, and if there's a need to actually draw the circle, it's easy to do with the GetEnclosingRectangle method and the Graphics class's DrawEllipse and FillEllipse methods. These classes simplify so much, so I felt I should make these available for you all. Have fun!

Download my Circle Library here! Note that I may update these files every so often as the project progresses. Notable changes will warrant an updated page detailing what changed.

Search

Digsby

AdSense

Sign in