//формули за геометрични характеристики private double FGeom(Point p1, Point p2, geoType typ) { switch (typ) { case geoType.areaT: { return p1.XCoord*p2.YCoord-p2.XCoord*p1.YCoord; } case geoType.smomT: { return (p1.XCoord * p2.YCoord - p2.XCoord * p1.YCoord) * (p1.YCoord + p2.YCoord)/3;} case geoType.imomT: { return (p1.XCoord * p2.YCoord - p2.XCoord * p1.YCoord) * (Math.Pow(p1.YCoord + p2.YCoord,2) - p1.YCoord * p2.YCoord)/6; } default:{return 0;} } }
//цикъл за обхождане private double calcGeom(geoType typ) { double _S = FGeom(_vertex [_n - 1], _vertex [0] , typ); for (int i = 0; i < _n-1; i++) _S+=FGeom(_vertex [i], _vertex [i+1],typ); return _S; }