Mercurial > repos > public > sbplib
annotate +draw/prompt_bezier.m @ 577:e45c9b56d50d feature/grids
Add an Empty grid class
The need turned up for the flexural code when we may or may not have a grid for the open water and want to plot that solution.
In case there is no open water we need an empty grid to plot the empty gridfunction against to avoid errors.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 07 Sep 2017 09:16:12 +0200 |
parents | 875386d0b2ff |
children |
rev | line source |
---|---|
0 | 1 function [C,h] = prompt_bezier(s,varargin) |
2 default_arg('s',[]) | |
3 if ~isempty(s) | |
4 fprintf(s,varargin{:}); | |
5 end | |
6 | |
7 fprintf('# Draw bezier curve\n') | |
8 a = draw.prompt_point('Enter starting point\n'); | |
9 p = draw.point(a); | |
10 p.Color = Color.green; | |
11 p.MarkerSize = 24; | |
12 b = draw.prompt_point('Enter stopping point\n'); | |
13 p = draw.point(b); | |
14 p.Color = Color.red; | |
15 p.MarkerSize = 24; | |
16 c1 = draw.prompt_point('Enter control point 1\n'); | |
17 p = draw.point(c1); | |
18 p.Color = Color.yellow; | |
19 p.MarkerSize = 16; | |
20 c2 = draw.prompt_point('Enter control point 2\n'); | |
21 p = draw.point(c2); | |
22 p.Color = Color.yellow; | |
23 p.MarkerSize = 16; | |
24 | |
332
875386d0b2ff
Fixed a bug in draw and added a helper function to parametrization.Ti.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
25 C = parametrization.Curve.bezier(a,c1,c2,b); |
875386d0b2ff
Fixed a bug in draw and added a helper function to parametrization.Ti.
Jonatan Werpers <jonatan@werpers.com>
parents:
0
diff
changeset
|
26 fprintf('C = parametrization.Curve.bezier([%.3g; %.3g],[%.3g; %.3g],[%.3g; %.3g],[%.3g; %.3g]);\n',a,c1,c2,b) |
0 | 27 h = C.plot(); |
28 uistack(h,'bottom'); | |
29 | |
30 end |