00001 /* 00002 00003 Direction calculation from spectrum 00004 Copyright (C) 2000-2001 Jussi Laako 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 00023 #include <stdio.h> 00024 #include <math.h> 00025 #include <float.h> 00026 00027 #include "SpectDir2.hh" 00028 00029 00030 clSpectDir2::clSpectDir2 () 00031 { 00032 fPI = acos(-1.0); 00033 } 00034 00035 00036 clSpectDir2::~clSpectDir2 () 00037 { 00038 } 00039 00040 00041 void clSpectDir2::SetSensorSpacing (GDT fSpacing) 00042 { 00043 fSensorSpacing = fSpacing; 00044 } 00045 00046 00047 void clSpectDir2::SetSoundSpeed (GDT fSoundSpeed) 00048 { 00049 fArrayFreq = fSoundSpeed / fSensorSpacing / 2; 00050 } 00051 00052 00053 GDT clSpectDir2::GetDirection (GDT fFrequency, GDT fDPhase) 00054 { 00055 GDT fDf; 00056 GDT fDirection; 00057 00058 fDf = fArrayFreq / fFrequency; 00059 fDirection = fDf * (fDPhase / 2); 00060 return fDirection; 00061 } 00062
1.3.3