So say I am given a set of points:
0, 0
0, 5
5, 5
5, 3
4, 3
4, 2
5, 2
5, 0
0, 0
These points make up the border of a shape/object
The object looks like this:
__________
| |
| __|
| |__
| |
|__________|
How can I mathematically determine the area? (in the example it would be 24..)
Additionally and more importantly, how can mathematically determine the x, y coordinates of each 1 unit by 1 unit box inside? (in the example, some of the boxes would have coordinates at (0,0), (0, 1), (0, 2) and so on…)
If the shape is convex, you can break it down into triangles and then just sum the area of said triangles.
If the shapes are all rectangles (as in your example), then you just need sum the range between the start point and end point of each row.
If the shape is concave, then it’s substantially more difficult. More information here:
http://math.tutorvista.com/geometry/concave-polygon.html