Hi, I have 2D closed path and I wanted to know the area (surface size) so I can figure out the amount of paint I need for that shape. (1.0f = one meter)
Here is what I found for a formula:
http://mathcentral.uregina.ca/QQ/database/QQ.09.06/graham1.htmlThe dude that completes this function the fastest and more efficient will get all the points
class point{
public:
float x, y;
point(){x = y = 0;}
set(float x_, float y_){x = x_ ; y = y_;}
}
void main(){
point[6];
//closed path points (2D volume)
point[0].set(0.1f, 1);
point[0].set(23, 0);
point[0].set(17, 4);
point[0].set(21, 12);
point[0].set(6, 8);
point[0].set(0, 13);
//formula to get the m^2 of the total surface goes here
printf(" surface is %f^2",result);
Start Free Trial