Let's say I have the coordinates 0, 0 as my center point. And I want to calculate an area that extrudes 6 tiles (1 tile being 1 unit) each direction from the center point, essentially building a rectangle that's 13x13 based on the center point.
This is what I have, but I feel as if that's not correct.
class Program
{
static Point AbsPos = new Point(0, 0);
static Point Rectangle;
static void Main(string[] args)
{
Rectangle = new Point(AbsPos.X * 13, AbsPos.Y * 13);
}
}
CodePudding user response:
For a grid of same-shaped tiles, the location of the center of a square has no influence on its area. A 13x13 square has an area of 169 regardless of whether it's located at 0,0 or 17,22. If your user is going to give you 6
as an input then you simply need to do:
Console.WriteLine(Math.Pow((2 * input) 1, 2));