sid_galt
- 502
- 1
<br />
A=-[(x_i-X_j)cos\theta_j + (y_i-Y_J)sin\theta_j]<br />
<br /> B = (x_i-X_j)^2+(y_i-Y_j)^2<br />
<br /> E=(B-A^2)^{1/2}=(x_i-X_j)sin\theta_j+(y_i-Y_j)\theta_j<br />
I implemented this in C++ as follows
A = -(p_c(0)(i) - p_v(0)(j))*cos(angle(j)) - (p_c(1)(i) - p_v(1)(j))*sin(angle(j))
B = (p_c(0)(i) - p_v(0)(j))*(p_c(0)(i) - p_v(0)(j)) + (p_c(1)(i) - p_v(1)(j))*(p_c(1)(i) - p_v(1)(j))
E=(p_c(0)(i) - p_v(0)(j))*sin(angle(j)) + (p_c(1)(i) - p_c(1)(j))*cos(angle(j))
F= sqrt(B-A*A)
(All parantheses instead of square brackets in arrays to avoid HTML encoding)
where
p_c(0)(i) =x_i
p_c(1)(i) = y_i
p_v(0)(j) = X_j
p_v(1)(j) = Y_j
angle(j) = \theta_j
Well, here's the deal. Mathematically
E=(B-A^2)^{1/2}=(x_i-X_j)sin\theta_j+(y_i-Y_j)\theta_j
However in C++, I am getting different values for E and F in C++ when mathematically they are the same. I am going insane.
Please help
<br /> B = (x_i-X_j)^2+(y_i-Y_j)^2<br />
<br /> E=(B-A^2)^{1/2}=(x_i-X_j)sin\theta_j+(y_i-Y_j)\theta_j<br />
I implemented this in C++ as follows
A = -(p_c(0)(i) - p_v(0)(j))*cos(angle(j)) - (p_c(1)(i) - p_v(1)(j))*sin(angle(j))
B = (p_c(0)(i) - p_v(0)(j))*(p_c(0)(i) - p_v(0)(j)) + (p_c(1)(i) - p_v(1)(j))*(p_c(1)(i) - p_v(1)(j))
E=(p_c(0)(i) - p_v(0)(j))*sin(angle(j)) + (p_c(1)(i) - p_c(1)(j))*cos(angle(j))
F= sqrt(B-A*A)
(All parantheses instead of square brackets in arrays to avoid HTML encoding)
where
p_c(0)(i) =x_i
p_c(1)(i) = y_i
p_v(0)(j) = X_j
p_v(1)(j) = Y_j
angle(j) = \theta_j
Well, here's the deal. Mathematically
E=(B-A^2)^{1/2}=(x_i-X_j)sin\theta_j+(y_i-Y_j)\theta_j
However in C++, I am getting different values for E and F in C++ when mathematically they are the same. I am going insane.
Please help
Last edited: