/// Gets a `Vector3D` pointing to the centre the bin.
Gets a `Vector3D` pointing to the centre the bin.
Gets a ` Vector3D ` pointing to the centre the bin .
pub fn bin_dir(&self, nbin: usize) -> Vector3D {
        if nbin == 0 {
            // Ground
            return Vector3D::new(0., 0., -1.);
        }
        if nbin == self.n_bins - 1 {
            // Cap
            return Vector3D::new(0., 0., 1.);
        }
        // Error
        if nbin > self.n_bins {
            panic!("Trying to get direction to a bin out of bounds... found {} but only {} are available", nbin, self.n_bins);
        }
        /*******************/
        /* ALL OTHER CASES */
        /*******************/
        // First, find the row in which this bin is located
        // and then extract the altitude from it.
        let row = self.bins_row(nbin);
        // Calculate the altitude angle.
        let (min_alt, max_alt) = self.row_altitude(row);
        let alt = (min_alt + max_alt) / 2.;
        // Now, calculate the azimuth
        let prev_bins = self.raccum(row);
        let n_bins = bins_in_row(self.mf, row);
        let bin_width = 2. * PI / n_bins as Float;
        let azi = bin_width * (nbin - prev_bins - 1) as Float;
        // Compute
        let cos_ralt = alt.cos();
        let dx = azi.sin() * cos_ralt;
        let dy = azi.cos() * cos_ralt;
        let dz = alt.sin();
        // if (solidAngle != NULL) {
        //     if (row == (n_rows-1)) {
        //         // if polar cap
        //         *solidAngle = coneSolidAngle(RAH/2.0);
        //     }
        //     else {
        //         *solidAngle = 2.0 * PI * (sin(alt + RAH/2.0)-sin(alt - RAH/2.0)) / (double)nBins;
        //     }
        // }
        Vector3D::new(dx, dy, dz)
    }
pub fn bin_dir ( & self , nbin : usize ) -> Vector3D { if nbin == 0 { // Ground return Vector3D :: new ( 0. , 0. , - 1. ) ; } if nbin == self . n_bins - 1 { // Cap return Vector3D :: new ( 0. , 0. , 1. ) ; } // Error if nbin > self . n_bins { panic ! ( " " nbin self n_bins ) ; } /*******************/ /* ALL OTHER CASES */ /*******************/ // First, find the row in which this bin is located // and then extract the altitude from it. let row = self . bins_row ( nbin ) ; // Calculate the altitude angle. let ( min_alt , max_alt ) = self . row_altitude ( row ) ; let alt = ( min_alt + max_alt ) / 2. ; // Now, calculate the azimuth let prev_bins = self . raccum ( row ) ; let n_bins = bins_in_row ( self . mf , row ) ; let bin_width = 2. * PI / n_bins as Float ; let azi = bin_width * ( nbin - prev_bins - 1 ) as Float ; // Compute let cos_ralt = alt . cos ( ) ; let dx = azi . sin ( ) * cos_ralt ; let dy = azi . cos ( ) * cos_ralt ; let dz = alt . sin ( ) ; // if (solidAngle != NULL) { //     if (row == (n_rows-1)) { //         // if polar cap //         *solidAngle = coneSolidAngle(RAH/2.0); //     } //     else { //         *solidAngle = 2.0 * PI * (sin(alt + RAH/2.0)-sin(alt - RAH/2.0)) / (double)nBins; //     } // } Vector3D :: new ( dx , dy , dz ) }
Gets a `Vector3D` pointing to the centre the bin.
Gets a ` Vector3D ` pointing to the centre the bin .
&self
nbin
usize