double angle4h(double v0[], double v1[]){ double cos_theta = (dot4h(v0, v1)) / (length4h(v0)*length4h(v1)); double theta; // theta = acos(cos_theta) * 180 / M_PI; theta = acos(cos_theta); #ifdef DEBUG printf("角度: %lf\n", theta); #endif return theta; }
// ベクトル間の角度 double angle4h(double v0[], double v1[]) { double cos_theta = 0; double length_0 = length4h(v0); double length_1 = length4h(v1); if (length_0 != 0.0 && length_1 != 0.0) { cos_theta = dot4h(v0, v1) / (length_0 * length_1); return acos(cos_theta); } else { return 0; } }