Initial snark14m import
[snark14.git] / src / snark / nav4.cpp
1 /*
2 ***********************************************************
3 $SNARK_Header: S N A R K  1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/nav4.cpp $
5 $LastChangedRevision: 49 $
6 $Date: 2014-06-16 21:49:04 -0400 (Mon, 16 Jun 2014) $
7 $Author: olangthaler $
8 ***********************************************************
9
10 *************************************************************************************
11 Dummy class for the calculation of the non-ascending vector corresponding to sec_cri3
12 *************************************************************************************
13 */
14
15 #include "nav4.h"
16 #include "math.h"
17 #include "anglst.h"
18 #include "blob.h"
19
20 void nav4_class::Run(REAL* xkn, REAL* vkn)
21 {
22         int pixelcount = 0;
23
24         if(Blob.pix_basis)
25         {
26                 pixelcount = GeoPar.area;
27         }
28         else
29         {
30                 pixelcount = Blob.area;
31         }
32
33         REAL gradientSquareNorm = 0;
34
35         // calculate the gradient of your phi function here
36         // calcGradient(xkn, vkn);
37
38         for (INTEGER i = 0; i < pixelcount; i++) gradientSquareNorm += pow(vkn[i], 2);
39         REAL gradientNorm = sqrt(gradientSquareNorm);
40         for (INTEGER i = 0; i < pixelcount; i++) vkn[i] = (-1.0) * vkn[i] / gradientNorm;
41 }