- const double *m1_col = m1_data+i*4;
- const double *m2_col = m2_data+i*4;
-
- // Compute a normalized vector halfway between the two endpoints
- double half[3];
- double len = 0;
- for(unsigned j=0; j<3; ++j)
- {
- half[j] = (m1_col[j]+m2_col[j])/2;
- len += half[j]*half[j];
- }
- len = sqrt(len);
- for(unsigned j=0; j<3; ++j)
- half[j] /= len;
-
- // Compute correction factors for smooth interpolation
- double cos_half = m1_col[0]*half[0]+m1_col[1]*half[1]+m1_col[2]*half[2];
- double angle = acos(cos_half);
- tkf.axes[i].slope = (angle ? angle/tan(angle) : 1);
- tkf.axes[i].scale = cos_half;