Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

Easiest Method to Find Point on Circle

leave a comment »

Following is the code to detect whether point is in circle or not :

public static bool IsPointInCircle(UnitPoint center, float radius, UnitPoint testPoint, float halflinewidth)
            float dist = Distance(center, testPoint);
            if ((dist >= radius – halflinewidth) && (dist <= radius + halflinewidth))
                return true;
            return false;


Parameter contains Center Point, radius and test point. halflinewidth is same as threshold value. So that it will check the point for Circle with some width provided in halflinewidth.

It finds distance from center and if that distance somehow in between radius and halflinewidth radius. 🙂 quite easy. Let me know if you need more detail into that.


Written by Manish

March 27, 2009 at 1:00 pm

Posted in .NET, .NET 3.0, Algorithm, OpenGL

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: