-
Notifications
You must be signed in to change notification settings - Fork 8
/
trail.h
67 lines (51 loc) · 1.78 KB
/
trail.h
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
/*
This file is part of Jenn.
Copyright 2001-2007 Fritz Obermeyer.
Jenn is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Jenn is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Jenn; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef JENN_TRAIL_H
#define JENN_TRAIL_H
#include "definitions.h"
#include "linalg.h"
#include <vector>
namespace Trails
{
const Logging::Logger logger("trail", Logging::DEBUG);
enum Style { LINE, RIBBON, TUBE };
class Trail
{
typedef Vect Point;
typedef std::vector<Point> Points;
typedef float Time;
typedef std::vector<Time> Times;
Point m_origin;
std::vector<Points> m_points, m_projected;
std::vector<Times> m_times;
const Style style;
bool _wireframe;
public:
Trail (Style s=TUBE)
: m_points(1), m_projected(1), m_times(1),
style(s), _wireframe(false)
{ m_origin[0]=0; m_origin[1]=0; m_origin[2]=0; m_origin[3]=-1; }
void add_point (const Mat& theta, float time);
void new_trail ();
void display (const Mat& theta, float time=0.0f);
void toggle_wireframe () { _wireframe = not _wireframe; }
private:
void _draw_line (int n, const Mat& theta, float time);
void _draw_ribbon (int n, const Mat& theta, float time);
void _draw_tube (int n, const Mat& theta, float time);
};
}
#endif