mathgl 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -10
- data/TODO +5 -0
- data/ext/mathgl/mathgl.cxx +1 -0
- data/lib/mathgl/libdoc_core_en.rb +3771 -0
- data/lib/mathgl/libdoc_data_en.rb +1645 -0
- data/lib/mathgl/libdoc_other_en.rb +192 -0
- data/lib/mathgl/libdoc_parse_en.rb +151 -0
- data/lib/mathgl/version.rb +1 -1
- data/misc/conv_texi.rb +426 -0
- data/sample/conv_sample.rb +2 -15
- data/sample/prepare.rb +11 -3
- data/sample/sample.rb +141 -153
- metadata +8 -2
data/sample/conv_sample.rb
CHANGED
@@ -10,21 +10,8 @@ class ConvSample
|
|
10
10
|
@i = -1
|
11
11
|
|
12
12
|
print "
|
13
|
-
|
14
|
-
require
|
15
|
-
require libdir+"/prepare"
|
16
|
-
|
17
|
-
def mgl_rnd
|
18
|
-
rand
|
19
|
-
end
|
20
|
-
|
21
|
-
def pow(a,b)
|
22
|
-
a**b
|
23
|
-
end
|
24
|
-
|
25
|
-
M_PI = Math::PI
|
26
|
-
NULL = nil
|
27
|
-
NAN = 0.0/0.0
|
13
|
+
require 'mathgl'
|
14
|
+
require './prepare'
|
28
15
|
|
29
16
|
procs = {}
|
30
17
|
"
|
data/sample/prepare.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
def mgl_rnd
|
2
|
+
rand
|
3
|
+
end
|
4
|
+
|
1
5
|
def pow(a,b)
|
2
6
|
a**b
|
3
7
|
end
|
4
8
|
|
9
|
+
M_PI = Math::PI
|
10
|
+
NULL = nil
|
11
|
+
NAN = 0.0/0.0
|
12
|
+
|
5
13
|
# void mgls_prepare1d(mglData *y, mglData *y1, mglData *y2, mglData *x1, mglData *x2)
|
6
14
|
# {
|
7
15
|
# register long i,n=50;
|
@@ -44,9 +52,9 @@ def mgls_prepare1d(y=nil,y1=nil,y2=nil,x1=nil,x2=nil)
|
|
44
52
|
for i in 0...n
|
45
53
|
xx = i/(n-1.0)
|
46
54
|
if y
|
47
|
-
y.set_val(0.7*Math.sin(2*M_PI*xx) + 0.5*Math.cos(3*M_PI*xx) + 0.2*Math.sin(M_PI*xx),i)
|
48
|
-
y.set_val(Math.sin(2*M_PI*xx),i
|
49
|
-
y.set_val(Math.cos(2*M_PI*xx),i
|
55
|
+
y.set_val(0.7*Math.sin(2*M_PI*xx) + 0.5*Math.cos(3*M_PI*xx) + 0.2*Math.sin(M_PI*xx),i,0)
|
56
|
+
y.set_val(Math.sin(2*M_PI*xx),i,1)
|
57
|
+
y.set_val(Math.cos(2*M_PI*xx),i,2)
|
50
58
|
end
|
51
59
|
if y1
|
52
60
|
y1.set_val(0.5+0.3*Math.cos(2*M_PI*xx),i)
|
data/sample/sample.rb
CHANGED
@@ -1,21 +1,9 @@
|
|
1
|
-
libdir = File.expand_path(File.dirname(__FILE__))
|
2
|
-
require libdir+"/../ext/mathgl/mathgl.so"
|
3
|
-
require libdir+"/prepare"
|
4
1
|
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def pow(a,b)
|
10
|
-
a**b
|
11
|
-
end
|
12
|
-
|
13
|
-
M_PI = Math::PI
|
14
|
-
NULL = nil
|
15
|
-
NAN = 0.0/0.0
|
2
|
+
require 'mathgl'
|
3
|
+
require './prepare'
|
16
4
|
|
17
5
|
procs = {}
|
18
|
-
# void smgl_fexport(mglGraph *gr)
|
6
|
+
# void smgl_fexport(mglGraph *gr)
|
19
7
|
# {
|
20
8
|
# gr->SubPlot(3,2,0);
|
21
9
|
# double d,x1,x2,x0,y=0.95;
|
@@ -28,7 +16,7 @@ procs = {}
|
|
28
16
|
# gr->Line(mglPoint(x0,1-5*d),mglPoint(x1,1-5*d),"ki"); gr->Puts(mglPoint(x2,y-5*d),"Small dash-dot 'i'",":rL");
|
29
17
|
# gr->Line(mglPoint(x0,1-6*d),mglPoint(x1,1-6*d),"k:"); gr->Puts(mglPoint(x2,y-6*d),"Dots ':'",":rL");
|
30
18
|
# gr->Line(mglPoint(x0,1-7*d),mglPoint(x1,1-7*d),"k "); gr->Puts(mglPoint(x2,y-7*d),"None ' '",":rL");
|
31
|
-
#
|
19
|
+
#
|
32
20
|
# d=0.25; x1=-1; x0=-0.8; y = -0.05;
|
33
21
|
# gr->Mark(mglPoint(x1,5*d),"k."); gr->Puts(mglPoint(x0,y+5*d),"'.'",":rL");
|
34
22
|
# gr->Mark(mglPoint(x1,4*d),"k+"); gr->Puts(mglPoint(x0,y+4*d),"'+'",":rL");
|
@@ -41,7 +29,7 @@ procs = {}
|
|
41
29
|
# gr->Mark(mglPoint(x1,-3*d,0),"kv"); gr->Puts(mglPoint(x0,y-3*d),"'v'",":rL");
|
42
30
|
# gr->Mark(mglPoint(x1,-4*d,0),"k<"); gr->Puts(mglPoint(x0,y-4*d),"'<'",":rL");
|
43
31
|
# gr->Mark(mglPoint(x1,-5*d,0),"k>"); gr->Puts(mglPoint(x0,y-5*d),"'>'",":rL");
|
44
|
-
#
|
32
|
+
#
|
45
33
|
# d=0.25; x1=-0.5; x0=-0.3; y = -0.05;
|
46
34
|
# gr->Mark(mglPoint(x1,5*d),"k#."); gr->Puts(mglPoint(x0,y+5*d),"'\\#.'",":rL");
|
47
35
|
# gr->Mark(mglPoint(x1,4*d),"k#+"); gr->Puts(mglPoint(x0,y+4*d),"'\\#+'",":rL");
|
@@ -54,7 +42,7 @@ procs = {}
|
|
54
42
|
# gr->Mark(mglPoint(x1,-3*d,0),"k#v"); gr->Puts(mglPoint(x0,y-3*d),"'\\#v'",":rL");
|
55
43
|
# gr->Mark(mglPoint(x1,-4*d,0),"k#<"); gr->Puts(mglPoint(x0,y-4*d),"'\\#<'",":rL");
|
56
44
|
# gr->Mark(mglPoint(x1,-5*d,0),"k#>"); gr->Puts(mglPoint(x0,y-5*d),"'\\#>'",":rL");
|
57
|
-
#
|
45
|
+
#
|
58
46
|
# gr->SubPlot(3,2,1);
|
59
47
|
# double a=0.1,b=0.4,c=0.5;
|
60
48
|
# gr->Line(mglPoint(a,1),mglPoint(b,1),"k-A"); gr->Puts(mglPoint(c,1),"Style 'A' or 'A\\_'",":rL");
|
@@ -68,7 +56,7 @@ procs = {}
|
|
68
56
|
# gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"k-_"); gr->Puts(mglPoint(c,-0.6),"Style '\\_' or none",":rL");
|
69
57
|
# gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-AS"); gr->Puts(mglPoint(c,-0.8),"Style 'AS'",":rL");
|
70
58
|
# gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-_A"); gr->Puts(mglPoint(c,-1),"Style '\\_A'",":rL");
|
71
|
-
#
|
59
|
+
#
|
72
60
|
# a=-1; b=-0.7; c=-0.6;
|
73
61
|
# gr->Line(mglPoint(a,1),mglPoint(b,1),"kAA"); gr->Puts(mglPoint(c,1),"Style 'AA'",":rL");
|
74
62
|
# gr->Line(mglPoint(a,0.8),mglPoint(b,0.8),"kVV"); gr->Puts(mglPoint(c,0.8),"Style 'VV'",":rL");
|
@@ -81,54 +69,54 @@ procs = {}
|
|
81
69
|
# gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"k-__"); gr->Puts(mglPoint(c,-0.6),"Style '\\_\\_'",":rL");
|
82
70
|
# gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-VA"); gr->Puts(mglPoint(c,-0.8),"Style 'VA'",":rL");
|
83
71
|
# gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-AV"); gr->Puts(mglPoint(c,-1),"Style 'AV'",":rL");
|
84
|
-
#
|
72
|
+
#
|
85
73
|
# gr->SubPlot(3,2,2);
|
86
|
-
#
|
74
|
+
#
|
87
75
|
# gr->FaceZ(mglPoint(-1, -1), 0.4, 0.3, "L#"); gr->Puts(mglPoint(-0.8,-0.9), "L", "w:C", -1.4);
|
88
76
|
# gr->FaceZ(mglPoint(-0.6,-1), 0.4, 0.3, "E#"); gr->Puts(mglPoint(-0.4,-0.9), "E", "w:C", -1.4);
|
89
77
|
# gr->FaceZ(mglPoint(-0.2,-1), 0.4, 0.3, "N#"); gr->Puts(mglPoint(0, -0.9), "N", "w:C", -1.4);
|
90
78
|
# gr->FaceZ(mglPoint(0.2, -1), 0.4, 0.3, "U#"); gr->Puts(mglPoint(0.4,-0.9), "U", "w:C", -1.4);
|
91
79
|
# gr->FaceZ(mglPoint(0.6, -1), 0.4, 0.3, "Q#"); gr->Puts(mglPoint(0.8,-0.9), "Q", "w:C", -1.4);
|
92
|
-
#
|
80
|
+
#
|
93
81
|
# gr->FaceZ(mglPoint(-1, -0.7), 0.4, 0.3, "l#"); gr->Puts(mglPoint(-0.8,-0.6), "l", "k:C", -1.4);
|
94
82
|
# gr->FaceZ(mglPoint(-0.6,-0.7), 0.4, 0.3, "e#"); gr->Puts(mglPoint(-0.4,-0.6), "e", "k:C", -1.4);
|
95
83
|
# gr->FaceZ(mglPoint(-0.2,-0.7), 0.4, 0.3, "n#"); gr->Puts(mglPoint(0, -0.6), "n", "k:C", -1.4);
|
96
84
|
# gr->FaceZ(mglPoint(0.2, -0.7), 0.4, 0.3, "u#"); gr->Puts(mglPoint(0.4,-0.6), "u", "k:C", -1.4);
|
97
85
|
# gr->FaceZ(mglPoint(0.6, -0.7), 0.4, 0.3, "q#"); gr->Puts(mglPoint(0.8,-0.6), "q", "k:C", -1.4);
|
98
|
-
#
|
86
|
+
#
|
99
87
|
# gr->FaceZ(mglPoint(-1, -0.4), 0.4, 0.3, "C#"); gr->Puts(mglPoint(-0.8,-0.3), "C", "w:C", -1.4);
|
100
88
|
# gr->FaceZ(mglPoint(-0.6,-0.4), 0.4, 0.3, "M#"); gr->Puts(mglPoint(-0.4,-0.3), "M", "w:C", -1.4);
|
101
89
|
# gr->FaceZ(mglPoint(-0.2,-0.4), 0.4, 0.3, "Y#"); gr->Puts(mglPoint(0, -0.3), "Y", "w:C", -1.4);
|
102
90
|
# gr->FaceZ(mglPoint(0.2, -0.4), 0.4, 0.3, "k#"); gr->Puts(mglPoint(0.4,-0.3), "k", "w:C", -1.4);
|
103
91
|
# gr->FaceZ(mglPoint(0.6, -0.4), 0.4, 0.3, "P#"); gr->Puts(mglPoint(0.8,-0.3), "P", "w:C", -1.4);
|
104
|
-
#
|
92
|
+
#
|
105
93
|
# gr->FaceZ(mglPoint(-1, -0.1), 0.4, 0.3, "c#"); gr->Puts(mglPoint(-0.8, 0), "c", "k:C", -1.4);
|
106
94
|
# gr->FaceZ(mglPoint(-0.6,-0.1), 0.4, 0.3, "m#"); gr->Puts(mglPoint(-0.4, 0), "m", "k:C", -1.4);
|
107
95
|
# gr->FaceZ(mglPoint(-0.2,-0.1), 0.4, 0.3, "y#"); gr->Puts(mglPoint(0, 0), "y", "k:C", -1.4);
|
108
96
|
# gr->FaceZ(mglPoint(0.2, -0.1), 0.4, 0.3, "w#"); gr->Puts(mglPoint(0.4, 0), "w", "k:C", -1.4);
|
109
97
|
# gr->FaceZ(mglPoint(0.6, -0.1), 0.4, 0.3, "p#"); gr->Puts(mglPoint(0.8, 0), "p", "k:C", -1.4);
|
110
|
-
#
|
98
|
+
#
|
111
99
|
# gr->FaceZ(mglPoint(-1, 0.2), 0.4, 0.3, "B#"); gr->Puts(mglPoint(-0.8, 0.3), "B", "w:C", -1.4);
|
112
100
|
# gr->FaceZ(mglPoint(-0.6,0.2), 0.4, 0.3, "G#"); gr->Puts(mglPoint(-0.4, 0.3), "G", "w:C", -1.4);
|
113
101
|
# gr->FaceZ(mglPoint(-0.2,0.2), 0.4, 0.3, "R#"); gr->Puts(mglPoint(0, 0.3), "R", "w:C", -1.4);
|
114
102
|
# gr->FaceZ(mglPoint(0.2, 0.2), 0.4, 0.3, "H#"); gr->Puts(mglPoint(0.4, 0.3), "H", "w:C", -1.4);
|
115
103
|
# gr->FaceZ(mglPoint(0.6, 0.2), 0.4, 0.3, "W#"); gr->Puts(mglPoint(0.8, 0.3), "W", "w:C", -1.4);
|
116
|
-
#
|
104
|
+
#
|
117
105
|
# gr->FaceZ(mglPoint(-1, 0.5), 0.4, 0.3, "b#"); gr->Puts(mglPoint(-0.8, 0.6), "b", "k:C", -1.4);
|
118
106
|
# gr->FaceZ(mglPoint(-0.6,0.5), 0.4, 0.3, "g#"); gr->Puts(mglPoint(-0.4, 0.6), "g", "k:C", -1.4);
|
119
107
|
# gr->FaceZ(mglPoint(-0.2,0.5), 0.4, 0.3, "r#"); gr->Puts(mglPoint(0, 0.6), "r", "k:C", -1.4);
|
120
108
|
# gr->FaceZ(mglPoint(0.2, 0.5), 0.4, 0.3, "h#"); gr->Puts(mglPoint(0.4, 0.6), "h", "k:C", -1.4);
|
121
109
|
# gr->FaceZ(mglPoint(0.6, 0.5), 0.4, 0.3, "w#"); gr->Puts(mglPoint(0.8, 0.6), "w", "k:C", -1.4);
|
122
|
-
#
|
110
|
+
#
|
123
111
|
# gr->FaceZ(mglPoint(-1, 0.8), 0.4, 0.3, "{r1}#"); gr->Puts(mglPoint(-0.8, 0.9), "\\{r1\\}", "w:C", -1.4);
|
124
112
|
# gr->FaceZ(mglPoint(-0.6,0.8), 0.4, 0.3, "{r3}#"); gr->Puts(mglPoint(-0.4, 0.9), "\\{r3\\}", "w:C", -1.4);
|
125
113
|
# gr->FaceZ(mglPoint(-0.2,0.8), 0.4, 0.3, "{r5}#"); gr->Puts(mglPoint(0, 0.9), "\\{r5\\}", "k:C", -1.4);
|
126
114
|
# gr->FaceZ(mglPoint(0.2, 0.8), 0.4, 0.3, "{r7}#"); gr->Puts(mglPoint(0.4, 0.9), "\\{r7\\}", "k:C", -1.4);
|
127
115
|
# gr->FaceZ(mglPoint(0.6, 0.8), 0.4, 0.3, "{r9}#"); gr->Puts(mglPoint(0.8, 0.9), "\\{r9\\}", "k:C", -1.4);
|
128
|
-
#
|
116
|
+
#
|
129
117
|
# gr->FaceZ(mglPoint(-1, -1.3), 1, 0.3, "{xff9966}#"); gr->Puts(mglPoint(-0.5,-1.2), "\\{xff9966\\}", "k:C", -1.4);
|
130
118
|
# gr->FaceZ(mglPoint(0, -1.3), 1, 0.3, "{x83CAFF}#"); gr->Puts(mglPoint( 0.5,-1.2), "\\{x83CAFF\\}", "k:C", -1.4);
|
131
|
-
#
|
119
|
+
#
|
132
120
|
# gr->SubPlot(3,2,3);
|
133
121
|
# char stl[3]="r1", txt[4]="'1'";
|
134
122
|
# for(int i=0;i<10;i++)
|
@@ -137,20 +125,20 @@ procs = {}
|
|
137
125
|
# gr->Line(mglPoint(-1,0.2*i-1),mglPoint(1,0.2*i-1),stl);
|
138
126
|
# gr->Puts(mglPoint(1.05,0.2*i-1),txt,":L");
|
139
127
|
# }
|
140
|
-
#
|
128
|
+
#
|
141
129
|
# gr->SubPlot(3,2,4); gr->Title("TriPlot sample"); gr->Rotate(50,60);
|
142
130
|
# double t[] = {0,1,2, 0,1,3, 0,2,3, 1,2,3};
|
143
131
|
# double xt[] = {-1,1,0,0}, yt[] = {-1,-1,1,0}, zt[] = {-1,-1,-1,1};
|
144
132
|
# mglData tt(4,3,t), uu(4,xt), vv(4,yt), ww(4,zt);
|
145
133
|
# gr->TriPlot(tt,uu,vv,ww,"b");
|
146
134
|
# gr->TriPlot(tt,uu,vv,ww,"k#");
|
147
|
-
#
|
135
|
+
#
|
148
136
|
# gr->SubPlot(3,2,5);
|
149
137
|
# mglData r(4); r.Fill(1,4);
|
150
138
|
# gr->SetRanges(1,4,1,4); gr->Axis();
|
151
139
|
# gr->Mark(r,r,"s");
|
152
140
|
# gr->Plot(r,"b");
|
153
|
-
#
|
141
|
+
#
|
154
142
|
# gr->WriteJPEG("fexport.jpg");
|
155
143
|
# gr->WritePNG("fexport.png");
|
156
144
|
# gr->WriteBMP("fexport.bmp");
|
@@ -158,7 +146,7 @@ procs = {}
|
|
158
146
|
# gr->WriteEPS("fexport.eps");
|
159
147
|
# gr->WriteSVG("fexport.svg");
|
160
148
|
# gr->WriteGIF("fexport.gif");
|
161
|
-
#
|
149
|
+
#
|
162
150
|
# gr->WriteXYZ("fexport.xyz");
|
163
151
|
# gr->WriteSTL("fexport.stl");
|
164
152
|
# gr->WriteOFF("fexport.off");
|
@@ -410,7 +398,7 @@ procs['fexport'] = proc do
|
|
410
398
|
write_prc("fexport.prc")
|
411
399
|
end
|
412
400
|
|
413
|
-
# void smgl_data1(mglGraph *gr)
|
401
|
+
# void smgl_data1(mglGraph *gr)
|
414
402
|
# {
|
415
403
|
# mglData a(40,50,60),b; gr->Fill(a,"exp(-x^2-4*y^2-16*z^2)");
|
416
404
|
# gr->Light(true); gr->Alpha(true);
|
@@ -540,7 +528,7 @@ procs['data1'] = proc do
|
|
540
528
|
surf3(b)
|
541
529
|
end
|
542
530
|
|
543
|
-
# void smgl_data2(mglGraph *gr)
|
531
|
+
# void smgl_data2(mglGraph *gr)
|
544
532
|
# {
|
545
533
|
# mglData a(40,50,60),b; gr->Fill(a,"exp(-x^2-4*y^2-16*z^2)");
|
546
534
|
# gr->Light(true); gr->Alpha(true);
|
@@ -688,12 +676,12 @@ procs['data2'] = proc do
|
|
688
676
|
surf3(-0.5,b)
|
689
677
|
end
|
690
678
|
|
691
|
-
# void smgl_param1(mglGraph *gr)
|
679
|
+
# void smgl_param1(mglGraph *gr)
|
692
680
|
# {
|
693
681
|
# mglData x(100), y(100), z(100), c(100);
|
694
682
|
# gr->Fill(x,"sin(pi*x)"); gr->Fill(y,"cos(pi*x)");
|
695
683
|
# gr->Fill(z,"sin(2*pi*x)"); gr->Fill(c,"cos(2*pi*x)");
|
696
|
-
#
|
684
|
+
#
|
697
685
|
# gr->SubPlot(4,3,0); gr->Rotate(40,60); gr->Box(); gr->Plot(x,y,z);
|
698
686
|
# gr->SubPlot(4,3,1); gr->Rotate(40,60); gr->Box(); gr->Area(x,y,z);
|
699
687
|
# gr->SubPlot(4,3,2); gr->Rotate(40,60); gr->Box(); gr->Tens(x,y,z,c);
|
@@ -766,12 +754,12 @@ procs['param1'] = proc do
|
|
766
754
|
label(x,y,z,"%z")
|
767
755
|
end
|
768
756
|
|
769
|
-
# void smgl_param2(mglGraph *gr)
|
757
|
+
# void smgl_param2(mglGraph *gr)
|
770
758
|
# {
|
771
759
|
# mglData x(100,100), y(100,100), z(100,100), c(100,100);
|
772
760
|
# gr->Fill(x,"sin(pi*(x+y)/2)*cos(pi*y/2)"); gr->Fill(y,"cos(pi*(x+y)/2)*cos(pi*y/2)");
|
773
761
|
# gr->Fill(z,"sin(pi*y/2)"); gr->Fill(c,"cos(pi*x)");
|
774
|
-
#
|
762
|
+
#
|
775
763
|
# gr->SubPlot(4,4,0); gr->Rotate(40,60); gr->Box(); gr->Surf(x,y,z);
|
776
764
|
# gr->SubPlot(4,4,1); gr->Rotate(40,60); gr->Box(); gr->SurfC(x,y,z,c);
|
777
765
|
# gr->SubPlot(4,4,2); gr->Rotate(40,60); gr->Box(); gr->SurfA(x,y,z,c,"","alpha 1");
|
@@ -867,12 +855,12 @@ procs['param2'] = proc do
|
|
867
855
|
boxs(x,y,z,"@","meshnum 10;light on")
|
868
856
|
end
|
869
857
|
|
870
|
-
# void smgl_param3(mglGraph *gr)
|
858
|
+
# void smgl_param3(mglGraph *gr)
|
871
859
|
# {
|
872
860
|
# mglData x(50,50,50), y(50,50,50), z(50,50,50), c(50,50,50), d(50,50,50);
|
873
861
|
# gr->Fill(x,"(x+2)/3*sin(pi*y/2)"); gr->Fill(y,"(x+2)/3*cos(pi*y/2)"); gr->Fill(z,"z");
|
874
862
|
# gr->Fill(c,"-2*(x^2+y^2+z^4-z^2)+0.2"); gr->Fill(d,"1-2*tanh(2*(x+y)^2)");
|
875
|
-
#
|
863
|
+
#
|
876
864
|
# gr->Light(true); gr->Alpha(true);
|
877
865
|
# gr->SubPlot(4,3,0); gr->Rotate(40,60); gr->Box(); gr->Surf3(x,y,z,c);
|
878
866
|
# gr->SubPlot(4,3,1); gr->Rotate(40,60); gr->Box(); gr->Surf3C(x,y,z,c,d);
|
@@ -957,7 +945,7 @@ procs['param3'] = proc do
|
|
957
945
|
cont_fz(c,"",0)
|
958
946
|
end
|
959
947
|
|
960
|
-
# void smgl_paramv(mglGraph *gr)
|
948
|
+
# void smgl_paramv(mglGraph *gr)
|
961
949
|
# {
|
962
950
|
# mglData x(20,20,20), y(20,20,20), z(20,20,20), ex(20,20,20), ey(20,20,20), ez(20,20,20);
|
963
951
|
# gr->Fill(x,"(x+2)/3*sin(pi*y/2)"); gr->Fill(y,"(x+2)/3*cos(pi*y/2)"); gr->Fill(z,"x+z");
|
@@ -965,7 +953,7 @@ end
|
|
965
953
|
# mglData x1(20,20), y1(20,20), e1(20,20), e2(20,20);
|
966
954
|
# gr->Fill(x1,"(x+2)/3*sin(pi*y/2)"); gr->Fill(y1,"(x+2)/3*cos(pi*y/2)");
|
967
955
|
# gr->Fill(e1,"x"); gr->Fill(e2,"x^2+y");
|
968
|
-
#
|
956
|
+
#
|
969
957
|
# gr->SubPlot(3,3,0); gr->Rotate(40,60); gr->Box(); gr->Vect(x1,y1,e1,e2);
|
970
958
|
# gr->SubPlot(3,3,1); gr->Rotate(40,60); gr->Box(); gr->Flow(x1,y1,e1,e2);
|
971
959
|
# gr->SubPlot(3,3,2); gr->Rotate(40,60); gr->Box(); gr->Pipe(x1,y1,e1,e2);
|
@@ -1037,41 +1025,41 @@ procs['paramv'] = proc do
|
|
1037
1025
|
pipe(x,y,z,ex,ey,ez)
|
1038
1026
|
end
|
1039
1027
|
|
1040
|
-
# void smgl_solve(mglGraph *gr)
|
1028
|
+
# void smgl_solve(mglGraph *gr)
|
1041
1029
|
# {
|
1042
1030
|
# gr->SetRange('z',0,1);
|
1043
1031
|
# mglData x(20,30), y(20,30), z(20,30), xx,yy,zz;
|
1044
1032
|
# gr->Fill(x,"(x+2)/3*cos(pi*y)");
|
1045
1033
|
# gr->Fill(y,"(x+2)/3*sin(pi*y)");
|
1046
1034
|
# gr->Fill(z,"exp(-6*x^2-2*sin(pi*y)^2)");
|
1047
|
-
#
|
1035
|
+
#
|
1048
1036
|
# gr->SubPlot(2,1,0); gr->Title("Cartesian space"); gr->Rotate(30,-40);
|
1049
1037
|
# gr->Axis("xyzU"); gr->Box(); gr->Label('x',"x"); gr->Label('y',"y");
|
1050
1038
|
# gr->SetOrigin(1,1); gr->Grid("xy");
|
1051
1039
|
# gr->Mesh(x,y,z);
|
1052
|
-
#
|
1053
|
-
#
|
1040
|
+
#
|
1041
|
+
#
|
1054
1042
|
# mglData u = x.Solve(0.5,'x');
|
1055
1043
|
# mglData v(u.nx); v.Fill(0,1);
|
1056
1044
|
# xx = x.Evaluate(u,v); yy = y.Evaluate(u,v); zz = z.Evaluate(u,v);
|
1057
1045
|
# gr->Plot(xx,yy,zz,"k2o");
|
1058
|
-
#
|
1059
|
-
#
|
1046
|
+
#
|
1047
|
+
#
|
1060
1048
|
# mglData u1 = x.Solve(-0.5,'y');
|
1061
1049
|
# mglData v1(u1.nx); v1.Fill(0,1);
|
1062
1050
|
# xx = x.Evaluate(v1,u1); yy = y.Evaluate(v1,u1); zz = z.Evaluate(v1,u1);
|
1063
1051
|
# gr->Plot(xx,yy,zz,"b2^");
|
1064
|
-
#
|
1065
|
-
#
|
1052
|
+
#
|
1053
|
+
#
|
1066
1054
|
# mglData u2 = x.Solve(-0.5,'y',u1);
|
1067
1055
|
# xx = x.Evaluate(v1,u2); yy = y.Evaluate(v1,u2); zz = z.Evaluate(v1,u2);
|
1068
1056
|
# gr->Plot(xx,yy,zz,"r2v");
|
1069
|
-
#
|
1057
|
+
#
|
1070
1058
|
# gr->SubPlot(2,1,1); gr->Title("Accompanied space");
|
1071
1059
|
# gr->SetRanges(0,1,0,1); gr->SetOrigin(0,0);
|
1072
1060
|
# gr->Axis(); gr->Box(); gr->Label('x',"i"); gr->Label('y',"j");
|
1073
1061
|
# gr->Grid(z,"h");
|
1074
|
-
#
|
1062
|
+
#
|
1075
1063
|
# gr->Plot(u,v,"k2o"); gr->Line(mglPoint(0.4,0.5),mglPoint(0.8,0.5),"kA");
|
1076
1064
|
# gr->Plot(v1,u1,"b2^"); gr->Line(mglPoint(0.5,0.15),mglPoint(0.5,0.3),"bA");
|
1077
1065
|
# gr->Plot(v1,u2,"r2v"); gr->Line(mglPoint(0.5,0.7),mglPoint(0.5,0.85),"rA");
|
@@ -1133,16 +1121,16 @@ procs['solve'] = proc do
|
|
1133
1121
|
line([0.5,0.7],[0.5,0.85],"rA")
|
1134
1122
|
end
|
1135
1123
|
|
1136
|
-
# void smgl_triangulation(mglGraph *gr)
|
1124
|
+
# void smgl_triangulation(mglGraph *gr)
|
1137
1125
|
# {
|
1138
1126
|
# mglData x(100), y(100), z(100);
|
1139
1127
|
# gr->Fill(x,"2*rnd-1"); gr->Fill(y,"2*rnd-1"); gr->Fill(z,"v^2-w^2",x,y);
|
1140
1128
|
# mglData d = mglTriangulation(x,y), g(30,30);
|
1141
|
-
#
|
1129
|
+
#
|
1142
1130
|
# if(!mini) gr->Title("Triangulation");
|
1143
1131
|
# gr->Rotate(40,60); gr->Box(); gr->Light(true);
|
1144
1132
|
# gr->TriPlot(d,x,y,z); gr->TriPlot(d,x,y,z,"#k");
|
1145
|
-
#
|
1133
|
+
#
|
1146
1134
|
# gr->DataGrid(g,x,y,z); gr->Mesh(g,"m");
|
1147
1135
|
# }
|
1148
1136
|
procs['triangulation'] = proc do
|
@@ -1166,7 +1154,7 @@ procs['triangulation'] = proc do
|
|
1166
1154
|
mesh(g,"m")
|
1167
1155
|
end
|
1168
1156
|
|
1169
|
-
# void smgl_alpha(mglGraph *gr)
|
1157
|
+
# void smgl_alpha(mglGraph *gr)
|
1170
1158
|
# {
|
1171
1159
|
# mglData a; mgls_prepare2d(&a);
|
1172
1160
|
# gr->SubPlot(2,2,0); gr->Title("default"); gr->Rotate(50,60);
|
@@ -1206,7 +1194,7 @@ procs['alpha'] = proc do
|
|
1206
1194
|
surf(a)
|
1207
1195
|
end
|
1208
1196
|
|
1209
|
-
# void smgl_schemes(mglGraph *gr)
|
1197
|
+
# void smgl_schemes(mglGraph *gr)
|
1210
1198
|
# {
|
1211
1199
|
# mglData a(256,2); a.Fill(-1,1);
|
1212
1200
|
# gr->SubPlot(2,10,0,NULL,0.2); gr->Dens(a,"kw"); gr->Puts(0.07, 0.92, "'kw'", "A");
|
@@ -1295,29 +1283,29 @@ procs['schemes'] = proc do
|
|
1295
1283
|
puts(0.57, 0.02, "'b\\{g,0.3\\}r'", "A")
|
1296
1284
|
end
|
1297
1285
|
|
1298
|
-
# void smgl_curvcoor(mglGraph *gr)
|
1286
|
+
# void smgl_curvcoor(mglGraph *gr)
|
1299
1287
|
# {
|
1300
1288
|
# gr->SetOrigin(-1,1,-1);
|
1301
|
-
#
|
1289
|
+
#
|
1302
1290
|
# gr->SubPlot(2,2,0); gr->Title("Cartesian"); gr->Rotate(50,60);
|
1303
1291
|
# gr->FPlot("2*t-1","0.5","0","r2");
|
1304
1292
|
# gr->Axis(); gr->Grid();
|
1305
|
-
#
|
1293
|
+
#
|
1306
1294
|
# gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)",0);
|
1307
1295
|
# gr->SubPlot(2,2,1); gr->Title("Cylindrical"); gr->Rotate(50,60);
|
1308
1296
|
# gr->FPlot("2*t-1","0.5","0","r2");
|
1309
1297
|
# gr->Axis(); gr->Grid();
|
1310
|
-
#
|
1298
|
+
#
|
1311
1299
|
# gr->SetFunc("2*y*x","y*y - x*x",0);
|
1312
1300
|
# gr->SubPlot(2,2,2); gr->Title("Parabolic"); gr->Rotate(50,60);
|
1313
1301
|
# gr->FPlot("2*t-1","0.5","0","r2");
|
1314
1302
|
# gr->Axis(); gr->Grid();
|
1315
|
-
#
|
1303
|
+
#
|
1316
1304
|
# gr->SetFunc("y*sin(pi*x)","y*cos(pi*x)","x+z");
|
1317
1305
|
# gr->SubPlot(2,2,3); gr->Title("Spiral"); gr->Rotate(50,60);
|
1318
1306
|
# gr->FPlot("2*t-1","0.5","0","r2");
|
1319
1307
|
# gr->Axis(); gr->Grid();
|
1320
|
-
# gr->SetFunc(0,0,0);
|
1308
|
+
# gr->SetFunc(0,0,0);
|
1321
1309
|
# }
|
1322
1310
|
procs['curvcoor'] = proc do
|
1323
1311
|
set_origin(-1,1,-1)
|
@@ -1351,7 +1339,7 @@ procs['curvcoor'] = proc do
|
|
1351
1339
|
set_func("","","")
|
1352
1340
|
end
|
1353
1341
|
|
1354
|
-
# void smgl_style(mglGraph *gr)
|
1342
|
+
# void smgl_style(mglGraph *gr)
|
1355
1343
|
# {
|
1356
1344
|
# gr->SubPlot(2,2,0);
|
1357
1345
|
# double d,x1,x2,x0,y=0.95;
|
@@ -1364,7 +1352,7 @@ end
|
|
1364
1352
|
# gr->Line(mglPoint(x0,1-5*d),mglPoint(x1,1-5*d),"ki"); gr->Puts(mglPoint(x2,y-5*d),"Small dash-dot 'i'",":rL");
|
1365
1353
|
# gr->Line(mglPoint(x0,1-6*d),mglPoint(x1,1-6*d),"k:"); gr->Puts(mglPoint(x2,y-6*d),"Dots ':'",":rL");
|
1366
1354
|
# gr->Line(mglPoint(x0,1-7*d),mglPoint(x1,1-7*d),"k "); gr->Puts(mglPoint(x2,y-7*d),"None ' '",":rL");
|
1367
|
-
#
|
1355
|
+
#
|
1368
1356
|
# d=0.25; x1=-1; x0=-0.8; y = -0.05;
|
1369
1357
|
# gr->Mark(mglPoint(x1,5*d),"k."); gr->Puts(mglPoint(x0,y+5*d),"'.'",":rL");
|
1370
1358
|
# gr->Mark(mglPoint(x1,4*d),"k+"); gr->Puts(mglPoint(x0,y+4*d),"'+'",":rL");
|
@@ -1377,7 +1365,7 @@ end
|
|
1377
1365
|
# gr->Mark(mglPoint(x1,-3*d,0),"kv"); gr->Puts(mglPoint(x0,y-3*d),"'v'",":rL");
|
1378
1366
|
# gr->Mark(mglPoint(x1,-4*d,0),"k<"); gr->Puts(mglPoint(x0,y-4*d),"'<'",":rL");
|
1379
1367
|
# gr->Mark(mglPoint(x1,-5*d,0),"k>"); gr->Puts(mglPoint(x0,y-5*d),"'>'",":rL");
|
1380
|
-
#
|
1368
|
+
#
|
1381
1369
|
# d=0.25; x1=-0.5; x0=-0.3; y = -0.05;
|
1382
1370
|
# gr->Mark(mglPoint(x1,5*d),"k#."); gr->Puts(mglPoint(x0,y+5*d),"'\\#.'",":rL");
|
1383
1371
|
# gr->Mark(mglPoint(x1,4*d),"k#+"); gr->Puts(mglPoint(x0,y+4*d),"'\\#+'",":rL");
|
@@ -1390,7 +1378,7 @@ end
|
|
1390
1378
|
# gr->Mark(mglPoint(x1,-3*d,0),"k#v"); gr->Puts(mglPoint(x0,y-3*d),"'\\#v'",":rL");
|
1391
1379
|
# gr->Mark(mglPoint(x1,-4*d,0),"k#<"); gr->Puts(mglPoint(x0,y-4*d),"'\\#<'",":rL");
|
1392
1380
|
# gr->Mark(mglPoint(x1,-5*d,0),"k#>"); gr->Puts(mglPoint(x0,y-5*d),"'\\#>'",":rL");
|
1393
|
-
#
|
1381
|
+
#
|
1394
1382
|
# gr->SubPlot(2,2,1);
|
1395
1383
|
# double a=0.1,b=0.4,c=0.5;
|
1396
1384
|
# gr->Line(mglPoint(a,1),mglPoint(b,1),"k-A"); gr->Puts(mglPoint(c,1),"Style 'A' or 'A\\_'",":rL");
|
@@ -1404,7 +1392,7 @@ end
|
|
1404
1392
|
# gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"k-_"); gr->Puts(mglPoint(c,-0.6),"Style '\\_' or none",":rL");
|
1405
1393
|
# gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-AS"); gr->Puts(mglPoint(c,-0.8),"Style 'AS'",":rL");
|
1406
1394
|
# gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-_A"); gr->Puts(mglPoint(c,-1),"Style '\\_A'",":rL");
|
1407
|
-
#
|
1395
|
+
#
|
1408
1396
|
# a=-1; b=-0.7; c=-0.6;
|
1409
1397
|
# gr->Line(mglPoint(a,1),mglPoint(b,1),"kAA"); gr->Puts(mglPoint(c,1),"Style 'AA'",":rL");
|
1410
1398
|
# gr->Line(mglPoint(a,0.8),mglPoint(b,0.8),"kVV"); gr->Puts(mglPoint(c,0.8),"Style 'VV'",":rL");
|
@@ -1417,54 +1405,54 @@ end
|
|
1417
1405
|
# gr->Line(mglPoint(a,-0.6),mglPoint(b,-0.6),"k-__"); gr->Puts(mglPoint(c,-0.6),"Style '\\_\\_'",":rL");
|
1418
1406
|
# gr->Line(mglPoint(a,-0.8),mglPoint(b,-0.8),"k-VA"); gr->Puts(mglPoint(c,-0.8),"Style 'VA'",":rL");
|
1419
1407
|
# gr->Line(mglPoint(a,-1),mglPoint(b,-1),"k-AV"); gr->Puts(mglPoint(c,-1),"Style 'AV'",":rL");
|
1420
|
-
#
|
1408
|
+
#
|
1421
1409
|
# gr->SubPlot(2,2,2);
|
1422
|
-
#
|
1410
|
+
#
|
1423
1411
|
# gr->FaceZ(mglPoint(-1, -1), 0.4, 0.3, "L#"); gr->Puts(mglPoint(-0.8,-0.9), "L", "w:C", -1.4);
|
1424
1412
|
# gr->FaceZ(mglPoint(-0.6,-1), 0.4, 0.3, "E#"); gr->Puts(mglPoint(-0.4,-0.9), "E", "w:C", -1.4);
|
1425
1413
|
# gr->FaceZ(mglPoint(-0.2,-1), 0.4, 0.3, "N#"); gr->Puts(mglPoint(0, -0.9), "N", "w:C", -1.4);
|
1426
1414
|
# gr->FaceZ(mglPoint(0.2, -1), 0.4, 0.3, "U#"); gr->Puts(mglPoint(0.4,-0.9), "U", "w:C", -1.4);
|
1427
1415
|
# gr->FaceZ(mglPoint(0.6, -1), 0.4, 0.3, "Q#"); gr->Puts(mglPoint(0.8,-0.9), "Q", "w:C", -1.4);
|
1428
|
-
#
|
1416
|
+
#
|
1429
1417
|
# gr->FaceZ(mglPoint(-1, -0.7), 0.4, 0.3, "l#"); gr->Puts(mglPoint(-0.8,-0.6), "l", "k:C", -1.4);
|
1430
1418
|
# gr->FaceZ(mglPoint(-0.6,-0.7), 0.4, 0.3, "e#"); gr->Puts(mglPoint(-0.4,-0.6), "e", "k:C", -1.4);
|
1431
1419
|
# gr->FaceZ(mglPoint(-0.2,-0.7), 0.4, 0.3, "n#"); gr->Puts(mglPoint(0, -0.6), "n", "k:C", -1.4);
|
1432
1420
|
# gr->FaceZ(mglPoint(0.2, -0.7), 0.4, 0.3, "u#"); gr->Puts(mglPoint(0.4,-0.6), "u", "k:C", -1.4);
|
1433
1421
|
# gr->FaceZ(mglPoint(0.6, -0.7), 0.4, 0.3, "q#"); gr->Puts(mglPoint(0.8,-0.6), "q", "k:C", -1.4);
|
1434
|
-
#
|
1422
|
+
#
|
1435
1423
|
# gr->FaceZ(mglPoint(-1, -0.4), 0.4, 0.3, "C#"); gr->Puts(mglPoint(-0.8,-0.3), "C", "w:C", -1.4);
|
1436
1424
|
# gr->FaceZ(mglPoint(-0.6,-0.4), 0.4, 0.3, "M#"); gr->Puts(mglPoint(-0.4,-0.3), "M", "w:C", -1.4);
|
1437
1425
|
# gr->FaceZ(mglPoint(-0.2,-0.4), 0.4, 0.3, "Y#"); gr->Puts(mglPoint(0, -0.3), "Y", "w:C", -1.4);
|
1438
1426
|
# gr->FaceZ(mglPoint(0.2, -0.4), 0.4, 0.3, "k#"); gr->Puts(mglPoint(0.4,-0.3), "k", "w:C", -1.4);
|
1439
1427
|
# gr->FaceZ(mglPoint(0.6, -0.4), 0.4, 0.3, "P#"); gr->Puts(mglPoint(0.8,-0.3), "P", "w:C", -1.4);
|
1440
|
-
#
|
1428
|
+
#
|
1441
1429
|
# gr->FaceZ(mglPoint(-1, -0.1), 0.4, 0.3, "c#"); gr->Puts(mglPoint(-0.8, 0), "c", "k:C", -1.4);
|
1442
1430
|
# gr->FaceZ(mglPoint(-0.6,-0.1), 0.4, 0.3, "m#"); gr->Puts(mglPoint(-0.4, 0), "m", "k:C", -1.4);
|
1443
1431
|
# gr->FaceZ(mglPoint(-0.2,-0.1), 0.4, 0.3, "y#"); gr->Puts(mglPoint(0, 0), "y", "k:C", -1.4);
|
1444
1432
|
# gr->FaceZ(mglPoint(0.2, -0.1), 0.4, 0.3, "w#"); gr->Puts(mglPoint(0.4, 0), "w", "k:C", -1.4);
|
1445
1433
|
# gr->FaceZ(mglPoint(0.6, -0.1), 0.4, 0.3, "p#"); gr->Puts(mglPoint(0.8, 0), "p", "k:C", -1.4);
|
1446
|
-
#
|
1434
|
+
#
|
1447
1435
|
# gr->FaceZ(mglPoint(-1, 0.2), 0.4, 0.3, "B#"); gr->Puts(mglPoint(-0.8, 0.3), "B", "w:C", -1.4);
|
1448
1436
|
# gr->FaceZ(mglPoint(-0.6,0.2), 0.4, 0.3, "G#"); gr->Puts(mglPoint(-0.4, 0.3), "G", "w:C", -1.4);
|
1449
1437
|
# gr->FaceZ(mglPoint(-0.2,0.2), 0.4, 0.3, "R#"); gr->Puts(mglPoint(0, 0.3), "R", "w:C", -1.4);
|
1450
1438
|
# gr->FaceZ(mglPoint(0.2, 0.2), 0.4, 0.3, "H#"); gr->Puts(mglPoint(0.4, 0.3), "H", "w:C", -1.4);
|
1451
1439
|
# gr->FaceZ(mglPoint(0.6, 0.2), 0.4, 0.3, "W#"); gr->Puts(mglPoint(0.8, 0.3), "W", "w:C", -1.4);
|
1452
|
-
#
|
1440
|
+
#
|
1453
1441
|
# gr->FaceZ(mglPoint(-1, 0.5), 0.4, 0.3, "b#"); gr->Puts(mglPoint(-0.8, 0.6), "b", "k:C", -1.4);
|
1454
1442
|
# gr->FaceZ(mglPoint(-0.6,0.5), 0.4, 0.3, "g#"); gr->Puts(mglPoint(-0.4, 0.6), "g", "k:C", -1.4);
|
1455
1443
|
# gr->FaceZ(mglPoint(-0.2,0.5), 0.4, 0.3, "r#"); gr->Puts(mglPoint(0, 0.6), "r", "k:C", -1.4);
|
1456
1444
|
# gr->FaceZ(mglPoint(0.2, 0.5), 0.4, 0.3, "h#"); gr->Puts(mglPoint(0.4, 0.6), "h", "k:C", -1.4);
|
1457
1445
|
# gr->FaceZ(mglPoint(0.6, 0.5), 0.4, 0.3, "w#"); gr->Puts(mglPoint(0.8, 0.6), "w", "k:C", -1.4);
|
1458
|
-
#
|
1446
|
+
#
|
1459
1447
|
# gr->FaceZ(mglPoint(-1, 0.8), 0.4, 0.3, "{r1}#"); gr->Puts(mglPoint(-0.8, 0.9), "\\{r1\\}", "w:C", -1.4);
|
1460
1448
|
# gr->FaceZ(mglPoint(-0.6,0.8), 0.4, 0.3, "{r3}#"); gr->Puts(mglPoint(-0.4, 0.9), "\\{r3\\}", "w:C", -1.4);
|
1461
1449
|
# gr->FaceZ(mglPoint(-0.2,0.8), 0.4, 0.3, "{r5}#"); gr->Puts(mglPoint(0, 0.9), "\\{r5\\}", "k:C", -1.4);
|
1462
1450
|
# gr->FaceZ(mglPoint(0.2, 0.8), 0.4, 0.3, "{r7}#"); gr->Puts(mglPoint(0.4, 0.9), "\\{r7\\}", "k:C", -1.4);
|
1463
1451
|
# gr->FaceZ(mglPoint(0.6, 0.8), 0.4, 0.3, "{r9}#"); gr->Puts(mglPoint(0.8, 0.9), "\\{r9\\}", "k:C", -1.4);
|
1464
|
-
#
|
1452
|
+
#
|
1465
1453
|
# gr->FaceZ(mglPoint(-1, -1.3), 1, 0.3, "{xff9966}#"); gr->Puts(mglPoint(-0.5,-1.2), "\\{xff9966\\}", "k:C", -1.4);
|
1466
1454
|
# gr->FaceZ(mglPoint(0, -1.3), 1, 0.3, "{x83CAFF}#"); gr->Puts(mglPoint( 0.5,-1.2), "\\{x83CAFF\\}", "k:C", -1.4);
|
1467
|
-
#
|
1455
|
+
#
|
1468
1456
|
# gr->SubPlot(2,2,3);
|
1469
1457
|
# char stl[3]="r1", txt[4]="'1'";
|
1470
1458
|
# for(int i=0;i<10;i++)
|
@@ -1685,7 +1673,7 @@ procs['style'] = proc do
|
|
1685
1673
|
end
|
1686
1674
|
end
|
1687
1675
|
|
1688
|
-
# void smgl_text(mglGraph *gr)
|
1676
|
+
# void smgl_text(mglGraph *gr)
|
1689
1677
|
# {
|
1690
1678
|
# if(!mini) gr->SubPlot(2,2,0,"");
|
1691
1679
|
# gr->Putsw(mglPoint(0,1),L"Text can be in ASCII and in Unicode");
|
@@ -1698,17 +1686,17 @@ end
|
|
1698
1686
|
# gr->Puts(mglPoint(0,-1),"It parse TeX: \\int \\alpha \\cdot "
|
1699
1687
|
# "\\sqrt3{sin(\\pi x)^2 + \\gamma_{i_k}} dx");
|
1700
1688
|
# if(mini) return;
|
1701
|
-
#
|
1689
|
+
#
|
1702
1690
|
# gr->SubPlot(2,2,1,"");
|
1703
1691
|
# gr->Puts(mglPoint(0,0.5), "\\sqrt{\\frac{\\alpha^{\\gamma^2}+\\overset 1{\\big\\infty}}{\\sqrt3{2+b}}}", "@", -2);
|
1704
1692
|
# gr->Puts(mglPoint(0,-0.5),"Text can be printed\non several lines");
|
1705
|
-
#
|
1693
|
+
#
|
1706
1694
|
# gr->SubPlot(2,2,2,"");
|
1707
1695
|
# mglData y; mgls_prepare1d(&y);
|
1708
1696
|
# gr->Box(); gr->Plot(y.SubData(-1,0));
|
1709
1697
|
# gr->Text(y,"This is very very long string drawn along a curve","k");
|
1710
1698
|
# gr->Text(y,"Another string drawn above a curve","Tr");
|
1711
|
-
#
|
1699
|
+
#
|
1712
1700
|
# gr->SubPlot(2,2,3,"");
|
1713
1701
|
# gr->Line(mglPoint(-1,-1),mglPoint(1,-1),"rA"); gr->Puts(mglPoint(0,-1),mglPoint(1,-1),"Horizontal");
|
1714
1702
|
# gr->Line(mglPoint(-1,-1),mglPoint(1,1),"rA"); gr->Puts(mglPoint(0,0),mglPoint(1,1),"At angle","@");
|
@@ -1746,7 +1734,7 @@ procs['text'] = proc do
|
|
1746
1734
|
puts([-1,0],[-1,1],"Vertical")
|
1747
1735
|
end
|
1748
1736
|
|
1749
|
-
# void smgl_fonts(mglGraph *gr)
|
1737
|
+
# void smgl_fonts(mglGraph *gr)
|
1750
1738
|
# {
|
1751
1739
|
# double h=1.1, d=0.25;
|
1752
1740
|
# gr->LoadFont("STIX"); gr->Puts(mglPoint(0,h), "default font (STIX)");
|
@@ -1800,7 +1788,7 @@ end
|
|
1800
1788
|
# mglData yc(30), xc(30), z(30); z.Modify("2*x-1");
|
1801
1789
|
# yc.Modify("sin(pi*(2*x-1))"); xc.Modify("cos(pi*2*x-pi)");
|
1802
1790
|
# gr->Bars(xc,yc,z,"r");
|
1803
|
-
# gr->SetRanges(-1,1,-3,3);
|
1791
|
+
# gr->SetRanges(-1,1,-3,3);
|
1804
1792
|
# gr->SubPlot(3,2,2,""); gr->Title("'a' style"); gr->Box(); gr->Bars(ys,"a");
|
1805
1793
|
# gr->SubPlot(3,2,3,""); gr->Title("'f' style"); gr->Box(); gr->Bars(ys,"f");
|
1806
1794
|
# }
|
@@ -1855,7 +1843,7 @@ end
|
|
1855
1843
|
# gr->Box(); gr->Barh(ys);
|
1856
1844
|
# if(mini) return;
|
1857
1845
|
# gr->SubPlot(2,2,1,""); gr->Title("2 colors"); gr->Box(); gr->Barh(ys,"cbgGyr");
|
1858
|
-
# gr->SetRanges(-3,3,-1,1);
|
1846
|
+
# gr->SetRanges(-3,3,-1,1);
|
1859
1847
|
# gr->SubPlot(2,2,2,""); gr->Title("'a' style"); gr->Box(); gr->Barh(ys,"a");
|
1860
1848
|
# gr->SubPlot(2,2,3,""); gr->Title("'f' style"); gr->Box(); gr->Barh(ys,"f");
|
1861
1849
|
# }
|
@@ -2158,7 +2146,7 @@ procs['step'] = proc do
|
|
2158
2146
|
step(y,"s!rgb")
|
2159
2147
|
end
|
2160
2148
|
|
2161
|
-
# void smgl_boxplot(mglGraph *gr)
|
2149
|
+
# void smgl_boxplot(mglGraph *gr)
|
2162
2150
|
# {
|
2163
2151
|
# mglData a(10,7); a.Modify("(2*rnd-1)^3/2");
|
2164
2152
|
# if(!mini) { gr->SubPlot(1,1,0,""); gr->Title("Boxplot plot"); }
|
@@ -2175,7 +2163,7 @@ procs['boxplot'] = proc do
|
|
2175
2163
|
box_plot(a)
|
2176
2164
|
end
|
2177
2165
|
|
2178
|
-
# void smgl_type0(mglGraph *gr)
|
2166
|
+
# void smgl_type0(mglGraph *gr)
|
2179
2167
|
# {
|
2180
2168
|
# gr->Alpha(true); gr->Light(true);
|
2181
2169
|
# mglData a; mgls_prepare2d(&a);
|
@@ -2210,7 +2198,7 @@ procs['type0'] = proc do
|
|
2210
2198
|
box()
|
2211
2199
|
end
|
2212
2200
|
|
2213
|
-
# void smgl_type1(mglGraph *gr)
|
2201
|
+
# void smgl_type1(mglGraph *gr)
|
2214
2202
|
# {
|
2215
2203
|
# gr->Alpha(true); gr->Light(true);
|
2216
2204
|
# mglData a; mgls_prepare2d(&a);
|
@@ -2245,7 +2233,7 @@ procs['type1'] = proc do
|
|
2245
2233
|
box()
|
2246
2234
|
end
|
2247
2235
|
|
2248
|
-
# void smgl_type2(mglGraph *gr)
|
2236
|
+
# void smgl_type2(mglGraph *gr)
|
2249
2237
|
# {
|
2250
2238
|
# gr->Alpha(true); gr->Light(true);
|
2251
2239
|
# mglData a; mgls_prepare2d(&a);
|
@@ -2280,12 +2268,12 @@ procs['type2'] = proc do
|
|
2280
2268
|
box()
|
2281
2269
|
end
|
2282
2270
|
|
2283
|
-
# void smgl_molecule(mglGraph *gr)
|
2271
|
+
# void smgl_molecule(mglGraph *gr)
|
2284
2272
|
# {
|
2285
|
-
# gr->VertexColor(false); gr->Compression(false);
|
2286
|
-
# gr->DoubleSided(false);
|
2273
|
+
# gr->VertexColor(false); gr->Compression(false);
|
2274
|
+
# gr->DoubleSided(false);
|
2287
2275
|
# gr->Alpha(true); gr->Light(true);
|
2288
|
-
#
|
2276
|
+
#
|
2289
2277
|
# gr->SubPlot(2,2,0,""); gr->Title("Methane, CH_4");
|
2290
2278
|
# gr->StartGroup("Methane");
|
2291
2279
|
# gr->Rotate(60,120);
|
@@ -2299,7 +2287,7 @@ end
|
|
2299
2287
|
# gr->Drop(mglPoint(0,0,0),mglPoint(0.47,-0.82,-0.33),0.35,"h",1,2);
|
2300
2288
|
# gr->Sphere(mglPoint(0.33,-0.57,-0.23),0.25,"g");
|
2301
2289
|
# gr->EndGroup();
|
2302
|
-
#
|
2290
|
+
#
|
2303
2291
|
# gr->SubPlot(2,2,1,""); gr->Title("Water, H_{2}O");
|
2304
2292
|
# gr->StartGroup("Water");
|
2305
2293
|
# gr->Rotate(60,100);
|
@@ -2319,7 +2307,7 @@ end
|
|
2319
2307
|
# gr->Sphere(mglPoint(0.3,-0.5,0),0.25,"g");
|
2320
2308
|
# gr->EndGroup();
|
2321
2309
|
# gr->EndGroup();
|
2322
|
-
#
|
2310
|
+
#
|
2323
2311
|
# gr->SubPlot(2,2,2,""); gr->Title("Oxygen, O_2");
|
2324
2312
|
# gr->StartGroup("Oxygen");
|
2325
2313
|
# gr->Rotate(60,120);
|
@@ -2328,7 +2316,7 @@ end
|
|
2328
2316
|
# gr->Drop(mglPoint(0,-0.5,0),mglPoint(0,0.3,0),0.3,"m",1,2);
|
2329
2317
|
# gr->Sphere(mglPoint(0,-0.5,0),0.25,"r");
|
2330
2318
|
# gr->EndGroup();
|
2331
|
-
#
|
2319
|
+
#
|
2332
2320
|
# gr->SubPlot(2,2,3,""); gr->Title("Ammonia, NH_3");
|
2333
2321
|
# gr->StartGroup("Ammonia");
|
2334
2322
|
# gr->Rotate(60,120);
|
@@ -2340,7 +2328,7 @@ end
|
|
2340
2328
|
# gr->Drop(mglPoint(0,0,0),mglPoint(-0.65,0,0),0.32,"n",1,2);
|
2341
2329
|
# gr->Sphere(mglPoint(-0.65,0,0),0.25,"g");
|
2342
2330
|
# gr->EndGroup();
|
2343
|
-
# gr->DoubleSided( true );
|
2331
|
+
# gr->DoubleSided( true );
|
2344
2332
|
# }
|
2345
2333
|
procs['molecule'] = proc do
|
2346
2334
|
vertex_color(false)
|
@@ -2727,17 +2715,17 @@ procs['fog'] = proc do
|
|
2727
2715
|
surf(a)
|
2728
2716
|
end
|
2729
2717
|
|
2730
|
-
# void smgl_map(mglGraph *gr)
|
2718
|
+
# void smgl_map(mglGraph *gr)
|
2731
2719
|
# {
|
2732
2720
|
# mglData a(50, 40), b(50, 40);
|
2733
2721
|
# gr->Puts(mglPoint(0, 0), "\\to", ":C", -1.4);
|
2734
2722
|
# gr->SetRanges(-1,1,-1,1,-2,2);
|
2735
|
-
#
|
2723
|
+
#
|
2736
2724
|
# gr->SubPlot(2, 1, 0);
|
2737
2725
|
# gr->Fill(a,"x"); gr->Fill(b,"y");
|
2738
2726
|
# gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", ":C", -2); gr->Box();
|
2739
2727
|
# gr->Map(a, b, "brgk");
|
2740
|
-
#
|
2728
|
+
#
|
2741
2729
|
# gr->SubPlot(2, 1, 1);
|
2742
2730
|
# gr->Fill(a,"(x^3+y^3)/2"); gr->Fill(b,"(x-y)/2");
|
2743
2731
|
# gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", ":C", -2);
|
@@ -2763,7 +2751,7 @@ procs['map'] = proc do
|
|
2763
2751
|
map(a, b, "brgk")
|
2764
2752
|
end
|
2765
2753
|
|
2766
|
-
# void smgl_stfa(mglGraph *gr)
|
2754
|
+
# void smgl_stfa(mglGraph *gr)
|
2767
2755
|
# {
|
2768
2756
|
# mglData a(2000), b(2000);
|
2769
2757
|
# gr->Fill(a,"cos(50*pi*x)*(x<-.5)+cos(100*pi*x)*(x<0)*(x>-.5)+\
|
@@ -2772,7 +2760,7 @@ end
|
|
2772
2760
|
# gr->Plot(a);
|
2773
2761
|
# gr->Axis();
|
2774
2762
|
# gr->Label('x', "\\i t");
|
2775
|
-
#
|
2763
|
+
#
|
2776
2764
|
# gr->SubPlot(1, 2, 1,"<_"); gr->Title("STFA plot");
|
2777
2765
|
# gr->STFA(a, b, 64);
|
2778
2766
|
# gr->Axis();
|
@@ -2805,7 +2793,7 @@ end
|
|
2805
2793
|
# if(!mini) {gr->SubPlot(1,1,0,"<_"); gr->Title("Beam and ray tracing");}
|
2806
2794
|
# gr->Plot(r.SubData(0), r.SubData(1), "k");
|
2807
2795
|
# gr->Axis(); gr->Label('x', "\\i x"); gr->Label('y', "\\i y");
|
2808
|
-
#
|
2796
|
+
#
|
2809
2797
|
# gr->Fill(re,"exp(-48*x^2)");
|
2810
2798
|
# a = mglQO2d(ham, re, im, r, xx, yy, 1, 30);
|
2811
2799
|
# gr->SetRange('c',0, 1);
|
@@ -2840,7 +2828,7 @@ procs['qo2d'] = proc do
|
|
2840
2828
|
puts([0.7, -0.05], "central ray")
|
2841
2829
|
end
|
2842
2830
|
|
2843
|
-
# void smgl_pde(mglGraph *gr)
|
2831
|
+
# void smgl_pde(mglGraph *gr)
|
2844
2832
|
# {
|
2845
2833
|
# mglData a,re(128),im(128);
|
2846
2834
|
# gr->Fill(re,"exp(-48*(x+0.7)^2)");
|
@@ -3100,7 +3088,7 @@ end
|
|
3100
3088
|
# mglData a,v(5),a1(30,40,3); mgls_prepare2d(&a); v.a[0]=-0.5;
|
3101
3089
|
# v.a[1]=-0.15; v.a[2]=0; v.a[3]=0.15; v.a[4]=0.5;
|
3102
3090
|
# gr->Fill(a1,"0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)");
|
3103
|
-
#
|
3091
|
+
#
|
3104
3092
|
# if(!mini) { gr->SubPlot(2,2,0); gr->Title("ContF plot (default)"); }
|
3105
3093
|
# gr->Rotate(50,60); gr->Box(); gr->ContF(a);
|
3106
3094
|
# if(mini) return;
|
@@ -3154,7 +3142,7 @@ end
|
|
3154
3142
|
# mglData a,v(5),a1(30,40,3); mgls_prepare2d(&a); v.a[0]=-0.5;
|
3155
3143
|
# v.a[1]=-0.15; v.a[2]=0; v.a[3]=0.15; v.a[4]=0.5;
|
3156
3144
|
# gr->Fill(a1,"0.6*sin(2*pi*x+pi*(z+1)/2)*sin(3*pi*y+pi*z) + 0.4*cos(3*pi*(x*y)+pi*(z+1)^2/2)");
|
3157
|
-
#
|
3145
|
+
#
|
3158
3146
|
# if(!mini) { gr->SubPlot(2,2,0); gr->Title("ContD plot (default)"); }
|
3159
3147
|
# gr->Rotate(50,60); gr->Box(); gr->ContD(a);
|
3160
3148
|
# if(mini) return;
|
@@ -3341,7 +3329,7 @@ procs['axial'] = proc do
|
|
3341
3329
|
axial(a,"#")
|
3342
3330
|
end
|
3343
3331
|
|
3344
|
-
# void smgl_several_light(mglGraph *gr)
|
3332
|
+
# void smgl_several_light(mglGraph *gr)
|
3345
3333
|
# {
|
3346
3334
|
# mglData a; mgls_prepare2d(&a);
|
3347
3335
|
# if(!mini) gr->Title("Several light sources");
|
@@ -3445,7 +3433,7 @@ procs['surf3c'] = proc do
|
|
3445
3433
|
surf_3c(c,d)
|
3446
3434
|
end
|
3447
3435
|
|
3448
|
-
# void smgl_cut(mglGraph *gr)
|
3436
|
+
# void smgl_cut(mglGraph *gr)
|
3449
3437
|
# {
|
3450
3438
|
# mglData a,c,v(1); mgls_prepare2d(&a); mgls_prepare3d(&c); v.a[0]=0.5;
|
3451
3439
|
# gr->SubPlot(2,2,0); gr->Title("Cut on (default)"); gr->Rotate(50,60); gr->Light(true);
|
@@ -3455,10 +3443,10 @@ end
|
|
3455
3443
|
# gr->SubPlot(2,2,2); gr->Title("Cut in box"); gr->Rotate(50,60);
|
3456
3444
|
# gr->SetCutBox(mglPoint(0,-1,-1), mglPoint(1,0,1.1));
|
3457
3445
|
# gr->Alpha(true); gr->Box(); gr->Surf3(c);
|
3458
|
-
# gr->SetCutBox(mglPoint(0), mglPoint(0));
|
3446
|
+
# gr->SetCutBox(mglPoint(0), mglPoint(0));
|
3459
3447
|
# gr->SubPlot(2,2,3); gr->Title("Cut by formula"); gr->Rotate(50,60);
|
3460
3448
|
# gr->CutOff("(z>(x+0.5*y-1)^2-1) & (z>(x-0.5*y-1)^2-1)");
|
3461
|
-
# gr->Box(); gr->Surf3(c); gr->CutOff("");
|
3449
|
+
# gr->Box(); gr->Surf3(c); gr->CutOff("");
|
3462
3450
|
# }
|
3463
3451
|
procs['cut'] = proc do
|
3464
3452
|
a = MathGL::MglData.new
|
@@ -3785,7 +3773,7 @@ procs['boxs'] = proc do
|
|
3785
3773
|
tile(a)
|
3786
3774
|
end
|
3787
3775
|
|
3788
|
-
# void smgl_fit(mglGraph *gr)
|
3776
|
+
# void smgl_fit(mglGraph *gr)
|
3789
3777
|
# {
|
3790
3778
|
# mglData rnd(100), in(100), res;
|
3791
3779
|
# gr->Fill(rnd,"0.4*rnd+0.1+sin(2*pi*x)");
|
@@ -3799,7 +3787,7 @@ end
|
|
3799
3787
|
# gr->Puts(mglPoint(-0.9, -1.3), "fitted:", "r:L");
|
3800
3788
|
# gr->PutsFit(mglPoint(0, -1.8), "y = ", "r");
|
3801
3789
|
# gr->Puts(mglPoint(0, 2.2), "initial: y = 0.3+sin(2\\pi x)", "b");
|
3802
|
-
#
|
3790
|
+
#
|
3803
3791
|
# }
|
3804
3792
|
procs['fit'] = proc do
|
3805
3793
|
rnd = MathGL::MglData.new(100)
|
@@ -4061,7 +4049,7 @@ end
|
|
4061
4049
|
# gr->SubPlot(2,2,2); gr->Title("'\\#' style");
|
4062
4050
|
# gr->Rotate(50,60); gr->Box(); gr->Cones(ys,"#");
|
4063
4051
|
# gr->SubPlot(2,2,3); gr->Title("'a' style");
|
4064
|
-
# gr->SetRange('z',-2,2);
|
4052
|
+
# gr->SetRange('z',-2,2);
|
4065
4053
|
# gr->Rotate(50,60); gr->Box(); gr->Cones(ys,"a");
|
4066
4054
|
# }
|
4067
4055
|
procs['cones'] = proc do
|
@@ -4097,7 +4085,7 @@ procs['cones'] = proc do
|
|
4097
4085
|
cones(ys,"a")
|
4098
4086
|
end
|
4099
4087
|
|
4100
|
-
# void smgl_aspect(mglGraph *gr)
|
4088
|
+
# void smgl_aspect(mglGraph *gr)
|
4101
4089
|
# {
|
4102
4090
|
# gr->SubPlot(2,2,0); gr->Box();
|
4103
4091
|
# gr->Puts(mglPoint(-1,1.1),"Just box",":L");
|
@@ -4199,7 +4187,7 @@ procs['inplot'] = proc do
|
|
4199
4187
|
box()
|
4200
4188
|
end
|
4201
4189
|
|
4202
|
-
# void smgl_combined(mglGraph *gr)
|
4190
|
+
# void smgl_combined(mglGraph *gr)
|
4203
4191
|
# {
|
4204
4192
|
# mglData a,b,d; mgls_prepare2v(&a,&b); d = a;
|
4205
4193
|
# for(int i=0;i<a.nx*a.ny;i++) d.a[i] = hypot(a.a[i],b.a[i]);
|
@@ -4265,18 +4253,18 @@ end
|
|
4265
4253
|
# {
|
4266
4254
|
# gr->SubPlot(2,2,0); gr->Title("Axis origin, Grid"); gr->SetOrigin(0,0);
|
4267
4255
|
# gr->Axis(); gr->Grid(); gr->FPlot("x^3");
|
4268
|
-
#
|
4256
|
+
#
|
4269
4257
|
# gr->SubPlot(2,2,1); gr->Title("2 axis");
|
4270
|
-
# gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1,-1,-1);
|
4258
|
+
# gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1,-1,-1);
|
4271
4259
|
# gr->Axis(); gr->Label('y',"axis 1",0); gr->FPlot("sin(pi*x)","r2");
|
4272
|
-
# gr->SetRanges(0,1,0,1); gr->SetOrigin(1,1,1);
|
4260
|
+
# gr->SetRanges(0,1,0,1); gr->SetOrigin(1,1,1);
|
4273
4261
|
# gr->Axis(); gr->Label('y',"axis 2",0); gr->FPlot("cos(pi*x)");
|
4274
|
-
#
|
4262
|
+
#
|
4275
4263
|
# gr->SubPlot(2,2,3); gr->Title("More axis"); gr->SetOrigin(NAN,NAN); gr->SetRange('x',-1,1);
|
4276
4264
|
# gr->Axis(); gr->Label('x',"x",0); gr->Label('y',"y_1",0); gr->FPlot("x^2","k");
|
4277
|
-
# gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1.3,-1);
|
4265
|
+
# gr->SetRanges(-1,1,-1,1); gr->SetOrigin(-1.3,-1);
|
4278
4266
|
# gr->Axis("y","r"); gr->Label('y',"#r{y_2}",0.2); gr->FPlot("x^3","r");
|
4279
|
-
#
|
4267
|
+
#
|
4280
4268
|
# gr->SubPlot(2,2,2); gr->Title("4 segments, inverted axis"); gr->SetOrigin(0,0);
|
4281
4269
|
# gr->InPlot(0.5,1,0.5,1); gr->SetRanges(0,10,0,2); gr->Axis();
|
4282
4270
|
# gr->FPlot("sqrt(x/2)"); gr->Label('x',"W",1); gr->Label('y',"U",1);
|
@@ -4351,12 +4339,12 @@ end
|
|
4351
4339
|
# gr->SetRanges(100,100.1,10,10.01); gr->Axis();
|
4352
4340
|
# gr->SubPlot(3,2,4); gr->Title("Disable ticks tuning");
|
4353
4341
|
# gr->SetTuneTicks(0); gr->Axis();
|
4354
|
-
#
|
4342
|
+
#
|
4355
4343
|
# gr->SubPlot(3,2,2); gr->Title("Manual ticks"); gr->SetRanges(-M_PI,M_PI, 0, 2);
|
4356
4344
|
# double val[]={-M_PI, -M_PI/2, 0, 0.886, M_PI/2, M_PI};
|
4357
4345
|
# gr->SetTicksVal('x', mglData(6,val), "-\\pi\n-\\pi/2\n0\nx^*\n\\pi/2\n\\pi");
|
4358
4346
|
# gr->Axis(); gr->Grid(); gr->FPlot("2*cos(x^2)^2", "r2");
|
4359
|
-
#
|
4347
|
+
#
|
4360
4348
|
# gr->SubPlot(3,2,5); gr->Title("Time ticks"); gr->SetRange('x',0,3e5);
|
4361
4349
|
# gr->SetTicksTime('x',0); gr->Axis();
|
4362
4350
|
# }
|
@@ -4417,7 +4405,7 @@ procs['box'] = proc do
|
|
4417
4405
|
box("@cm")
|
4418
4406
|
end
|
4419
4407
|
|
4420
|
-
# void smgl_loglog(mglGraph *gr)
|
4408
|
+
# void smgl_loglog(mglGraph *gr)
|
4421
4409
|
# {
|
4422
4410
|
# gr->SubPlot(2,2,0,"<_"); gr->Title("Semi-log axis"); gr->SetRanges(0.01,100,-1,1); gr->SetFunc("lg(x)","");
|
4423
4411
|
# gr->Axis(); gr->Grid("xy","g"); gr->FPlot("sin(1/x)"); gr->Label('x',"x",0); gr->Label('y', "y = sin 1/x",0);
|
@@ -4542,7 +4530,7 @@ procs['hist'] = proc do
|
|
4542
4530
|
puts([0.5,0.5],"Hist and\nMultiPlot\nsample","a",-3)
|
4543
4531
|
end
|
4544
4532
|
|
4545
|
-
# void smgl_primitives(mglGraph *gr)
|
4533
|
+
# void smgl_primitives(mglGraph *gr)
|
4546
4534
|
# {
|
4547
4535
|
# gr->SubPlot(2,2,0,""); gr->Title("Line, Curve, Rhomb, Ellipse","",-1.5);
|
4548
4536
|
# gr->Line(mglPoint(-1,-1),mglPoint(-0.5,1),"qAI");
|
@@ -4552,14 +4540,14 @@ end
|
|
4552
4540
|
# gr->Ellipse(mglPoint(0,-0.5),mglPoint(1,-0.1),0.2,"u#");
|
4553
4541
|
# gr->Ellipse(mglPoint(0,-1),mglPoint(1,-0.6),0.2,"m@");
|
4554
4542
|
# gr->Mark(mglPoint(0,-0.5),"*"); gr->Mark(mglPoint(1,-0.1),"*");
|
4555
|
-
#
|
4543
|
+
#
|
4556
4544
|
# gr->Light(true);
|
4557
4545
|
# gr->SubPlot(2,2,1); gr->Title("Face[xyz]"); gr->Rotate(50,60); gr->Box();
|
4558
4546
|
# gr->FaceX(mglPoint(1,0,-1),1,1,"r");
|
4559
4547
|
# gr->FaceY(mglPoint(-1,-1,-1),1,1,"g");
|
4560
4548
|
# gr->FaceZ(mglPoint(1,-1,-1),-1,1,"b");
|
4561
4549
|
# gr->Face(mglPoint(-1,-1,1),mglPoint(-1,1,1),mglPoint(1,-1,0),mglPoint(1,1,1),"bmgr");
|
4562
|
-
#
|
4550
|
+
#
|
4563
4551
|
# gr->SubPlot(2,2,3,""); gr->Title("Cone");
|
4564
4552
|
# gr->Cone(mglPoint(-0.7,-0.3),mglPoint(-0.7,0.7,0.5),0.2,0.1,"b");
|
4565
4553
|
# gr->Puts(mglPoint(-0.7,-0.7),"no edges\n(default)");
|
@@ -4567,7 +4555,7 @@ end
|
|
4567
4555
|
# gr->Puts(mglPoint(0,-0.7),"with edges\n('\\@' style)");
|
4568
4556
|
# gr->Cone(mglPoint(0.7,-0.3),mglPoint(0.7,0.7,0.5),0.2,0,"ry");
|
4569
4557
|
# gr->Puts(mglPoint(0.7,-0.7),"'arrow' with\ngradient");
|
4570
|
-
#
|
4558
|
+
#
|
4571
4559
|
# gr->SubPlot(2,2,2,""); gr->Title("Sphere and Drop"); gr->Alpha(false);
|
4572
4560
|
# gr->Puts(mglPoint(-0.9,0.4),"sh=0"); gr->Ball(mglPoint(-0.9,0,1),'k');
|
4573
4561
|
# gr->Drop(mglPoint(-0.9,0),mglPoint(0,1),0.5,"r",0);
|
@@ -4578,7 +4566,7 @@ end
|
|
4578
4566
|
# gr->Puts(mglPoint(0.9,1),"sh=1"); gr->Ball(mglPoint(0.9,0,1),'k');
|
4579
4567
|
# gr->Drop(mglPoint(0.9,0),mglPoint(0,1),0.5,"r",1);
|
4580
4568
|
# gr->Line(mglPoint(-0.9,0,1),mglPoint(0.9,0,1),"b");
|
4581
|
-
#
|
4569
|
+
#
|
4582
4570
|
# gr->Puts(mglPoint(-0.9,-1.1),"asp=0.33");
|
4583
4571
|
# gr->Drop(mglPoint(-0.9,-0.7),mglPoint(0,1),0.5,"b",0,0.33);
|
4584
4572
|
# gr->Puts(mglPoint(-0.3,-1.1),"asp=0.67");
|
@@ -4707,12 +4695,12 @@ end
|
|
4707
4695
|
# mglData a,v; mgls_prepare2d(&a,0,&v);
|
4708
4696
|
# gr->Box(); gr->ContD(v,a);
|
4709
4697
|
# gr->Colorbar(v,"<"); gr->Colorbar(v,">"); gr->Colorbar(v,"_"); gr->Colorbar(v,"^");
|
4710
|
-
#
|
4698
|
+
#
|
4711
4699
|
# gr->SubPlot(2,2,3); gr->Title(" ");
|
4712
4700
|
# gr->Puts(mglPoint(-0.5,1.55),"Color positions",":C",-2);
|
4713
4701
|
# gr->Colorbar("bwr>",0.25,0); gr->Puts(mglPoint(-0.9,1.2),"Default");
|
4714
4702
|
# gr->Colorbar("b{w,0.3}r>",0.5,0); gr->Puts(mglPoint(-0.1,1.2),"Manual");
|
4715
|
-
#
|
4703
|
+
#
|
4716
4704
|
# gr->Puts(mglPoint(1,1.55),"log-scale",":C",-2);
|
4717
4705
|
# gr->SetRange('c',0.01,1e3);
|
4718
4706
|
# gr->Colorbar(">",0.75,0); gr->Puts(mglPoint(0.65,1.2),"Normal scale");
|
@@ -4813,7 +4801,7 @@ procs['legend'] = proc do
|
|
4813
4801
|
puts([0.75,0.25],"Horizontal legend","a")
|
4814
4802
|
end
|
4815
4803
|
|
4816
|
-
# void smgl_dat_diff(mglGraph *gr)
|
4804
|
+
# void smgl_dat_diff(mglGraph *gr)
|
4817
4805
|
# {
|
4818
4806
|
# gr->SetRanges(0,1,0,1,0,1);
|
4819
4807
|
# mglData a(30,40); a.Modify("x*y");
|
@@ -4855,34 +4843,34 @@ procs['dat_diff'] = proc do
|
|
4855
4843
|
box()
|
4856
4844
|
end
|
4857
4845
|
|
4858
|
-
# void smgl_dat_extra(mglGraph *gr)
|
4846
|
+
# void smgl_dat_extra(mglGraph *gr)
|
4859
4847
|
# {
|
4860
4848
|
# gr->SubPlot(2,2,0,""); gr->Title("Envelop sample");
|
4861
4849
|
# mglData d1(1000); gr->Fill(d1,"exp(-8*x^2)*sin(10*pi*x)");
|
4862
4850
|
# gr->Axis(); gr->Plot(d1, "b");
|
4863
4851
|
# d1.Envelop('x'); gr->Plot(d1, "r");
|
4864
|
-
#
|
4852
|
+
#
|
4865
4853
|
# gr->SubPlot(2,2,1,""); gr->Title("Smooth sample");
|
4866
4854
|
# mglData y0(30),y1,y2,y3;
|
4867
4855
|
# gr->SetRanges(0,1,0,1);
|
4868
4856
|
# gr->Fill(y0, "0.4*sin(pi*x) + 0.3*cos(1.5*pi*x) - 0.4*sin(2*pi*x)+0.5*rnd");
|
4869
|
-
#
|
4857
|
+
#
|
4870
4858
|
# y1=y0; y1.Smooth("x3");
|
4871
4859
|
# y2=y0; y2.Smooth("x5");
|
4872
4860
|
# y3=y0; y3.Smooth("x");
|
4873
|
-
#
|
4874
|
-
# gr->Plot(y0,"{m7}:s", "legend 'none'");
|
4861
|
+
#
|
4862
|
+
# gr->Plot(y0,"{m7}:s", "legend 'none'");
|
4875
4863
|
# gr->Plot(y1,"r", "legend ''3' style'");
|
4876
4864
|
# gr->Plot(y2,"g", "legend ''5' style'");
|
4877
4865
|
# gr->Plot(y3,"b", "legend 'default'");
|
4878
4866
|
# gr->Legend(); gr->Box();
|
4879
|
-
#
|
4867
|
+
#
|
4880
4868
|
# gr->SubPlot(2,2,2); gr->Title("Sew sample");
|
4881
4869
|
# mglData d2(100, 100); gr->Fill(d2, "mod((y^2-(1-x)^2)/2,0.1)");
|
4882
4870
|
# gr->Rotate(50, 60); gr->Light(true); gr->Alpha(true);
|
4883
4871
|
# gr->Box(); gr->Surf(d2, "b");
|
4884
4872
|
# d2.Sew("xy", 0.1); gr->Surf(d2, "r");
|
4885
|
-
#
|
4873
|
+
#
|
4886
4874
|
# gr->SubPlot(2,2,3); gr->Title("Resize sample (interpolation)");
|
4887
4875
|
# mglData x0(10), v0(10), x1, v1;
|
4888
4876
|
# gr->Fill(x0,"rnd"); gr->Fill(v0,"rnd");
|
@@ -4945,7 +4933,7 @@ procs['dat_extra'] = proc do
|
|
4945
4933
|
label(x0,v0,"%n")
|
4946
4934
|
end
|
4947
4935
|
|
4948
|
-
# void smgl_ternary(mglGraph *gr)
|
4936
|
+
# void smgl_ternary(mglGraph *gr)
|
4949
4937
|
# {
|
4950
4938
|
# gr->SetRanges(0,1,0,1,0,1);
|
4951
4939
|
# mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
|
@@ -4954,20 +4942,20 @@ end
|
|
4954
4942
|
# y.Modify("0.25*(1+sin(2*pi*x))");
|
4955
4943
|
# rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
|
4956
4944
|
# z.Modify("x");
|
4957
|
-
#
|
4945
|
+
#
|
4958
4946
|
# gr->SubPlot(2,2,0); gr->Title("Ordinary axis 3D");
|
4959
4947
|
# gr->Rotate(50,60); gr->Light(true);
|
4960
4948
|
# gr->Plot(x,y,z,"r2"); gr->Surf(a,"BbcyrR#");
|
4961
4949
|
# gr->Axis(); gr->Grid(); gr->Box();
|
4962
4950
|
# gr->Label('x',"B",1); gr->Label('y',"C",1); gr->Label('z',"Z",1);
|
4963
|
-
#
|
4951
|
+
#
|
4964
4952
|
# gr->SubPlot(2,2,1); gr->Title("Ternary axis (x+y+t=1)");
|
4965
4953
|
# gr->Ternary(1);
|
4966
4954
|
# gr->Plot(x,y,"r2"); gr->Plot(rx,ry,"q^ "); gr->Cont(a);
|
4967
4955
|
# gr->Line(mglPoint(0.5,0), mglPoint(0,0.75), "g2");
|
4968
4956
|
# gr->Axis(); gr->Grid("xyz","B;");
|
4969
4957
|
# gr->Label('x',"B"); gr->Label('y',"C"); gr->Label('t',"A");
|
4970
|
-
#
|
4958
|
+
#
|
4971
4959
|
# gr->SubPlot(2,2,2); gr->Title("Quaternary axis 3D");
|
4972
4960
|
# gr->Rotate(50,60); gr->Light(true);
|
4973
4961
|
# gr->Ternary(2);
|
@@ -4975,7 +4963,7 @@ end
|
|
4975
4963
|
# gr->Axis(); gr->Grid(); gr->Box();
|
4976
4964
|
# gr->Label('t',"A",1); gr->Label('x',"B",1);
|
4977
4965
|
# gr->Label('y',"C",1); gr->Label('z',"D",1);
|
4978
|
-
#
|
4966
|
+
#
|
4979
4967
|
# gr->SubPlot(2,2,3); gr->Title("Ternary axis 3D");
|
4980
4968
|
# gr->Rotate(50,60); gr->Light(true);
|
4981
4969
|
# gr->Ternary(1);
|
@@ -5052,7 +5040,7 @@ procs['ternary'] = proc do
|
|
5052
5040
|
label('z',"Z",1)
|
5053
5041
|
end
|
5054
5042
|
|
5055
|
-
# void smgl_projection(mglGraph *gr)
|
5043
|
+
# void smgl_projection(mglGraph *gr)
|
5056
5044
|
# {
|
5057
5045
|
# gr->SetRanges(0,1,0,1,0,1);
|
5058
5046
|
# mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
|
@@ -5061,7 +5049,7 @@ end
|
|
5061
5049
|
# y.Modify("0.25*(1+sin(2*pi*x))");
|
5062
5050
|
# rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
|
5063
5051
|
# z.Modify("x");
|
5064
|
-
#
|
5052
|
+
#
|
5065
5053
|
# if(!mini) gr->Title("Projection sample");
|
5066
5054
|
# gr->Ternary(4);
|
5067
5055
|
# gr->Rotate(50,60); gr->Light(true);
|
@@ -5099,7 +5087,7 @@ procs['projection'] = proc do
|
|
5099
5087
|
label('z',"Z",1)
|
5100
5088
|
end
|
5101
5089
|
|
5102
|
-
# void smgl_projection5(mglGraph *gr)
|
5090
|
+
# void smgl_projection5(mglGraph *gr)
|
5103
5091
|
# {
|
5104
5092
|
# gr->SetRanges(0,1,0,1,0,1);
|
5105
5093
|
# mglData x(50),y(50),z(50),rx(10),ry(10), a(20,30);
|
@@ -5108,7 +5096,7 @@ end
|
|
5108
5096
|
# y.Modify("0.25*(1+sin(2*pi*x))");
|
5109
5097
|
# rx.Modify("rnd"); ry.Modify("(1-v)*rnd",rx);
|
5110
5098
|
# z.Modify("x");
|
5111
|
-
#
|
5099
|
+
#
|
5112
5100
|
# if(!mini) gr->Title("Projection sample (ternary)");
|
5113
5101
|
# gr->Ternary(5);
|
5114
5102
|
# gr->Rotate(50,60); gr->Light(true);
|
@@ -5151,14 +5139,14 @@ end
|
|
5151
5139
|
# double q[] = {0,1,2,3, 4,5,6,7, 0,2,4,6, 1,3,5,7, 0,4,1,5, 2,6,3,7};
|
5152
5140
|
# double xc[] = {-1,1,-1,1,-1,1,-1,1}, yc[] = {-1,-1,1,1,-1,-1,1,1}, zc[] = {-1,-1,-1,-1,1,1,1,1};
|
5153
5141
|
# mglData qq(6,4,q), xx(8,xc), yy(8,yc), zz(8,zc);
|
5154
|
-
# gr->Light(true);
|
5142
|
+
# gr->Light(true);
|
5155
5143
|
# gr->SubPlot(2,2,0); gr->Title("QuadPlot sample"); gr->Rotate(50,60);
|
5156
5144
|
# gr->QuadPlot(qq,xx,yy,zz,"yr");
|
5157
5145
|
# gr->QuadPlot(qq,xx,yy,zz,"k#");
|
5158
5146
|
# gr->SubPlot(2,2,2); gr->Title("QuadPlot coloring"); gr->Rotate(50,60);
|
5159
5147
|
# gr->QuadPlot(qq,xx,yy,zz,yy,"yr");
|
5160
5148
|
# gr->QuadPlot(qq,xx,yy,zz,"k#");
|
5161
|
-
#
|
5149
|
+
#
|
5162
5150
|
# double t[] = {0,1,2, 0,1,3, 0,2,3, 1,2,3};
|
5163
5151
|
# double xt[] = {-1,1,0,0}, yt[] = {-1,-1,1,0}, zt[] = {-1,-1,-1,1};
|
5164
5152
|
# mglData tt(4,3,t), uu(4,xt), vv(4,yt), ww(4,zt);
|
@@ -5245,11 +5233,11 @@ procs['dots'] = proc do
|
|
5245
5233
|
dots(x,y,z)
|
5246
5234
|
end
|
5247
5235
|
|
5248
|
-
# void smgl_mirror(mglGraph *gr)
|
5236
|
+
# void smgl_mirror(mglGraph *gr)
|
5249
5237
|
# {
|
5250
5238
|
# mglData a(31,41);
|
5251
5239
|
# gr->Fill(a,"-pi*x*exp(-(y+1)^2-4*x^2)");
|
5252
|
-
#
|
5240
|
+
#
|
5253
5241
|
# if(!mini) { gr->SubPlot(2,2,0); gr->Title("Options for coordinates"); }
|
5254
5242
|
# gr->Alpha(true); gr->Light(true);
|
5255
5243
|
# gr->Rotate(40,60); gr->Box();
|