Manish Pansiniya’s Blog

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

Archive for the ‘Algorithm’ Category

Download books free – eBooks, Audio Books, .NET, ASP.NET, C#, Great Site

with 2 comments

Just went by one site which has really a good collection of books for free.

http://www.knowfree.net

Just ViSiT…and Download Good books for you!!! & Yes, dont forget to say thanks to me :P

Written by Manish

April 1, 2009 at 7:09 pm

Easiest Method to Find Point on Circle

without comments

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