00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <math.h>
00024 #include <float.h>
00025
00026 #include "LocateSystem.hh"
00027
00028
00029 clLocateSystem::clLocateSystem ()
00030 {
00031 }
00032
00033
00034 clLocateSystem::~clLocateSystem ()
00035 {
00036 }
00037
00038
00039 bool clLocateSystem::Initialize (long lW, long lH, GDT fCoeff)
00040 {
00041 lWidth = lW;
00042 lHeight = lH;
00043 fWeight = fCoeff;
00044 lPointCount = lWidth * lHeight;
00045 try
00046 {
00047 fpResults = (GDT *) Results.Size(lPointCount * sizeof(GDT));
00048 fpFinal = (GDT *) Final.Size(lPointCount * sizeof(GDT));
00049 }
00050 catch (...)
00051 {
00052 return false;
00053 }
00054 DSP.Zero(fpResults, lPointCount);
00055 DSP.Zero(fpFinal, lPointCount);
00056 lResultCount = 0;
00057 return true;
00058 }
00059
00060
00061 void clLocateSystem::Add (const GDT *fpSubRes)
00062 {
00063 DSP.Add(fpResults, fpSubRes, lPointCount);
00064 lResultCount++;
00065 }
00066
00067
00068 void clLocateSystem::Process ()
00069 {
00070 GDT fScale = (GDT) 1 / lResultCount;
00071
00072 DSP.Mul(fpFinal, (GDT) 1 - fWeight, lPointCount);
00073 DSP.Mul(fpResults, fScale * fWeight, lPointCount);
00074 DSP.Add(fpFinal, fpResults, lPointCount);
00075
00076
00077 DSP.Zero(fpResults, lPointCount);
00078 lResultCount = 0;
00079 }
00080
00081
00082 void clLocateSystem::GetResults (GDT *fpDest)
00083 {
00084 DSP.Scale01(fpDest, fpFinal, lPointCount);
00085 }
00086