-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcinitanimpar.m
137 lines (126 loc) · 4.77 KB
/
mcinitanimpar.m
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
function p = mcinitanimpar(x)
% Initializes an animation parameter (animpar) structure.
%
% syntax
% ap = mcinitanimpar;
% ap = mcinitanimpar('3D'); %initiates animation parameters for 3D
%
% input parameters
% (none)
%
% output
% ap: animaton parameter (animpar) structure
%
% comments
% The animpar structure contains the following fields
% (initialized values given in parentheses):
% scrsize: screen size in pixels ([800 600])
% limits: plot limits [xmin xmax zmin zmax] ([])
% az: azimuth vector in degrees (0)
% el: elevation vector in degrees (0)
% msize: marker size (12)
% colors: [background marker connection trace number] ('kwwww')
% markercolors: String holding marker colors ([]) or RGB triplet
% conncolors: String holding connector (line) colors ([]) or RGB triplet
% tracecolors: String holding trace colors (only animations) ([]) or RGB triplet
% numbercolors: String holding number colors (indicated in the numbers array) ([]) or RGB triplet
% cwidth: width of connectors (either single value or vector with entries for different widths) (1)
% twidth: width of traces (either single value or vector with entries for different widths) (1)
% conn: marker-to-marker connectivity matrix (M x 2) ([])
% conn2: midpoint-to-midpoint connectivity matrix (M x 4) ([])
% trm: vector indicating markers for which traces are added ([])
% trl: length of traces in seconds (0)
% showmnum: show marker numbers, 1=yes, 0=no (0)
% numbers: array indicating the markers for which number is to be shown ([])
% showfnum: show frame numbers, 1=yes, 0=no (0)
% animation: create animation, 1=yes, 0=no (0)
% fps: frames per second for animation (30)
% output: either file name for video file, of folder for pgn frames ('tmp')
% videoformat: specifies video file format, either 'avi' or 'mpeg4' ('avi')
% createFrames: create png frames instead of video file, 1=frames, 0=video file (0)
% getparams: return animation parameters, without plotting or animating frames, 1=yes, 0=no (0)
% perspective: perform perspective projection, 0 = orthographic (default), 1 = perspective (0)
% pers: perspective projection parameters:
% pers.c: 3D position of the camera [0 -4000 0]
% pers.th: orientation of the camera [0 0 0]
% pers.e: viewer's position relative to the display surface [0 -2000 0]
%
% par3D: parameters for plotting in 3D using mcplot3Dframe or mcanimate:
% par3D.shadowalpha: opacity of shadows (0.25)
% par3D.showaxis: show axis, 1=yes, 0=no (0)
% par3D.limits: 3D plot limits [xmin xmax;ymin ymax;zmin zmax] ([])
% par3D.lightposition: position of the light source ([])
% par3D.cameraposition: position of the camera ([])
% par3D.shadowwidth: width of the shadows ([])
% par3D.drawfloor: show floor image, 1=yes, 0=no (0)
% par3D.floorimage: url of floor image ([])
% par3D.drawwallx = show x wall image, 1=yes, 0=no (0)
% par3D.wallimagex: url of x wall image ([])
% par3D.drawwally = show y wall image, 1=yes, 0=no (0)
% par3D.wallimagey: url of y wall image ([])
% note that in 3D mode the following changes are made to the 2D defaults:
% colors are changed to 'wwwww'
% az is changed to 60
% el is changed to 10
%
% Colors can be given as strings if only the MATLAB string color options are used.
% However, any color can be specified by using RGB triplets - for example,
% plotting the first two markers in gray: par.markercolors=[.5 .5 .5; .5 .5 .5];
%
% see also
% mccreateconnmatrix, mcplotframe, mcanimate, mcplot3Dframe
%
% Adaptation of the native Motion Capture Toolbox function to work with 3D frame plotting
% Download the MoCap Toolbox from
% https://www.jyu.fi/hytk/fi/laitokset/mutku/en/research/materials/mocaptoolbox
%
p.type = 'animpar';
p.scrsize = [800 600];
p.limits = [];
p.az = 0;
p.el = 0;
p.msize = 12;
p.colors = 'kwwww';
p.markercolors = [];
p.conncolors = [];
p.tracecolors = [];
p.numbercolors = [];
p.cwidth = 1;
p.twidth = 1;
p.conn = [];
p.conn2 = [];
p.trm = [];
p.trl = 0;
p.showmnum = 0;
p.numbers = [];
p.showfnum = 0;
p.animate = 0;
p.fps = 30;
p.output = 'tmp';
p.videoformat = 'avi';
p.createframes = 0;
p.getparams = 0;
p.perspective = 0;
% parameters for perspective projection
p.pers.c=[0 -4000 0];
p.pers.th=[0 0 0];
p.pers.e=[0 -2000 0];
if nargin > 0
if strcmpi(x,'3D')
p.par3D.shadowalpha = 0.25;
p.par3D.showaxis = 0;
p.par3D.limits = [];
p.par3D.lightposition = [];
p.par3D.cameraposition = [];
p.par3D.shadowwidth = [];
p.par3D.drawfloor = 0;
p.par3D.floorimage = [];
p.par3D.drawwallx = 0;
p.par3D.wallimagex = [];
p.par3D.drawwally = 0;
p.par3D.wallimagey = [];
p.colors = 'wwwww';
p.az = 60;
p.el = 10;
end
end