summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/splines/testsplines.mp
blob: a6ad01d0adb6e97a9821cb051d08ac68e664c732 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
input splines;

numeric u; u:=1cm;

path xaxis, yaxis;
xaxis := (-2.5u,0)--(1.5u,0);
yaxis := (0,-.5u)--(0,1.5u);

def shiftit =
  currentpicture := currentpicture shifted -llcorner currentpicture;
enddef;

def dodots (text t) =
  for _loc = t:
    fill (fullcircle scaled 2pt) shifted (u*_loc);
  endfor
enddef;



beginfig(1);
  drawarrow xaxis;
  drawarrow yaxis;
  path p;
  p := dospline (true)
   ((-1,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  draw p scaled u;
label(btex From {\tt dospline (true)}. etex,(.25u,-.75u));
dodots ((-1,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
shiftit;
endfig;

beginfig(2);
  drawarrow xaxis;
  drawarrow yaxis;
  save A; pair A[];
  list_to_array (A)((-1,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  path p;
  p := mkclosedspline (A);
  draw p scaled u;
label(btex From {\tt mkclosedspline}. etex,(.25u,-.75u));
dodots (A1, A2, A3, A4, A5, A6, A7);
shiftit;
endfig;

beginfig(3);
  drawarrow xaxis;
  drawarrow yaxis;
  path p;
  p := dospline (false)
   ((-1,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  draw p scaled u;
label(btex From {\tt dospline (false)}. etex,(.25u,-.75u));
dodots ((-1,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
shiftit;
endfig;

beginfig(4);
  drawarrow xaxis;
  drawarrow yaxis;
  save A; pair A[];
  list_to_array (A)((-1,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  path p;
  p := mkrelaxedspline (A);
  draw p scaled u;
label(btex From {\tt mkrelaxedspline}. etex,(.25u,-.75u));
dodots (A1, A2, A3, A4, A5, A6, A7);
shiftit;
endfig;

beginfig(5);
  drawarrow xaxis;
  drawarrow yaxis;
  path p;
  p := fcnspline (true)
   ((-2,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  draw p scaled u;
label(btex From {\tt fcnspline (true)}. etex,(.25u,-.75u));
dodots ((-2,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
shiftit;
endfig;

beginfig(6);
  drawarrow xaxis;
  drawarrow yaxis;
  save A; pair A[];
  list_to_array(A) ((-2,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  path p;
  p := mkperiodicfcnspline (A);
  draw p scaled u;
label(btex From {\tt mkperiodicfcnspline}. etex,(.25u,-.75u));
dodots (A1, A2, A3, A4, A5, A6, A7);
shiftit;
endfig;

beginfig(7);
  drawarrow xaxis;
  drawarrow yaxis;
  path p;
  p := fcnspline (false)
   ((-2,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  draw p scaled u;
label(btex From {\tt fcnspline (false)}. etex,(.25u,-.75u));
dodots((-2,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
shiftit;
endfig;

beginfig(8);
  drawarrow xaxis;
  drawarrow yaxis;
  save A; pair A[];
  list_to_array(A) ((-2,0), (-1,1), (-.5,.8), (0,1),(.5,.4), (1,0), (1.5,1));
  path p;
  p := mkrelaxedfcnspline (A);
  draw p scaled u;
label(btex From {\tt mkrelaxedfcnspline}. etex,(.25u,-.75u));
dodots (A1, A2, A3, A4, A5, A6, A7);
shiftit;
endfig;

end.