用C#编写的图形界面演示凸包。
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
g.FillEllipse(bPoint, e.X, e.Y, 5, 5);
list.Add(e.Location);
}
///
/// 凸包算法
///
///
///
private List BruteForceTu(List _list)
{
//记录极点对
List role = new List();
//遍历
for (int i = 0; i < _list.Count-1; i++)
{
for (int j = i+1; j < _list.Count; j++)
{
int a = _list[j].Y - _list[i].Y;
int b = _list[i].X - _list[j].X;
int c = _list[i].X * _list[j].Y - _list[i].Y * _list[j].X;
int count = 0;
//将所有点代入方程
2021-06-10 13:49:55
34KB
凸包
1