| 2.1.17.1.1 ocmath_d_polygon_area
 DescriptionThis function is used to calculate the signed area of a planar non-self-intersecting polygon. If the vertices of the polygon are /math-87bf7f7674db609708565c1b143b0523.png?v=0) , the area is: /math-a25a2f7386690fbe52efad33a94c1a44.png?v=0) 
 /math-883efd85058df96df4d2a9a613596069.png?v=0) 
 For the area of a convex polygon, if the points are arranged anticlockwise, the area will be positive, and if clockwise, will be negative.
 Data types supported:
 double:			ocmath_d_polygon_area
 float: 			ocmath_f_polygon_area
 POINT:			ocmath_l_polygon_area
 Syntaxdouble ocmath_d_polygon_area(double* pX, double* pY, uint nSize) Parameters pX[input] buffer containing X data of polygon vertexes pY[input] buffer containing Y data of polygon vertexes nSize[input] size of pX, pY
 ReturnPolygon area.
 ExamplesEX1
 //For this example to run, make sure a worksheet is active in current project
void ocmath_d_polygon_area_ex1()
{
	Worksheet wks = Project.ActiveLayer();
	wks.SetSize(-1,2);
	DataRange dr;
	dr.Add("X", wks, 0, 0, -1, 0);
	dr.Add("Y", wks, 0, 1, -1, 1);
	
	vector vxData, vyData;
	DWORD dwPlotID;
    if(dr.GetData(DRR_GET_MISSING | DRR_GET_DEPENDENT | DRR_NO_FACTORS, 0, &dwPlotID, NULL, &vyData, &vxData) < 0)
    {
    		printf("get data failed!");
    		return;
    }
    
	uint nSize = vxData.GetSize();
	double  area = ocmath_d_polygon_area(vxData, vyData, nSize);
    out_double("area=", area);
}RemarkSee Alsoocmath_f_polygon_area, ocmath_l_polygon_area
 Header to Includeorigin.h
 Reference |