annotate arrows/vecedit.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
beb8a3f4a345 |
children |
|
rev |
line source |
samer@0
|
1 % vecedit - Graphical editor for real-valued vector
|
samer@0
|
2 %
|
samer@0
|
3 % vecedit ::
|
samer@0
|
4 % [[N]] ~'initial value of editable vector',
|
samer@0
|
5 % options {
|
samer@0
|
6 % fig :: handle/gcf ~'figure to use';
|
samer@0
|
7 % }
|
samer@0
|
8 % -> arrow({},{[[N]]},vecedit_state) ~'arrow that generates vectors'.
|
samer@0
|
9 %
|
samer@0
|
10 % vecedit takes all options accepted by emousepos and plotter.
|
samer@0
|
11 function o=vecedit(x0,varargin)
|
samer@0
|
12 N=length(x0); x0=x0(:);
|
samer@37
|
13 opts=options(varargin{:});
|
samer@0
|
14 o = emousepos(opts) * erate(loop(@edit,@(z)x0) * obs_with(plotter(opts)),{[2,1]}) * alatch(x0);
|
samer@0
|
15
|
samer@0
|
16 function [f,g]=edit(m,f)
|
samer@0
|
17 i=round(m(1));
|
samer@0
|
18 if i>=1 && i<=N, f(i)=m(2); end
|
samer@0
|
19 g=f;
|
samer@0
|
20 end
|
samer@0
|
21 end
|