Class DiscreteDirectivitySphere
java.lang.Object
org.noise_planet.noisemodelling.emission.directivity.DiscreteDirectivitySphere
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionDiscreteDirectivitySphere(int directionIdentifier, double[] frequencies) DiscreteDirectivitySphere defines the discrete directional sphere -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDirectivityRecord(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)intGet the primary key of the directional sphere (a table with various directional sphere can be given by the user)double[]getRecord(double theta, double phi, int interpolate) Retrieve DirectivityRecord for the specified angle (theta, phi)Get the directivity records for a given Phi angleGet the directivity values for a given Theta anglevoidsetInterpolationMethod(int interpolationMethod) Set the interpolation method
-
Constructor Details
-
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 Details
-
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
Get the directivity values for a given Theta angle- Returns:
- List of the records
-
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
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
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
-