class Point
{
public double x, y;
//构造函数
public Point(double x, double y)
{
this.x = x; this.y = y;
}
public double Distance(Point p)
{
return Math.Sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
}
}
private void button1_Click(object sender, EventArgs e)
{
int iPos1 = comboBox1.SelectedIndex;//获得当前选中行的索引
switch(iPos1)
{
case 0:
{
坐标正算 calculation1 = new 坐标正算();
calculation1.ShowDialog();
break;
}
case 1:
{
坐标反算 calculation2 = new 坐标反算();
calculation2.ShowDialog();
break;
}
}
int iPos2 = comboBox2.SelectedIndex;
switch(iPos2)
{
case 0:
{
角度前方交会 calulation3 = new 角度前方交会();
calulation3.ShowDialog();
break;
}
case 1:
{
角度后方交会 calulation4 = new 角度后方交会();
calulation4.ShowDialog();
break;
}
case 2:
{
距离交会 calulation5 = new 距离交会();
calulation5.ShowDialog();
break;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
double x1 = double.Parse(textBox1.Text);
double y1 = double.Parse(textBox2.Text);
double rad = double.Parse(textBox5.Text);
double distance = double.Parse(textBox6.Text);
textBox3.Text = Convert.ToString(x1 + Math.Cos(rad)*distance);
textBox4.Text = Convert.ToString(y1+Math.Sin(rad)*distance);
}
```csharp
private void button1_Click(object sender, EventArgs e)
{
double x1 = double.Parse(textBox3.Text);
double y1 = double.Parse(textBox4.Text);
double x2 = double.Parse(textBox5.Text);
double y2 = double.Parse(textBox6.Text);
Point p1 = new Point(x1, y1);
Point p2 = new Point(x2, y2);
textBox2.Text = Convert.ToString(p1.Distance(p2));//调用Point类中的Distance方法
double x = x2 - x1;
double y = y2 - y1;
double Z =x/ y;
double D;
if(x>0)
{
if(y>0)
{
D = Math.Atan(Z);
textBox1.Text = Convert.ToString(radtodms(D));
}
else
{
D = Math.Atan(Z) + 2 * Math.PI;
textBox1.Text = Convert.ToString(radtodms(D));
}
}
if(x==0)
{
if(y>0)
{
textBox1.Text = Convert.ToString(0);
}
else
{
D = Math.PI;
textBox1.Text = Convert.ToString(radtodms(D));
}
}
if(x<0)
{
D = Math.Atan(Z) + Math.PI;
textBox1.Text = Convert.ToString(D);
}
}
private void label8_Click(object sender, EventArgs e)
{
double x1 = double.Parse(textBox1.Text);
double y1 = double.Parse(textBox2.Text);
double x2 = double.Parse(textBox4.Text);
double y2 = double.Parse(textBox5.Text);
double α1 = double.Parse(textBox3.Text);
double α = radtodms(α1);
double β1 = double.Parse(textBox6.Text);
double β = radtodms(β1);
double Z1 = x1 / Math.Tan(β) + x2 / Math.Tan(α) - y1 + y2;
double D = 1 / Math.Tan(α) + 1 / Math.Tan(β);
double Z2 = y1 / Math.Tan(β) + y2 / Math.Tan(α) + x1 - x2;
double x3 = Z1 / D;
double y3 = Z2 / D;
textBox7.Text = Convert.ToString(x3);
textBox8.Text = Convert.ToString(y3);
}
private void button1_Click(object sender, EventArgs e)
{
double x1 = double.Parse(x1_textBox1.Text);
double y1 = double.Parse(y1_textBox2.Text);
double x2 = double.Parse(x2_textBox3.Text);
double y2 = double.Parse(y2_textBox4.Text);
double x3 = double.Parse(x3_textBox5.Text);
double y3 = double.Parse(y3_textBox6.Text);
double α = double.Parse(textBox7.Text);
double β = double.Parse(textBox8.Text);
double γ = double.Parse(textBox9.Text);
double A = Math.Atan((y3 - y1) / (x3 - x1)) - Math.Atan((y2 - y1) / (x2 - x1));
double B = Math.Atan((y1 - y2) / (x1 - x2)) - Math.Atan((y3 - y2)/(x3-x2));
double C = Math.Atan((y2 - y3) / (x2 - x3)) - Math.Atan((y1 - y3) / (x1 - x3));
double P1 = 1 / ((1 / (Math.Tan(A))) - (1 / Math.Tan(α)));
double P2 = 1 / ((1 / (Math.Tan(B))) - (1 / Math.Tan(β)));
double P3 = 1 / ((1 / (Math.Tan(C))) - (1 / Math.Tan(γ)));
double x4 = (P1 * x1 + P2 * x2 + P3 * x3) / (P1 + P2 + P3);
double y4 = (P1 * y1 + P2 * x2 + P3 * y3) / (P1 + P2 + P3);
x4_textBox10.Text = Convert.ToString(x4);
y4_textBox11.Text = Convert.ToString(y4);
}
private void button1_Click(object sender, EventArgs e)
{
double x1 = double.Parse(textBox1.Text);
double y1 = double.Parse(textBox2.Text);
double x2 = double.Parse(textBox3.Text);
double y2 = double.Parse(textBox4.Text);
double Dap = double.Parse(Dap_textBox5.Text);
double Dbp = double.Parse(Dbp_textBox6.Text);
Point A = new Point(x1, y1);
Point B = new Point(x2, y2);
double Dab = A.Distance(B);
double Za = Math.Acos((Dab * Dab + Dap * Dap - Dbp) / (2 * Dab * Dap));
double Zb = Math.Acos((Dab * Dab + Dbp * Dbp - Dap) / (2 * Dab * Dbp));
double Zab = Math.Atan((y2 - y1) / (x2 - x1));
double Zap = Zab - Za;
double Zbp = Zap + Zb;
double xp1 = x1 + Dap * Math.Cos(Zap);
double yp1 = y1 + Dap * Math.Sin(Zap);
double xp2 = x2 + Dbp * Math.Cos(Zbp);
double yp2 = y2 + Dbp * Math.Sin(Zbp);
double xp = (xp1 + xp2) / 2;
double yp = (yp1 + yp2) / 2;
textBox7.Text = Convert.ToString(xp);
textBox8.Text = Convert.ToString(yp);
}
如有不正确之处希望各位指出,非常感谢!!!
禁止抄袭!!!