Aufgrund einer Wartung wird GitLab am 18.01. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 18.01. between 8:00 and 9:00 am.

Commit aee2f02b authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Change the radius filter to a distance filter

parent 9fe4b1f3
......@@ -38,11 +38,11 @@ Common Keys are:
"Filter2" : {
"@Name" : "Unknown",
"@Type" : "ReverberationRadiusFilter",
"@Type" : "DistanceFilter",
"@NextFilter" : "",
"@UsageMode" : 0,
"@InvertCondition" : false,
"@ReverberationRadius" : 5
"@DistanceThreshold" : 5
},
"Filter3" : {
......
......@@ -18,41 +18,41 @@ namespace ITA
///
/// \brief Reverberation radius filter
///
/// This class implements a reverberation radius filter.
/// When the receiver resides inside the reverberation radius around the source, the update is considered audible.
/// This class implements a distance filter.
/// This means, the update is considered audible, when the distance between source and receiver is smaller than the configured distance.
///
class ITA_SIMULATION_SCHEDULER_API CReverberationRadiusFilter : public IAudibilityFilter
class ITA_SIMULATION_SCHEDULER_API CDistanceFilter : public IAudibilityFilter
{
public:
///
/// \brief Configuration class for the reverberation radius filter.
/// \brief Configuration class for the distance filter.
///
struct ITA_SIMULATION_SCHEDULER_API ReverberationRadiusFilterConfig : public IAudibilityFilter::AudibilityFilterConfig
struct ITA_SIMULATION_SCHEDULER_API DistanceFilterConfig : public IAudibilityFilter::AudibilityFilterConfig
{
explicit ReverberationRadiusFilterConfig ( );
explicit DistanceFilterConfig ( );
double dReverberationRadius = 5.0;
double dDistanceThreshold = 5.0;
VistaPropertyList Store ( ) const override;
void Load ( const VistaPropertyList& oProperties ) override;
};
CReverberationRadiusFilter ( ) = delete;
CDistanceFilter ( ) = delete;
///
/// \brief Constructor for a CReverberationRadiusFilter.
/// \brief Constructor for a CDistanceFilter.
///
/// This constructor configures the CReverberationRadiusFilter with the given \p oConfig.
/// \param oConfig the configuration for the CReverberationRadiusFilter.
/// This constructor configures the CDistanceFilter with the given \p oConfig.
/// \param oConfig the configuration for the CDistanceFilter.
///
explicit CReverberationRadiusFilter ( const ReverberationRadiusFilterConfig& oConfig );
explicit CDistanceFilter ( const DistanceFilterConfig& oConfig );
//
///
/// \brief Check if the change between \p previousState and \p newUpdate is audible.
///
/// The change between \p previousState and \p newUpdate is audible when the receiver resides inside the configured radius around the source.
/// The change between \p previousState and \p newUpdate is audible when the distance between the source and receiver is smaller than the configured distance threshold.
/// \param previousState the previous state of the scene to check against.
/// \param newUpdate the CUpdateScene to check for audibility.
/// \return true if the change between \p previousState and \p newUpdate is audible, else false.
......@@ -73,9 +73,9 @@ namespace ITA
private:
///
/// \brief The reverberation radius of the filter.
/// \brief The distance threshold of the filter.
///
double m_dReverberationRadius;
double m_dDistanceThreshold;
};
} // namespace AudibilityFilter
} // namespace SimulationScheduler
......
......@@ -25,8 +25,8 @@ namespace ITA
CAudibilityFilterFactory::m_mFilters = {
{CRateFilter::GetType ( ),
{ CRateFilter::CreateFilter, std::make_shared<CRateFilter::RateFilterConfig> } },
{CReverberationRadiusFilter::GetType ( ),
{ CReverberationRadiusFilter::CreateFilter, std::make_shared<CReverberationRadiusFilter::ReverberationRadiusFilterConfig> } },
{CDistanceFilter::GetType ( ),
{ CDistanceFilter::CreateFilter, std::make_shared<CDistanceFilter::DistanceFilterConfig> } },
{CRotationFilter::GetType ( ),
{ CRotationFilter::CreateFilter, std::make_shared<CRotationFilter::RotationFilterConfig> } },
{CTranslationFilter::GetType ( ),
......
......@@ -14,31 +14,31 @@ namespace ITA
{
namespace AudibilityFilter
{
CReverberationRadiusFilter::ReverberationRadiusFilterConfig::ReverberationRadiusFilterConfig ( ) : AudibilityFilterConfig ( GetType ( ) )
CDistanceFilter::DistanceFilterConfig::DistanceFilterConfig ( ) : AudibilityFilterConfig ( GetType ( ) )
{ }
VistaPropertyList CReverberationRadiusFilter::ReverberationRadiusFilterConfig::Store ( ) const
VistaPropertyList CDistanceFilter::DistanceFilterConfig::Store ( ) const
{
auto oProperties = AudibilityFilterConfig::Store ( );
oProperties.SetValue ( reverberationRadiusFilterReverberationRadiusKey, dReverberationRadius );
oProperties.SetValue ( distanceFilterDistanceThresholdKey, dDistanceThreshold );
return oProperties;
}
void CReverberationRadiusFilter::ReverberationRadiusFilterConfig::Load ( const VistaPropertyList& oProperties )
void CDistanceFilter::DistanceFilterConfig::Load ( const VistaPropertyList& oProperties )
{
AudibilityFilterConfig::Load ( oProperties );
oProperties.GetValue ( reverberationRadiusFilterReverberationRadiusKey, dReverberationRadius );
oProperties.GetValue ( distanceFilterDistanceThresholdKey, dDistanceThreshold );
}
CReverberationRadiusFilter::CReverberationRadiusFilter ( const ReverberationRadiusFilterConfig& oConfig )
CDistanceFilter::CDistanceFilter ( const DistanceFilterConfig& oConfig )
{
m_dReverberationRadius = oConfig.dReverberationRadius;
m_dDistanceThreshold = oConfig.dDistanceThreshold;
}
bool CReverberationRadiusFilter::ChangeIsAudible ( const CUpdateScene& previousState,
bool CDistanceFilter::ChangeIsAudible ( const CUpdateScene& previousState,
const CUpdateScene& newUpdate ) const
{
PROFILER_FUNCTION ( );
......@@ -48,18 +48,20 @@ namespace ITA
const auto distance = newSourceReceiverPair.source->GetPosition ( ) - newSourceReceiverPair.receiver->GetPosition ( );
return distance.GetLength ( ) < m_dReverberationRadius;
const auto distanceLength = distance.GetLength ( );
return distanceLength < m_dDistanceThreshold;
}
std::string CReverberationRadiusFilter::GetType ( )
std::string CDistanceFilter::GetType ( )
{
return "ReverberationRadiusFilter";
return "DistanceFilter";
}
std::unique_ptr<IAudibilityFilter> CReverberationRadiusFilter::CreateFilter (
std::unique_ptr<IAudibilityFilter> CDistanceFilter::CreateFilter (
const std::shared_ptr<IAudibilityFilter::AudibilityFilterConfig>& pConfig )
{
return std::make_unique<CReverberationRadiusFilter> ( dynamic_cast< const ReverberationRadiusFilterConfig& >( *pConfig ) );
return std::make_unique<CDistanceFilter> ( dynamic_cast< const DistanceFilterConfig& >( *pConfig ) );
}
} // namespace AudibilityFilter
} // namespace SimulationScheduler
......
......@@ -49,7 +49,7 @@ namespace ITA
const std::string rotationFilterReceiverThresholdKey = "@ReceiverThreshold";
const std::string rotationFilterRotationModeKey = "@RotationMode";
const std::string reverberationRadiusFilterReverberationRadiusKey = "@ReverberationRadius";
const std::string distanceFilterDistanceThresholdKey = "@DistanceThreshold";
const std::string rateFilterRateKey = "@Rate";
......
......@@ -244,11 +244,12 @@ INSTANTIATE_TEST_CASE_P ( RotationFilterTest, RotationFilterTest, testing::Value
RotationFilterTestParam { false, {0,0,0}, {0,1,0}, 0, {1,0,0.01f}, {0,1,0}, 0, CRotationFilter::RotationModes::absolute }, //30
RotationFilterTestParam { false, {0,0,0}, {0,1,0}, 0, {1,0,42}, {0,1,0}, 0, CRotationFilter::RotationModes::absolute } ) ); //31
TEST ( ReverberationRadiusFilter, correctResult )
TEST ( DistanceFilter, correctResult )
{
const auto conf = CReverberationRadiusFilter::ReverberationRadiusFilterConfig ( ); // radius 5m
auto conf = CDistanceFilter::DistanceFilterConfig ( );
conf.dDistanceThreshold = 5;
CReverberationRadiusFilter filter ( conf );
CDistanceFilter filter ( conf );
CUpdateScene oldUpdate ( 0 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment