想知道怎么才能返回resultP的值,然后这个值是有resultP.x和resultP.y的,现在运行是返回空值。
namespace ConsoleApp2
{
class Point
{
public double x;
public double y;
}
}
namespace ConsoleApp2
{
class QFJH:AbstractCalculation
{
public override Point Crosscal(Point pa, Point pb, double a, double b)
{
Point resultP= new Point();
resultP.x = (pa.x * (1 / Math.Tan(b)) + pb.x * Math.Tan(a) - pa.y + pb.y) / ((1 / Math.Tan(a) + (1 / Math.Tan(b))));
resultP.y = (pa.y * (1 / Math.Tan(b)) + pb.y * Math.Tan(a) + pa.x - pb.x) / ((1 / Math.Tan(a) + (1 / Math.Tan(b))));
return resultP;
}
}
}
测试代码
Point paa= new Point();
paa.x = 1.0;
paa.y = 1.0;
Point pbb=new Point();
pbb.x = 5.5;
pbb.y = 6.6;
double aa = 45;
double bb = 63;
Point resultPP = new Point();
//角度前方交会计算
AbstractCalculation ac = new QFJH();
resultPP=ac.Crosscal(paa,pbb,aa,bb);