|
89 | 89 | %-------------------------------------------------------------------------%
|
90 | 90 |
|
91 | 91 | %-quiver barbs-%
|
92 |
| -% 'MaxHeadSize' scalar, matlab clips to 0.2 in r2014b |
93 |
| -maxheadsize = quiver_data.MaxHeadSize; |
94 |
| -% barb angular width, not supported by matlab |
95 |
| -head_width = deg2rad(17.5); |
96 |
| -for n = 1:length(xdata) |
97 |
| - % length of arrow |
98 |
| - l = norm([0.1*udata(n), 0.1*vdata(n)]); |
99 |
| - |
100 |
| - % angle of arrow |
101 |
| - phi = atan2(vdata(n),udata(n)); |
102 |
| - |
103 |
| - % make barb with specified angular width, length is prop. to arrow |
104 |
| - barb = [... |
105 |
| - [-maxheadsize*l*cos(head_width), maxheadsize*l*sin(head_width)]; ... |
106 |
| - [0, 0]; ... |
107 |
| - [-maxheadsize*l*cos(head_width), -maxheadsize*l*sin(head_width)]; ... |
108 |
| - [nan, nan]; ... |
109 |
| - ]'; |
110 |
| - |
111 |
| - % affine matrix: rotate by arrow angle and translate to end of arrow |
112 |
| - barb_transformation = affine2d([... |
113 |
| - [cos(phi), sin(phi), 0]; ... |
114 |
| - [-sin(phi), cos(phi), 0]; ... |
115 |
| - [xdata(n) + 0.1*udata(n), ydata(n) + 0.1*vdata(n), 1]; |
116 |
| - ]); |
117 |
| - |
118 |
| - % place barb at end of arrow |
119 |
| - barb = transformPointsForward(barb_transformation, barb')'; |
120 |
| - |
121 |
| - % add barb to plot data, inserting is optimized in matlab >2010 |
122 |
| - for col = 1:4 |
123 |
| - obj.data{quiverIndex}.x(end+1) = barb(1,col); % point 1 |
124 |
| - obj.data{quiverIndex}.y(end+1) = barb(2,col); |
| 92 | +if isHG2() |
| 93 | + % 'MaxHeadSize' scalar, matlab clips to 0.2 in r2014b |
| 94 | + maxheadsize = quiver_data.MaxHeadSize; |
| 95 | + % barb angular width, not supported by matlab |
| 96 | + head_width = deg2rad(17.5); |
| 97 | + for n = 1:length(xdata) |
| 98 | + % length of arrow |
| 99 | + l = norm([0.1*udata(n), 0.1*vdata(n)]); |
| 100 | + |
| 101 | + % angle of arrow |
| 102 | + phi = atan2(vdata(n),udata(n)); |
| 103 | + |
| 104 | + % make barb with specified angular width, length is prop. to arrow |
| 105 | + barb = [... |
| 106 | + [-maxheadsize*l*cos(head_width), maxheadsize*l*sin(head_width)]; ... |
| 107 | + [0, 0]; ... |
| 108 | + [-maxheadsize*l*cos(head_width), -maxheadsize*l*sin(head_width)]; ... |
| 109 | + [nan, nan]; ... |
| 110 | + ]'; |
| 111 | + |
| 112 | + % affine matrix: rotate by arrow angle and translate to end of arrow |
| 113 | + barb_transformation = affine2d([... |
| 114 | + [cos(phi), sin(phi), 0]; ... |
| 115 | + [-sin(phi), cos(phi), 0]; ... |
| 116 | + [xdata(n) + 0.1*udata(n), ydata(n) + 0.1*vdata(n), 1]; |
| 117 | + ]); |
| 118 | + |
| 119 | + % place barb at end of arrow |
| 120 | + barb = transformPointsForward(barb_transformation, barb')'; |
| 121 | + |
| 122 | + % add barb to plot data, inserting is optimized in matlab >2010 |
| 123 | + for col = 1:4 |
| 124 | + obj.data{quiverIndex}.x(end+1) = barb(1,col); % point 1 |
| 125 | + obj.data{quiverIndex}.y(end+1) = barb(2,col); |
| 126 | + end |
125 | 127 | end
|
126 | 128 | end
|
127 | 129 |
|
|
0 commit comments