Hey folks.
This is a simple problem I ran in while working on my tile based game. The game bord is a 2D tileMap, sort of like a civilization board with cities, kingdoms etc.
Anyway, each city structure has a circle inside of it defiend as such:
quote:struct CircleRec
{
int row; //row center
int col; //col center
int radius;
};
The idea is I can use this circle to check the cities 'circle of influance'. Only problem is, I'm not quite sure how to check to see if any given point is within the circle.
I need to be able to pass a row value and a col value to a function that will either return true or false. As so:
quote:int IsInCircle(Circle C, int row, int col);
I now this is a simple problem, folks have probably done this a million times. But I sleped thrugh triganometry :D
Anyway, can anyone help me out? I would really apreciate it!
EDIT: Used quote instead of source tags. Looks nicer.
[edited by - psyjax on January 22, 2004 1:46:02 PM]