diff --git a/even_stream_arrow.m b/even_stream_arrow.m index a8584ae..66f910e 100755 --- a/even_stream_arrow.m +++ b/even_stream_arrow.m @@ -18,7 +18,7 @@ % 'ArrowLength': arrow head length in pixels, default = 20 % 'ArrowTipAngle': arrow head tip angle in degrees, default = 20 % 'ArrowBaseAngle': arrow head base angle in degrees, default = 10 -% 'ArrowSpace': arrow head spacing along line in coordinate unite, +% 'ArrowSpace': arrow head spacing along line in data coordinate units, % default = 5% of minimum coordinate axis range % % Returns: diff --git a/even_stream_demo.m b/even_stream_demo.m index 49299f7..bcf4bea 100755 --- a/even_stream_demo.m +++ b/even_stream_demo.m @@ -99,15 +99,14 @@ % compute tic -% xy = even_stream_data(xx, yy, dzdx, dzdy, 0.003, 0.0015); -xy = even_stream_data(xx, yy, dzdx, dzdy, 0.05, 0.025); +xy = even_stream_data(xx, yy, dzdx, dzdy, 0.003, 0.0015); fprintf('even_stream_data: %.3f s elapsed\n', toc); % plot tic hf = figure; hf.Name = sprintf('%s: even stream texture', mfilename); -even_stream_texture(xy, 'LineWidth', 1, 'Period', 20); +even_stream_texture(xy, 'LineWidth', 1, 'Period', 0.020*range(vv)); title('even\_stream\_texture'); ax = gca; ax.XTick = []; diff --git a/even_stream_texture.m b/even_stream_texture.m index e3e329b..f3bb8f5 100755 --- a/even_stream_texture.m +++ b/even_stream_texture.m @@ -12,7 +12,8 @@ % % Optional Parameters (Name, Value): % 'LineWidth': line width, as in the plot(), default = 0.5 -% 'Period': length of periodic pattern in # points, default = 20; +% 'Period': length of periodic pattern in data coordinate spacing, +% default = 20% of minimum coordinate axis range % % Returns: % hh = Vector of graphics objects for streamlines @@ -32,15 +33,19 @@ parser.KeepUnmatched = false; parser.addParameter('LineWidth', 0.5); -parser.addParameter('Period', 20); +parser.addParameter('Period', 0.20*min(range(xy))); parser.parse(varargin{:}); line_width = parser.Results.LineWidth; period = parser.Results.Period; -validateattributes(period, {'numeric'}, {'scalar', 'positive', 'integer'}, ... +validateattributes(period, {'numeric'}, {'scalar', 'positive'}, ... mfilename, 'period'); +% convert period to approximate number of points +mean_segment_length = nanmean(sqrt(sum(diff(xy).^2, 2))); +period = round(period/mean_segment_length); + % reformat streamlines as segments num_segments = size(xy, 1)-2*sum(isnan(xy(:,1)))-1; x_segment = nan(num_segments, 2);