aboutsummaryrefslogtreecommitdiff
path: root/manipulationhandler.cpp
blob: f561ad7e5188504cf8bfd3e43f21f1ffc5e4be9e (plain)
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
#include "manipulationhandler.h"

#include <algorithm>

#include "mp.h"

ManipulationHandler::ManipulationHandler(const arma::mat &X,
                                         const arma::uvec &cpIndices,
                                         ProjectionHistory *history)
    : m_X(X)
    , m_cpIndices(cpIndices)
    , m_history(history)
    , m_technique(TECHNIQUE_LAMP)
{
    Q_ASSERT(history);
}

void ManipulationHandler::setCP(const arma::mat &Ys)
{
    arma::mat Y(m_X.n_rows, 2);
    switch (m_technique) {
    case TECHNIQUE_PLMP:
        // TODO?
        break;
    case TECHNIQUE_LSP:
        // TODO?
        break;
    case TECHNIQUE_LAMP:
        mp::lamp(m_X, m_cpIndices, Ys, Y);
        break;
    case TECHNIQUE_PEKALSKA:
        // TODO?
        break;
    }

    emit mapChanged(Y);
}

void ManipulationHandler::setRewind(double t)
{
    if (!m_history->hasPrev()) {
        return;
    }

    arma::mat Y = m_history->Y() * t + m_history->prev() * (1.0 - t);
    emit mapRewound(Y);
}