-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMovingAAElipsoid.cpp
More file actions
49 lines (41 loc) · 1.48 KB
/
MovingAAElipsoid.cpp
File metadata and controls
49 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* File: MovingAAElipsoid.cpp
* Author: zoizoi
*
* Created on 23 March 2011, 18:54
*/
#include "MovingAAElipsoid.h"
#include "StepToParamConverter.h"
MovingAAElipsoid::MovingAAElipsoid(OVASControl* o, float _px, float _py, float _pz, float _vx, float _vy, float _vz, float _sx, float _sy, float _sz, float _w)
: oc(o), px(_px), py(_py), pz(_pz), vx(_vx), vy(_vy), vz(_vz), sx(_sx), sy(_sy), sz(_sz), weight(_w) {
//cout<<"new px "<<px<<" "<<py<<" "<<pz<<" "<<vx<<" "<<vy<<" "<<vz<<" "<<sx<<" "<<sy<<" "<<sz<<" "<<endl;
}
MovingAAElipsoid::MovingAAElipsoid(const MovingAAElipsoid& orig) {
}
MovingAAElipsoid::~MovingAAElipsoid() {
}
float MovingAAElipsoid::getContribAt(int x, int y, int z, int step) {
float xv = (float) x / oc->xDim;
float yv = (float) y / oc->yDim;
float zv = (float) z / oc->zDim;
float t = oc->stepToParamConverter->getParamForStep(step);
float posx, posy, posz;
//cout<<" px "<<px<<endl;
posx = px + (vx * t);
posx -= floor(posx);
// posx *= 0.8;
// posx += 0.1;
posy = py + (vy * t);
posy -= floor(posy);
// posy *= 0.5;
// posy += 0.25;
posz = pz + (vz * t);
posz -= floor(posz);
// posz *= 0.5;
// posz += 0.25;
float fieldVal = (exp(-1 * (pow(xv - posx, 2) * sx + pow(yv - posy, 2) * sy + pow(zv - posz, 2) * sz))) * weight;
if (x == y && y == z && z == 16) {
// cout<<"here t "<<t<<" fv "<<fieldVal<<" posx "<<posx<<" posy "<<posy<<" posz "<<posz<<endl;
}
return fieldVal;
}