求三角形面積。某三角形高是不斷變化的,問面積的最大值和面積的最小值?完全沒思路.... 囧求大俠指點思路...
2 回答
智慧大石
TA貢獻1946條經驗 獲得超3個贊
知道每個頂點坐標就可以求任意多邊形的面積。下面C#實現
public static double GetPolygonArea(List<PointF> points)
{
double Area = 0;
for(int i = 0; i < points.Count - 1; i++)
{
Area += (points[i].X * points[i + 1].Y - points[i + 1].X * points[i].Y) / 2;
}
Area += (points[points.Count - 1].X * points[0].Y - points[0].X * points[points.Count - 1].Y) / 2;
return Math.Abs(Area);
}
- 2 回答
- 0 關注
- 550 瀏覽
添加回答
舉報
0/150
提交
取消
