summaryrefslogtreecommitdiffhomepage
path: root/gui/wizard.cpp
blob: cf987ecb159d162bd74e2d072dfee2cb43aa332b (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "wizard.h"
#include "opentrack/state.hpp"
#include "tracker-pt/ftnoir_tracker_pt_settings.h"
#include "filter-accela/ftnoir_filter_accela.h"

Wizard::Wizard() : QWizard(nullptr)
{
    ui.setupUi(this);
    connect(this, SIGNAL(accepted()), this, SLOT(set_data()));
}

static constexpr double tz[][2] = {
    { 16.5327205657959, 13.0232553482056 },
    { 55.4535026550293, 100 },
    { 56.8312301635742, 100 },
    { -1, -1 },
};

static constexpr double yaw[][2] = {
    { 10.7462686567164, 20.9302325581395 },
    { 30, 115 },
    { 41.9517784118652, 180 },
    { -1, -1 },
};

static constexpr double pitch[][2] = {
    { 10.1262916188289, 27.6279069767442 },
    { 32.4454649827784, 180 },
    { -1, -1 },
};

static constexpr double roll[][2] = {
    { 12.3995409011841, 25.9534893035889 },
    { 54.3513221740723, 180 },
    { -1, -1 },
};

static void set_mapping(Mapping& m, const double spline[][2])
{
    m.opts.altp = false;
    m.curve.removeAllPoints();
    for (int i = 0; spline[i][0] >= 0; i++)
        m.curve.addPoint(QPointF(spline[i][0], spline[i][1]));
}

void Wizard::set_data()
{
    Model m;

    if (ui.clip_model->isChecked())
        m = ClipRight;
    else if (ui.clip_model_left->isChecked())
        m = ClipLeft;
    else // ui.cap_model
        m = Cap;

    State state;

    set_mapping(state.pose(TZ), tz);
    set_mapping(state.pose(Yaw), yaw);
    set_mapping(state.pose(Pitch), pitch);
    set_mapping(state.pose(Roll), roll);
    state.pose.save_mappings();

    settings_pt pt;
    pt.threshold = 31;
    pt.min_point_size = 0;
    pt.max_point_size = 50;
    pt.fov = 1;
    pt.camera_mode = 0;
    pt.model_used = m;
    pt.b->save();

    settings_accela acc;
    acc.ewma = 49;
    acc.rot_threshold = 29;
    acc.rot_deadzone = 29;
    acc.trans_deadzone = 33;
    acc.trans_threshold = 19;
    acc.b->save();
}