Covered area of convex/concave shape
BlitzMax Forums/BlitzMax Programming/Covered area of convex/concave shape| 
 | ||
| How can I return a percentage of area covered?  It's a tricky beast. The convex or concave 2d shape would be covered by rects of various sizes only. Any math genius able to assist please? | 
| 
 | ||
| Go through all the rectangles and add up rectwidth*rectheight to get a total? | 
| 
 | ||
| Hmm perhaps it would be best to triangulate the shape then find the sum of each triangles area.  You want to turn your concave shape into convex triangles I think. If I recall any shape can be broken down into triangles and the area of a triangle is simply 1/2 base * height. You can get the formula here. http://www.mathgoodies.com/lessons/vol1/area_triangle.html Sadly I don't know how the best way to dynamically make triangles from a concave shape. | 
| 
 | ||
| I probally didnt explain it very well. Imagine a drawing on the floor, a shape such as a star made from 2d points. Now take a small block and place it on the shape. What area of the star is covered. (brain explodes) | 
| 
 | ||
| Break it into triangles, figure their dimensions, and do the math... Do you have specific sizes for the problem? |