Archive for the ‘Algorithm’ Category
Download books free – eBooks, Audio Books, .NET, ASP.NET, C#, Great Site
Just went by one site which has really a good collection of books for free.
Just ViSiT…and Download Good books for you!!! & Yes, dont forget to say thanks to me
Easiest Method to Find Point on Circle
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;
}
{
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.