Class DiscreteDirectivitySphere
- java.lang.Object
-
- org.noise_planet.noisemodelling.emission.directivity.DiscreteDirectivitySphere
-
- All Implemented Interfaces:
DirectivitySphere
public class DiscreteDirectivitySphere extends Object implements DirectivitySphere
Describe Attenuation directivity over a sphere Values between specified angles are interpolated following an interpolation method (linear=1 by default or closest neighbor=0)- Author:
- Nicolas Fortin, Université Gustave Eiffel
-
-
Constructor Summary
Constructors Constructor Description DiscreteDirectivitySphere(int directionIdentifier, double[] frequencies)DiscreteDirectivitySphere defines the discrete directional sphere
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDirectivityRecord(double theta, double phi, double[] attenuation)Add angle attenuation record for the directivity spherevoidaddDirectivityRecords(Collection<DirectivityRecord> newRecords)Add new records.booleancoverFrequency(double frequency)Check if this sphere is capable of producing an attenuation for this frequencydoublegetAttenuation(double frequency, double phi, double theta)Returns the attenuation in dB for a particular frequency of the directivity pattern for a certain angle (phi, theta)double[]getAttenuationArray(double[] requestFrequencies, double phi, double theta)Returns the attenuation in dB of the directivity pattern at a given angle (phi, theta)intgetDirectionIdentifier()Get the primary key of the directional sphere (a table with various directional sphere can be given by the user)double[]getFrequencies()DirectivityRecordgetRecord(double theta, double phi, int interpolate)Retrieve DirectivityRecord for the specified angle (theta, phi)List<DirectivityRecord>getRecordsPhi()Get the directivity records for a given Phi angleList<DirectivityRecord>getRecordsTheta()Get the directivity values for a given Theta anglevoidsetInterpolationMethod(int interpolationMethod)Set the interpolation method
-
-
-
Constructor Detail
-
DiscreteDirectivitySphere
public DiscreteDirectivitySphere(int directionIdentifier, double[] frequencies)DiscreteDirectivitySphere defines the discrete directional sphere- Parameters:
directionIdentifier- primary key of the directional sphere (a table with various directional sphere can be given by the user)frequencies- array of frequencies (Hz)
-
-
Method Detail
-
setInterpolationMethod
public void setInterpolationMethod(int interpolationMethod)
Set the interpolation method- Parameters:
interpolationMethod- interpolation method between specified angles : 0 for closest neighbor, 1 for Bilinear interpolation
-
getRecordsTheta
public List<DirectivityRecord> getRecordsTheta()
Get the directivity values for a given Theta angle- Returns:
- List of the records
-
getRecordsPhi
public List<DirectivityRecord> getRecordsPhi()
Get the directivity records for a given Phi angle- Returns:
- List of the records
-
getDirectionIdentifier
public int getDirectionIdentifier()
Get the primary key of the directional sphere (a table with various directional sphere can be given by the user)- Returns:
- integer and primary key
-
getAttenuation
public double getAttenuation(double frequency, double phi, double theta)Returns the attenuation in dB for a particular frequency of the directivity pattern for a certain angle (phi, theta)- Specified by:
getAttenuationin interfaceDirectivitySphere- Parameters:
frequency- Frequency in Hertzphi- (0 2π) with 0 is fronttheta- (-π/2 π/2) with 0 is horizontal; π is top- Returns:
- Attenuation level in dB
-
getAttenuationArray
public double[] getAttenuationArray(double[] requestFrequencies, double phi, double theta)Returns the attenuation in dB of the directivity pattern at a given angle (phi, theta)- Specified by:
getAttenuationArrayin interfaceDirectivitySphere- Parameters:
requestFrequencies- Frequency array in Hertz (same order will be returned)phi- (0 2π) with 0 is fronttheta- (-π/2 π/2) with 0 is horizontal; π is top- Returns:
- Attenuation array level in dB
-
addDirectivityRecord
public void addDirectivityRecord(double theta, double phi, double[] attenuation)Add angle attenuation record for the directivity sphere- Parameters:
theta- (-π/2 π/2) 0 is horizontal; π is topphi- (0 2π) 0 is frontattenuation- Attenuation in dB
-
getFrequencies
public double[] getFrequencies()
- Returns:
- Frequencies of columns
-
getRecord
public DirectivityRecord getRecord(double theta, double phi, int interpolate)
Retrieve DirectivityRecord for the specified angle (theta, phi)- Parameters:
theta- in radiansphi- in radiansinterpolate- 0 for closest neighbor, 1 for Bilinear interpolation- Returns:
- DirectivityRecord instance
-
addDirectivityRecords
public void addDirectivityRecords(Collection<DirectivityRecord> newRecords)
Add new records. This function is much more efficient thanaddDirectivityRecord(double, double, double[])- Parameters:
newRecords- Records to push
-
coverFrequency
public boolean coverFrequency(double frequency)
Check if this sphere is capable of producing an attenuation for this frequency- Specified by:
coverFrequencyin interfaceDirectivitySphere- Parameters:
frequency- Frequency in Hertz- Returns:
- a boolean
-
-