推 licheer :非常謝謝! 03/08 23:47
※ 引述《licheer (HOPE)》之銘言:
: s:常數, x,y,t:已知數
: a = -(s-y) * tan(t) + x
: b = (s+y) * tan(t) + x
: c = -(s-x) * tan(t) + y
: 若已知 a,b,c, 解x,y,s
: 已經算出 t = -a/(2c) + b/(2c)
: 要怎麼算出 x,y呢? 謝謝
法1:
a = -(s-y) * tan(t) + x ...(1)
b = (s+y) * tan(t) + x ...(2)
c = -(s-x) * tan(t) + y ...(3)
(1)-(2) =>
(a-b) = -2s*tan(t)
s = (a-b) / [-2*tan(t)] 代入 (1)
a = -s * tan(t) + y*tan(t) + x
= (a-b)/2 + y*tan(t) + x
=> x = (a+b)/2 - y*tan(t) ...(4) 代入(3)
c = -s*tan(t) + x*tan(t) + y
= (a-b)/2 + (a+b)*tan(t)/2 - y*tan(t)^2 + y
=> y = [a-b + (a+b)*tan(t) - 2c] / [2*(tan(t)^2-1)] 代入(4)
x = (a+b)/2 - [(a-b)*tan(t) + (a+b)*tan(t)^2 - 2c*tan(t)] / [2*(tan(t)^2-1)]
= -[(a+b) + (a-b)*tan(t) - 2c*tan(t)] / [2*(tan(t)^2-1)]
再代t = -a/(2c) + b/(2c)即可
法2:
-tan(t) 1 tan(t)
令 A = [ tan(t) 1 tan(t) ]
-tan(t) tan(t) 1
s
X = [ x ]
y
a
B = [ b ]
c
=> A*X = B
X = inv(A) * B
1-tan(t)^2 tan(t)^2-1 0
inv(A) = [ -tan(t)-tan(t)^2 -tan(t)+tan(t)^2 2*tan(t)^2 ] / det(A)
tan(t)+tan(t)^2 -tan(t)+tan(t)^2 -2*tan(t)
其中 det(A) = -2*tan(t)*[1-tan(t)^2]
再把矩陣乘開即可
※ 編輯: ejialan 來自: 111.250.29.176 (03/08 21:01)
※ 編輯: ejialan 來自: 111.250.29.176 (03/08 21:07)