Projector: fixed DOA calculation

This commit is contained in:
f4exb 2019-11-17 23:45:50 +01:00
parent d1b80524ea
commit 4d14f332bc
1 changed files with 8 additions and 7 deletions

View File

@ -70,18 +70,21 @@ Real Projector::run(const Sample& s)
}
break;
case ProjectionPhase:
v = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI;
v = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // normalize
break;
case ProjectionDOAP:
{
Real p = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // calculate phase. Assume phase difference between
v = acos(p) / M_PI; // two sources at half wavelength distance with sources axis as reference (positive side)
// calculate phase. Assume phase difference between two sources at half wavelength distance with sources axis as reference (positive side)
// cos(theta) = phi / 2*pi*k
Real p = std::atan2((float) s.m_imag, (float) s.m_real); // do not mormalize phi (phi in -pi..+pi)
v = acos(p/M_PI) / M_PI; // normalize theta
}
break;
case ProjectionDOAN:
{
Real p = std::atan2((float) s.m_imag, (float) s.m_real) / M_PI; // calculate phase. Assume phase difference between
v = -(acos(p) / M_PI); // two sources at half wavelength distance with sources axis as reference (negative source)
// calculate phase. Assume phase difference between two sources at half wavelength distance with sources axis as reference (negative source)
Real p = std::atan2((float) s.m_imag, (float) s.m_real); // do not mormalize phi (phi in -pi..+pi)
v = -acos(p/M_PI) / M_PI; // normalize theta
}
break;
case ProjectionDPhase:
@ -223,5 +226,3 @@ Real Projector::normalizeAngle(Real angle)
}
return angle;
}