mathgl 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/lib/mathgl/version.rb +2 -2
- data/mathgl.gemspec +1 -1
- data/misc/Rakefile +10 -0
- data/misc/conv_texi.rb +35 -14
- data/{lib → misc/lib}/mathgl/libdoc_core_en.rb +507 -11
- data/{lib → misc/lib}/mathgl/libdoc_data_en.rb +209 -889
- data/{lib → misc/lib}/mathgl/libdoc_other_en.rb +26 -0
- data/{lib → misc/lib}/mathgl/libdoc_parse_en.rb +22 -0
- data/misc/lib/mathgl/libdoc_window_en.rb +38 -0
- metadata +8 -6
@@ -1,9 +1,13 @@
|
|
1
1
|
# This document is converted from other_en.texi.
|
2
2
|
|
3
|
+
# module MathGL
|
4
|
+
module MathGL
|
5
|
+
|
3
6
|
# MglColor class
|
4
7
|
class MglColor
|
5
8
|
|
6
9
|
# Sets color from values of Red, Green, Blue and Alpha channels. These values should be in interval (0,1).
|
10
|
+
#
|
7
11
|
# @overload set(r,g,b,a=1)
|
8
12
|
# @param [Float] r
|
9
13
|
# @param [Float] g
|
@@ -15,6 +19,7 @@ end
|
|
15
19
|
|
16
20
|
|
17
21
|
# Sets color as ``lighted'' version of color c.
|
22
|
+
#
|
18
23
|
# @overload set(c,bright=1)
|
19
24
|
# @param [MglColor] c
|
20
25
|
# @param [Float] bright default=1
|
@@ -24,6 +29,7 @@ end
|
|
24
29
|
|
25
30
|
|
26
31
|
# Sets color from symbolic id.
|
32
|
+
#
|
27
33
|
# @overload set(p,bright=1)
|
28
34
|
# @param [String] p
|
29
35
|
# @param [Float] bright default=1
|
@@ -33,6 +39,7 @@ end
|
|
33
39
|
|
34
40
|
|
35
41
|
# Checks correctness of the color.
|
42
|
+
#
|
36
43
|
# @overload valid()
|
37
44
|
# @return [bool]
|
38
45
|
def valid
|
@@ -40,6 +47,7 @@ end
|
|
40
47
|
|
41
48
|
|
42
49
|
# Gets maximal of spectral component.
|
50
|
+
#
|
43
51
|
# @overload norm()
|
44
52
|
# @return [Float]
|
45
53
|
def norm
|
@@ -47,6 +55,7 @@ end
|
|
47
55
|
|
48
56
|
|
49
57
|
# Adds colors by its RGB values.
|
58
|
+
#
|
50
59
|
# @overload +(b)
|
51
60
|
# @param [MglColor] b
|
52
61
|
# @return [MglColor]
|
@@ -55,6 +64,7 @@ end
|
|
55
64
|
|
56
65
|
|
57
66
|
# Subtracts colors by its RGB values.
|
67
|
+
#
|
58
68
|
# @overload -(b)
|
59
69
|
# @param [MglColor] b
|
60
70
|
# @return [MglColor]
|
@@ -63,6 +73,7 @@ end
|
|
63
73
|
|
64
74
|
|
65
75
|
# Multiplies color by number.
|
76
|
+
#
|
66
77
|
# @overload *(b)
|
67
78
|
# @param [Float] b
|
68
79
|
# @return [MglColor]
|
@@ -71,6 +82,7 @@ end
|
|
71
82
|
|
72
83
|
|
73
84
|
# Divide color by number.
|
85
|
+
#
|
74
86
|
# @overload /(b)
|
75
87
|
# @param [Float] b
|
76
88
|
# @return [MglColor]
|
@@ -85,6 +97,7 @@ end # MglColor
|
|
85
97
|
class MglPoint
|
86
98
|
|
87
99
|
# Returns true if point contain NAN values.
|
100
|
+
#
|
88
101
|
# @overload is_nan()
|
89
102
|
# @return [bool]
|
90
103
|
def is_nan
|
@@ -92,6 +105,7 @@ end
|
|
92
105
|
|
93
106
|
|
94
107
|
# Returns the norm \sqrt(x^2+y^2+z^2) of vector.
|
108
|
+
#
|
95
109
|
# @overload norm()
|
96
110
|
# @return [Float]
|
97
111
|
def norm
|
@@ -99,6 +113,7 @@ end
|
|
99
113
|
|
100
114
|
|
101
115
|
# Normalizes vector to be unit vector.
|
116
|
+
#
|
102
117
|
# @overload normalize()
|
103
118
|
# @return [nil]
|
104
119
|
def normalize
|
@@ -106,6 +121,7 @@ end
|
|
106
121
|
|
107
122
|
|
108
123
|
# Returns point component: x for i=0, y for i=1, z for i=2, c for i=3.
|
124
|
+
#
|
109
125
|
# @overload val(i)
|
110
126
|
# @param [Integer] i
|
111
127
|
# @return [Float]
|
@@ -114,6 +130,7 @@ end
|
|
114
130
|
|
115
131
|
|
116
132
|
# Point of summation (summation of vectors).
|
133
|
+
#
|
117
134
|
# @overload +(b)
|
118
135
|
# @param [MglPoint] b
|
119
136
|
# @return [MglPoint]
|
@@ -122,6 +139,7 @@ end
|
|
122
139
|
|
123
140
|
|
124
141
|
# Point of difference (difference of vectors).
|
142
|
+
#
|
125
143
|
# @overload -(b)
|
126
144
|
# @param [MglPoint] b
|
127
145
|
# @return [MglPoint]
|
@@ -130,6 +148,7 @@ end
|
|
130
148
|
|
131
149
|
|
132
150
|
# Multiplies (scale) points by number.
|
151
|
+
#
|
133
152
|
# @overload *(b)
|
134
153
|
# @param [Float] b
|
135
154
|
# @return [MglPoint]
|
@@ -138,6 +157,7 @@ end
|
|
138
157
|
|
139
158
|
|
140
159
|
# Multiplies (scale) points by number 1/b.
|
160
|
+
#
|
141
161
|
# @overload /(b)
|
142
162
|
# @param [Float] b
|
143
163
|
# @return [MglPoint]
|
@@ -146,6 +166,7 @@ end
|
|
146
166
|
|
147
167
|
|
148
168
|
# Scalar product of vectors.
|
169
|
+
#
|
149
170
|
# @overload *(b)
|
150
171
|
# @param [MglPoint] b
|
151
172
|
# @return [MglPoint]
|
@@ -154,6 +175,7 @@ end
|
|
154
175
|
|
155
176
|
|
156
177
|
# Return vector of element-by-element product.
|
178
|
+
#
|
157
179
|
# @overload /(b)
|
158
180
|
# @param [MglPoint] b
|
159
181
|
# @return [MglPoint]
|
@@ -162,6 +184,7 @@ end
|
|
162
184
|
|
163
185
|
|
164
186
|
# Cross-product of vectors.
|
187
|
+
#
|
165
188
|
# @overload ^(b)
|
166
189
|
# @param [MglPoint] b
|
167
190
|
# @return [MglPoint]
|
@@ -170,6 +193,7 @@ end
|
|
170
193
|
|
171
194
|
|
172
195
|
# The part of a which is perpendicular to vector b.
|
196
|
+
#
|
173
197
|
# @overload &(b)
|
174
198
|
# @param [MglPoint] b
|
175
199
|
# @return [MglPoint]
|
@@ -178,6 +202,7 @@ end
|
|
178
202
|
|
179
203
|
|
180
204
|
# The part of a which is parallel to vector b.
|
205
|
+
#
|
181
206
|
# @overload |(b)
|
182
207
|
# @param [MglPoint] b
|
183
208
|
# @return [MglPoint]
|
@@ -187,3 +212,4 @@ end
|
|
187
212
|
|
188
213
|
end # MglPoint
|
189
214
|
|
215
|
+
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
# This document is converted from parse_en.texi.
|
2
2
|
|
3
|
+
# module MathGL
|
4
|
+
module MathGL
|
5
|
+
|
3
6
|
# MglParse class
|
4
7
|
class MglParse
|
5
8
|
|
6
9
|
# Main function in the class. Function parse and execute line-by-line MGL script in array text. Lines are separated by newline symbol '\n' as usual.
|
10
|
+
#
|
7
11
|
# @overload execute(gr,text)
|
8
12
|
# @param [MglGraph] gr
|
9
13
|
# @param [String] text
|
@@ -13,6 +17,7 @@ end
|
|
13
17
|
|
14
18
|
|
15
19
|
# The same as previous but read script from the file fp. If print=true then all warnings and information will be printed in stdout.
|
20
|
+
#
|
16
21
|
# @overload execute(gr,fp,print=false)
|
17
22
|
# @param [MglGraph] gr
|
18
23
|
# @param [FILE] fp
|
@@ -23,6 +28,7 @@ end
|
|
23
28
|
|
24
29
|
|
25
30
|
# Function parses the string str and executes it by using gr as a graphics plotter. Returns the value depending on an error presence in the string str: 0 -- no error, 1 -- wrong command argument(s), 2 -- unknown command, 3 -- string is too long. Optional argument pos allows to save the string position in the document (or file) for using for|next command.
|
31
|
+
#
|
26
32
|
# @overload parse(gr,str,pos=0)
|
27
33
|
# @param [MglGraph] gr
|
28
34
|
# @param [String] str
|
@@ -33,6 +39,7 @@ end
|
|
33
39
|
|
34
40
|
|
35
41
|
# Function parses the string formula and return resulting data array. In difference to AddVar() or FindVar(), it is usual data array which should be deleted after usage.
|
42
|
+
#
|
36
43
|
# @overload calc(formula)
|
37
44
|
# @param [String] formula
|
38
45
|
# @return [MglData]
|
@@ -41,6 +48,7 @@ end
|
|
41
48
|
|
42
49
|
|
43
50
|
# Function set the value of n-th parameter as string str (n=0, 1 ... 'z'-'a'+10). String str shouldn't contain '$' symbol.
|
51
|
+
#
|
44
52
|
# @overload add_param(n,str)
|
45
53
|
# @param [Integer] n
|
46
54
|
# @param [String] str
|
@@ -50,6 +58,7 @@ end
|
|
50
58
|
|
51
59
|
|
52
60
|
# Function returns the pointer to variable with name name or zero if variable is absent. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays!
|
61
|
+
#
|
53
62
|
# @overload find_var(name)
|
54
63
|
# @param [String] name
|
55
64
|
# @return [MglVar]
|
@@ -58,6 +67,7 @@ end
|
|
58
67
|
|
59
68
|
|
60
69
|
# Function returns the pointer to variable with name name. If variable is absent then new variable is created with name name. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays!
|
70
|
+
#
|
61
71
|
# @overload add_var(name)
|
62
72
|
# @param [String] name
|
63
73
|
# @return [MglVar]
|
@@ -66,6 +76,7 @@ end
|
|
66
76
|
|
67
77
|
|
68
78
|
# Function delete the variable specified by its name or by its pointer.
|
79
|
+
#
|
69
80
|
# @overload delete_var(name)
|
70
81
|
# @param [String] name
|
71
82
|
# @return [nil]
|
@@ -74,6 +85,7 @@ end
|
|
74
85
|
|
75
86
|
|
76
87
|
# Function delete all variables in this parser.
|
88
|
+
#
|
77
89
|
# @overload delete_all()
|
78
90
|
# @return [nil]
|
79
91
|
def delete_all
|
@@ -81,6 +93,7 @@ end
|
|
81
93
|
|
82
94
|
|
83
95
|
# Restore Once flag.
|
96
|
+
#
|
84
97
|
# @overload restore_once()
|
85
98
|
# @return [nil]
|
86
99
|
def restore_once
|
@@ -88,6 +101,7 @@ end
|
|
88
101
|
|
89
102
|
|
90
103
|
# Allow to parse 'setsize' command or not.
|
104
|
+
#
|
91
105
|
# @overload allow_set_size(a)
|
92
106
|
# @param [bool] a
|
93
107
|
# @return [nil]
|
@@ -96,6 +110,7 @@ end
|
|
96
110
|
|
97
111
|
|
98
112
|
# Allow reading/saving files or not.
|
113
|
+
#
|
99
114
|
# @overload allow_file_io(a)
|
100
115
|
# @param [bool] a
|
101
116
|
# @return [nil]
|
@@ -104,6 +119,7 @@ end
|
|
104
119
|
|
105
120
|
|
106
121
|
# Sends stop signal which terminate execution at next command.
|
122
|
+
#
|
107
123
|
# @overload stop()
|
108
124
|
# @return [nil]
|
109
125
|
def stop
|
@@ -111,6 +127,7 @@ end
|
|
111
127
|
|
112
128
|
|
113
129
|
# Return the number of registered MGL commands.
|
130
|
+
#
|
114
131
|
# @overload get_cmd_num()
|
115
132
|
# @return [long]
|
116
133
|
def get_cmd_num
|
@@ -118,6 +135,7 @@ end
|
|
118
135
|
|
119
136
|
|
120
137
|
# Return the name of command with given id.
|
138
|
+
#
|
121
139
|
# @overload get_cmd_name(id)
|
122
140
|
# @param [long] id
|
123
141
|
# @return [String]
|
@@ -126,6 +144,7 @@ end
|
|
126
144
|
|
127
145
|
|
128
146
|
# Return the type of MGL command name. Type of commands are: 0 -- not the command, 1 - data plot, 2 - other plot, 3 - setup, 4 - data handle, 5 - data create, 6 - subplot, 7 - program, 8 - 1d plot, 9 - 2d plot, 10 - 3d plot, 11 - dd plot, 12 - vector plot, 13 - axis, 14 - primitives, 15 - axis setup, 16 - text/legend, 17 - data transform.
|
147
|
+
#
|
129
148
|
# @overload cmd_type(name)
|
130
149
|
# @param [String] name
|
131
150
|
# @return [Integer]
|
@@ -134,6 +153,7 @@ end
|
|
134
153
|
|
135
154
|
|
136
155
|
# Return the format of arguments for MGL command name.
|
156
|
+
#
|
137
157
|
# @overload cmd_format(name)
|
138
158
|
# @param [String] name
|
139
159
|
# @return [String]
|
@@ -142,6 +162,7 @@ end
|
|
142
162
|
|
143
163
|
|
144
164
|
# Return the description of MGL command name.
|
165
|
+
#
|
145
166
|
# @overload cmd_desc(name)
|
146
167
|
# @param [String] name
|
147
168
|
# @return [String]
|
@@ -151,3 +172,4 @@ end
|
|
151
172
|
|
152
173
|
end # MglParse
|
153
174
|
|
175
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module MathGL
|
2
|
+
|
3
|
+
# QT Window class
|
4
|
+
class MglQT
|
5
|
+
# Constructor for MglQT. Drawing block must be provided.
|
6
|
+
# If the number of block argument is one, the argument is an MglGraph object.
|
7
|
+
# If the number of block argument is zero, the block is executed in the context of an MglGraph object.
|
8
|
+
def initialize(&block)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Start MglQT window.
|
12
|
+
def run
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# FLTK Window class
|
17
|
+
class MglFLTK
|
18
|
+
# Constructor for MglFLTK. Drawing block must be provided.
|
19
|
+
# If the number of block argument is one, the argument is an MglGraph object.
|
20
|
+
# If the number of block argument is zero, the block is executed in the context of an MglGraph object.
|
21
|
+
def initialize(&block)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Start MglFLTK window.
|
25
|
+
def run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# GLUT Window class
|
30
|
+
class MglGLUT
|
31
|
+
# Constructor for MglGLUT. Drawing block must be provided.
|
32
|
+
# If the number of block argument is one, the argument is an MglGraph object.
|
33
|
+
# If the number of block argument is zero, the block is executed in the context of an MglGraph object.
|
34
|
+
def initialize(&block)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mathgl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro TANAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,13 +59,15 @@ files:
|
|
59
59
|
- ext/mathgl/rubymgl.i
|
60
60
|
- ext/mathgl/tmpl/mkwin.rb
|
61
61
|
- ext/mathgl/tmpl/win.erb.cxx
|
62
|
-
- lib/mathgl/libdoc_core_en.rb
|
63
|
-
- lib/mathgl/libdoc_data_en.rb
|
64
|
-
- lib/mathgl/libdoc_other_en.rb
|
65
|
-
- lib/mathgl/libdoc_parse_en.rb
|
66
62
|
- lib/mathgl/version.rb
|
67
63
|
- mathgl.gemspec
|
64
|
+
- misc/Rakefile
|
68
65
|
- misc/conv_texi.rb
|
66
|
+
- misc/lib/mathgl/libdoc_core_en.rb
|
67
|
+
- misc/lib/mathgl/libdoc_data_en.rb
|
68
|
+
- misc/lib/mathgl/libdoc_other_en.rb
|
69
|
+
- misc/lib/mathgl/libdoc_parse_en.rb
|
70
|
+
- misc/lib/mathgl/libdoc_window_en.rb
|
69
71
|
- sample/conv_sample.rb
|
70
72
|
- sample/prepare.rb
|
71
73
|
- sample/sample.rb
|