16 tfloat alpha12 = alpha2 - alpha1 ;
17 tfloat alpha23 = alpha3 - alpha2 ;
19 tfloat alpha13 = alpha12 + alpha23 ;
21 tfloat L12_2 = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) ;
22 tfloat L23_2 = (x3-x2)*(x3-x2) + (y3-y2)*(y3-y2) ;
23 tfloat L13_2 = (x3-x1)*(x3-x1) + (y3-y1)*(y3-y1) ;
24 tfloat L12 = sqrt( L12_2 ) ;
25 tfloat L23 = sqrt( L23_2 ) ;
26 tfloat L13 = sqrt( L13_2 ) ;
28 tfloat cosA123 = ( L12_2 + L23_2 - L13_2 ) / ( 2 * L12 * L23 ) ;
29 tfloat cosA213 = ( L12_2 + L13_2 - L23_2 ) / ( 2 * L12 * L13 ) ;
30 tfloat cosA132 = ( L13_2 + L23_2 - L12_2 ) / ( 2 * L13 * L23 ) ;
32 tfloat A123 = acos( cosA123 ) ;
33 tfloat A213 = acos( cosA213 ) ;
34 tfloat A132 = acos( cosA132 ) ;
36 tfloat sinA123 = Sin( A123 ) ;
38 tfloat sin_alpha12 = Sin( alpha12 ) ;
39 tfloat sin_alpha13 = Sin( alpha13 ) ;
40 tfloat cos_alpha13 = Cos( alpha13 ) ;
43 tfloat Ap12 = - atan( (L23*sin_alpha12*(sin_alpha13*cosA123 - cos_alpha13*sinA123)) / (L12*Sin(alpha23) + L23*sin_alpha12*(cos_alpha13*cosA123 + sin_alpha13*sinA123) ) ) ;
44 tfloat A23p = A123 - Ap12 - alpha13 ;
46 tfloat tau = atan2( (y3-y1) , (x3-x1) ) ;
47 tfloat cos_tau = Cos( tau ) ;
48 tfloat sin_tau = Sin( tau ) ;
50 tfloat T1 = Tan( A23p + A132 ) ;
51 tfloat T2 = Tan( Ap12 + A213 ) ;
53 tfloat x_ = L13 * T1 / ( T2 + T1 ) ;
56 *x = x_ * cos_tau - y_ * sin_tau + x1 ;
57 *y = x_ * sin_tau + y_ * cos_tau + y1 ;
double tfloat
Defines the type for float/double.