三角函数计算中的问题
如图,
当角b设为0时得到4组数据
第3,4组数据,怎么样才能得到4.5而不是2.5
x0,y0 0,0
x1,y1 1,1
x2,y2 4.5,4.5
x,y 4.5,4.5 正确
x0,y0 0,0
x1,y1 1,-1
x2,y2 4.5,-4,5
x,y 4.5,-4,5 正确
x0,y0 0,0
x1,y1 -1,-1
x2,y2 -4.5,-4,5
x,y 2.5,2.5 错了
x0,y0 0,0
x1,y1 -1,1
x2,y2 -4.5,4,5
x,y 2.5,-2.5 错了
x0 = double.Parse(textBox1.Text);--------------------编程问答-------------------- d是啥?
y0 = double.Parse(textBox2.Text);
x1 = double.Parse(textBox3.Text);
y1 = double.Parse(textBox4.Text);
a = double.Parse(textBox9.Text) * Math.PI;
x2 = d*(x1-x0)/Math.Sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0))+x1;
y2 = d * (y1 - y0) / Math.Sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + y1;
b=Math.Atan((x1-x0)*(y1-y0));
x = x1 + d * Math.Cos(a+b);
y = y1 + d * Math.Sin(a+b);
textBox5.Text = ""+x2;
textBox6.Text = "" + y2;
textBox7.Text = "" + x;
textBox8.Text = "" + y;
textBox10.Text = "" + b/Math.PI+"pi";
补充:.NET技术 , .NET Framework