把该问题转换成一优化问题,可以很容易求解了:
参数:a, b;(范围【0,pi/4】)
目标函数:Min=(x1-x2)^2+(y1-y2)^2;
下面是1stOpt求解代码:
Parameter a=[0,pi/4], b=[0,pi/4];
ConstStr x1=(43.8406-3/cos(a))*cos(arcsin(sin(a)/2))/2,
y1=3*tan(a)+(43.8406-3/cos(a))*cos(arcsin(sin(a)/2))/2*tan(arcsin(sin(a)/2)),
x2=(43.0906-3/cos(b))*cos(arcsin(sin(b)/2))/2,
y2=3*tan(b)+(43.0906-3/cos(b))*cos(arcsin(sin(b)/2))/2*tan(arcsin(sin(b)/2))+3;
PassParameter x1,y1;
MinFunction (x1-x2)^2+(y1-y2)^2;
结果:
目标函数值(最小): 0
a: 0.367312507895687
b: 0.138557576068274
传递参数(PassParameter):
x1: 19.9829656302711
y1: 4.80162590716115
x1及y1即为所求交点坐标值。
[ 本帖最后由 dingd 于 2009-2-5 22:10 编辑 ] |