示例#1
0
        public static double TinhDienTichDaGiac(DaGiac d)
        {
            double res = 0;
            int    j   = d.Points.Count - 1;

            for (int i = 0; i < d.Points.Count; i++)
            {
                res += d.Points[i].x * d.Points[j].y - d.Points[j].x * d.Points[i].y;
                j    = i;
            }
            return(Math.Abs(res) / 2);
        }
示例#2
0
        public static double TinhChuViDaGiac(DaGiac d)
        {
            double res = 0;
            int    j   = d.Points.Count - 1;

            for (int i = 0; i < d.Points.Count; i++)
            {
                res += Coordinate.TinhKhoangCach(d.Points[i], d.Points[j]);
                j    = i;
            }
            return(res);
        }