Blame view

src/ParamOutputImpl/Plot/EpochAxis.cc 830 Bytes
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * EpochAxis.cc
 *
 *  Created on: 16 jan. 2015
 *      Author: AKKA
 */

#include "EpochAxis.hh"
#include <map>

#include <cstring>

namespace plot {

/**
 * @overrides Axis::getComputedValues
 */
double* EpochAxis::getComputedValues(double* originalValues_, int size_, double min, double max) {

	double *computedValues = new double [size_];

	// Duplicates data
	std::memcpy (computedValues, originalValues_, size_ * sizeof (double));

	for (int i = 0; i < size_; ++i)
	{


		if (_normalized)
		{
			if (computedValues[i] < _crtCenterTime)
				computedValues[i] = (_crtCenterTime - computedValues[i])/(min - _crtCenterTime);
			else
				computedValues[i] = (computedValues[i] - _crtCenterTime)/(max - _crtCenterTime);
		}
		else
			computedValues[i] -= _crtCenterTime;
	}

	return computedValues;
}

} /* namespace plot */