Class 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 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:
        getAttenuation in interface DirectivitySphere
        Parameters:
        frequency - Frequency in Hertz
        phi - (0 2π) with 0 is front
        theta - (-π/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:
        getAttenuationArray in interface DirectivitySphere
        Parameters:
        requestFrequencies - Frequency array in Hertz (same order will be returned)
        phi - (0 2π) with 0 is front
        theta - (-π/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 top
        phi - (0 2π) 0 is front
        attenuation - 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 radians
        phi - in radians
        interpolate - 0 for closest neighbor, 1 for Bilinear interpolation
        Returns:
        DirectivityRecord instance
      • coverFrequency

        public boolean coverFrequency​(double frequency)
        Check if this sphere is capable of producing an attenuation for this frequency
        Specified by:
        coverFrequency in interface DirectivitySphere
        Parameters:
        frequency - Frequency in Hertz
        Returns:
        a boolean