-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathspec_splinepwp.m
58 lines (43 loc) · 1.2 KB
/
spec_splinepwp.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
%% Specification by example -- periodic piecewise spline.
% This file best viewed via the command
%
% open(publish('spec_splinepwp')).
%
clear
%%
% Some sample knots to get us started. We'll show a regular periodic
% spline with its knots numbered, and then add some corners.
knots = [1, 1i, -1, -1i];
G = splinep(knots);
plot(G), hold on
plot(knots, 'b.', 'markersize', 18)
for k = 1:numel(knots)
text(real(knots(k)), imag(knots(k)), [' ' int2str(k)])
end
axis off, hold off
%%
% Corners are easy to specify.
corners = [1, 2];
G = splinepwp(knots, corners);
plot(G), hold on
plot(knots, 'b.', 'markersize', 18)
for k = 1:numel(knots)
text(real(knots(k)), imag(knots(k)), [' ' int2str(k)])
end
axis off, hold off
%%
% Note that |splinepwp| requires a corner be the first knot, so the
% constructor will rearrange the knots as needed to make this happen.
corners = [3, 4];
G = splinepwp(knots, corners);
plot(G), hold on
plot(knots, 'b.', 'markersize', 18)
for k = 1:numel(G.knots)
text(real(G.knots(k)), imag(G.knots(k)), [' ' int2str(k)])
end
axis off, hold off
%%
% Interestingly, if the region isn't too "strange", the Szego kernel will
% give a map with boundary corners.
f = szmap(G, 0);
plot(f)