ruby-gr 0.61.0.0 → 0.64.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -68
- data/lib/gr/ffi.rb +25 -21
- data/lib/gr.rb +43 -5
- data/lib/gr3/ffi.rb +91 -84
- data/lib/gr_commons/version.rb +1 -1
- data/lib/grm/ffi.rb +0 -3
- metadata +18 -5
- data/lib/gr/plot.rb +0 -1553
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1174559ffb58dc220fd3e47db3bd8e684f5a60270c4fc0f376570e27ccc7407
|
4
|
+
data.tar.gz: 4dc48873c8ff41574333f1dcd5fff826fabaaf0d5bf263520eabdb4292446c9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 401bb86f4ad5f479ed2fddcbc1a7a81ebd9491df12c6d732c3e73f5308cdf9719757698580d5a70570dda52c8f77e1fdf6f5228056268cd497e8f280673660f2
|
7
|
+
data.tar.gz: b3b11048b30d20ae60bcf310bc4ff0fbab447df9e4bd22f8a9629e5e4aeae190228042bdfff37ab3ea714f7bf3273d6ee70b27a699387cce08b3128541251d01
|
data/README.md
CHANGED
@@ -27,23 +27,22 @@
|
|
27
27
|
|
28
28
|
GR.rb supports Ruby 2.5+.
|
29
29
|
|
30
|
-
First, [install GR](#gr-installation). Then install `
|
30
|
+
First, [install GR](#gr-installation). Then install [`gr-plot`](https://github.com/red-data-tools/gr-plot) gem.
|
31
31
|
|
32
32
|
```sh
|
33
|
-
gem install
|
33
|
+
gem install gr-plot
|
34
34
|
```
|
35
|
-
Note: If you are using [RubyInstaller](https://rubyinstaller.org/) (Windows), pacman will automatically install [mingw-w64-gr](https://packages.msys2.org/base/mingw-w64-gr).
|
36
35
|
|
37
|
-
|
36
|
+
[pkg-config](https://github.com/ruby-gnome/pkg-config) will detect the location of the shared library. Otherwise, you need to specify the environment variable.
|
38
37
|
|
39
38
|
```sh
|
40
39
|
export GRDIR="/your/path/to/gr"
|
41
40
|
```
|
42
41
|
|
43
|
-
If you use package managers to install GR, [pkg-config](https://github.com/ruby-gnome/pkg-config) may automatically detect the shared library location without specifying the `GRDIR` environment variable.
|
44
|
-
|
45
42
|
## Quick Start
|
46
43
|
|
44
|
+
:point_right: [Wiki -plotting functions](https://github.com/red-data-tools/GR.rb/wiki/Plotting-functions)
|
45
|
+
|
47
46
|
<p align="center">
|
48
47
|
<img src="https://user-images.githubusercontent.com/5798442/69689128-74cb1480-110b-11ea-9097-29e878a19e8f.png">
|
49
48
|
</p>
|
@@ -54,50 +53,25 @@ require 'gr/plot'
|
|
54
53
|
x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]
|
55
54
|
y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7]
|
56
55
|
|
56
|
+
# show the figure
|
57
57
|
GR.plot(x, y)
|
58
|
-
```
|
59
|
-
|
60
|
-
<p align="center">
|
61
|
-
<img src="https://user-images.githubusercontent.com/5798442/84570709-242ab880-adca-11ea-9099-3a6b3418bf19.png">
|
62
|
-
</p>
|
63
58
|
|
64
|
-
|
65
|
-
require 'gr/plot'
|
66
|
-
|
67
|
-
x = Numo::DFloat.linspace(0, 10, 101)
|
68
|
-
y1 = Numo::NMath.sin(x)
|
69
|
-
y2 = Numo::NMath.cos(x)
|
70
|
-
|
71
|
-
GR.plot(
|
72
|
-
[x, y1, 'bo'], [x, y2, 'g*'],
|
73
|
-
title: "Multiple plot example",
|
74
|
-
xlabel: "x",
|
75
|
-
ylabel: "y",
|
76
|
-
ylim: [-1.2, 1.2],
|
77
|
-
labels: ["sin(x)", "cos(x)"],
|
78
|
-
location: 11
|
79
|
-
)
|
80
|
-
```
|
81
|
-
|
82
|
-
Save the figure in PNG format.
|
83
|
-
|
84
|
-
```ruby
|
59
|
+
# Save the figure in PNG format.
|
85
60
|
GR.savefig("figure.png")
|
86
61
|
```
|
87
62
|
|
88
|
-
|
63
|
+
GR.rb supports [Jupyter Notebook / Lab](../../wiki/Jupyter-Notebook).
|
89
64
|
|
90
|
-
|
65
|
+
## API Overview
|
91
66
|
|
92
|
-
#### GR::Plot - A simple, matlab-style API.
|
67
|
+
#### [GR::Plot - A simple, matlab-style API](https://github.com/red-data-tools/gr-plot)
|
93
68
|
|
94
69
|
```ruby
|
95
70
|
require 'gr/plot'
|
96
71
|
GR.plot(x, y)
|
97
72
|
```
|
98
73
|
|
99
|
-
|
100
|
-
Some GR module methods are overwritten.
|
74
|
+
List of available functions.
|
101
75
|
|
102
76
|
[`plot`](../../wiki/Plotting-functions#plot)
|
103
77
|
[`step`](../../wiki/Plotting-functions#step)
|
@@ -123,7 +97,10 @@ Some GR module methods are overwritten.
|
|
123
97
|
[`imshow`](../../wiki/Plotting-functions#imshow)
|
124
98
|
[`isosurface`](../../wiki/Plotting-functions#isosurface)
|
125
99
|
|
126
|
-
|
100
|
+
See [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki) for details.
|
101
|
+
Some GR module methods are overwritten. Code has been moved to [gr-plot](https://github.com/red-data-tools/gr-plot).
|
102
|
+
|
103
|
+
#### GR - A module for calling native GR functions
|
127
104
|
|
128
105
|
2-D Plots and common 3-D Plots.
|
129
106
|
|
@@ -135,7 +112,7 @@ GR.setviewport(0.1, 0.9, 0.1, 0.9)
|
|
135
112
|
GR.setwindow(0.0, 20.0, 0.0, 20.0)
|
136
113
|
```
|
137
114
|
|
138
|
-
#### GR3 - A module for calling native GR3 functions
|
115
|
+
#### GR3 - A module for calling native GR3 functions
|
139
116
|
|
140
117
|
Complex 3D scenes.
|
141
118
|
|
@@ -159,51 +136,46 @@ export GKS_WSTYPE=100
|
|
159
136
|
## Documentation
|
160
137
|
|
161
138
|
- [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki)
|
162
|
-
- [GR
|
163
|
-
- [GR
|
164
|
-
|
165
|
-
Although GR.rb adds methods dynamically, we try our best to provide a complete yard document. If you want to see more up-to-date information, we recommend using the official GR reference.
|
139
|
+
- [GR.rb API Documentation](https://rubydoc.info/gems/ruby-gr) - Yard documents.
|
140
|
+
- [GR Framework](https://gr-framework.org/) - The official GR reference.
|
166
141
|
|
167
142
|
## GR Installation
|
168
143
|
|
169
144
|
### Installing an official release (recommended)
|
170
145
|
|
171
|
-
Download the [latest release](https://github.com/sciapp/gr/releases).
|
172
|
-
|
173
|
-
Set environment variable GRDIR.
|
146
|
+
Download the [latest release](https://github.com/sciapp/gr/releases) and place it where you want. Then set environment variable `GRDIR`.
|
174
147
|
|
175
148
|
```sh
|
176
149
|
export GRDIR="your/path/to/gr"
|
177
150
|
```
|
178
151
|
|
179
|
-
macOS :
|
152
|
+
macOS : See ["How to open apps from un-notarized or unidentified developers"](https://support.apple.com/en-us/HT202491) in the Apple documentation.
|
180
153
|
|
181
154
|
### Using package managers
|
182
155
|
|
183
|
-
|
184
|
-
* If you find any problem, please report the issue [here](https://github.com/red-data-tools/GR.rb/issues).
|
185
|
-
* Note: These packages may not have some features such as video output.
|
156
|
+
The third party GR packages for Mac, Linux and Windows are available for advanced users. However, these packages are provided by OSS volunteers and may not be the latest version or support some features (such as video output). If you find any problem, please report the issue [here](https://github.com/red-data-tools/GR.rb/issues).
|
186
157
|
|
187
158
|
#### Mac - Homebrew
|
188
159
|
|
189
160
|
```sh
|
190
161
|
brew install libgr
|
191
|
-
|
192
|
-
|
193
|
-
Set the workstation type to gksqt.
|
194
|
-
|
195
|
-
```sh
|
196
|
-
export GKS_WSTYPE=411 # gksqt (recommended)
|
162
|
+
export GKS_WSTYPE=411 # Set the workstation type to gksqt (recommended)
|
197
163
|
```
|
198
164
|
|
199
165
|
#### Linux - openSUSE Build service
|
200
166
|
|
201
167
|
GR releases are also available from the [openSUSE Build service](https://software.opensuse.org//download.html?project=science%3Agr-framework&package=gr) for CentOS, Debian, Fedora openSUSE and Ubuntu. Obtain a packaged release [here](https://software.opensuse.org//download.html?project=science%3Agr-framework&package=gr).
|
202
168
|
|
169
|
+
GR will be installed in `/usr/gr`. Set one of the following environment variables so that GR.rb can find the library.
|
170
|
+
|
203
171
|
```sh
|
204
172
|
export GRDIR="/usr/gr" # Check the location with `dpkg -L gr`
|
205
173
|
```
|
206
174
|
|
175
|
+
```sh
|
176
|
+
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/gr/lib/pkgconfig"
|
177
|
+
```
|
178
|
+
|
207
179
|
#### Windows - MSYS2
|
208
180
|
|
209
181
|
If you are using Rubyinstaller, pacman will automatically install [mingw-w64-gr](https://packages.msys2.org/base/mingw-w64-gr) when the gem is installed.
|
@@ -220,21 +192,16 @@ Please feel free to send us your PR.
|
|
220
192
|
* Update GR packages ( Homebrew, MinGW, red-data-tools )
|
221
193
|
* Create visualization tools based on GR.rb
|
222
194
|
|
223
|
-
|
195
|
+
If you are not familiar with Ruby gem development, please see
|
196
|
+
[I'm new to Ruby](https://github.com/red-data-tools/GR.rb/wiki/I%27m-new-to-Ruby)
|
224
197
|
|
225
|
-
```
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
bundle exec rake test
|
198
|
+
```
|
199
|
+
Do you need commit rights to my repository?
|
200
|
+
Do you want to get admin rights and take over the project?
|
201
|
+
If so, please feel free to contact us.
|
230
202
|
```
|
231
203
|
|
232
|
-
|
233
|
-
|
234
|
-
## Future plans
|
235
|
-
|
236
|
-
* Creating a backend for [Charty](https://github.com/red-data-tools/charty).
|
237
|
-
* [Object-oriented interface](https://github.com/kojix2/GRUtils.rb) based on [GRUtils.jl](https://github.com/heliosdrm/GRUtils.jl).
|
204
|
+
I've seen a lot of OSS abandoned because no one has commit rights to the original repository anymore; the right to request commit rights for GR.rb is always open.
|
238
205
|
|
239
206
|
## Acknowledgements
|
240
207
|
|
data/lib/gr/ffi.rb
CHANGED
@@ -33,20 +33,22 @@ module GR
|
|
33
33
|
try_extern 'void gr_polyline(int, double *, double *)'
|
34
34
|
try_extern 'void gr_polymarker(int, double *, double *)'
|
35
35
|
try_extern 'void gr_text(double, double, char *)'
|
36
|
+
try_extern 'void gr_textx(double, double, char *, int)'
|
36
37
|
try_extern 'void gr_inqtext(double, double, char *, double *, double *)'
|
38
|
+
try_extern 'void gr_inqtextx(double, double, char *, int, double *, double *)'
|
37
39
|
try_extern 'void gr_fillarea(int, double *, double *)'
|
38
|
-
try_extern 'void gr_cellarray(double, double, double, double,
|
39
|
-
'int, int, int, int, int, int, int *)'
|
40
|
-
try_extern 'void gr_nonuniformcellarray(double *, double *,
|
41
|
-
'int, int, int, int, int, int, int *)'
|
42
|
-
try_extern 'void gr_polarcellarray(double, double, double, double, double, double,
|
43
|
-
'int, int, int, int, int, int, int *)'
|
44
|
-
try_extern 'void gr_nonuniformpolarcellarray(double, double, double *, double *,
|
45
|
-
'int, int, int, int, int, int, int *)
|
40
|
+
try_extern 'void gr_cellarray(double, double, double, double,' \
|
41
|
+
' int, int, int, int, int, int, int *)'
|
42
|
+
try_extern 'void gr_nonuniformcellarray(double *, double *,' \
|
43
|
+
' int, int, int, int, int, int, int *)'
|
44
|
+
try_extern 'void gr_polarcellarray(double, double, double, double, double, double,' \
|
45
|
+
' int, int, int, int, int, int, int *)'
|
46
|
+
try_extern 'void gr_nonuniformpolarcellarray(double, double, double *, double *,' \
|
47
|
+
' int, int, int, int, int, int, int *)'
|
46
48
|
try_extern 'void gr_gdp(int, double *, double *, int, int, int *)'
|
47
49
|
try_extern 'void gr_spline(int, double *, double *, int, int)'
|
48
|
-
try_extern 'void gr_gridit(int, double *, double *, double *, int, int,
|
49
|
-
'double *, double *, double *)'
|
50
|
+
try_extern 'void gr_gridit(int, double *, double *, double *, int, int,' \
|
51
|
+
' double *, double *, double *)'
|
50
52
|
try_extern 'void gr_setlinetype(int)'
|
51
53
|
try_extern 'void gr_inqlinetype(int *)'
|
52
54
|
try_extern 'void gr_setlinewidth(double)'
|
@@ -97,10 +99,11 @@ module GR
|
|
97
99
|
try_extern 'void gr_inqscale(int *)'
|
98
100
|
try_extern 'int gr_textext(double, double, char *)'
|
99
101
|
try_extern 'void gr_inqtextext(double, double, char *, double *, double *)'
|
102
|
+
try_extern 'void gr_setscientificformat(int)'
|
100
103
|
try_extern 'void gr_axes(double, double, double, double, int, int, double)'
|
101
104
|
try_extern 'void gr_axeslbl(double, double, double, double, int, int, double,' \
|
102
|
-
'void (*)(double, double, const char *, double),' \
|
103
|
-
'void (*)(double, double, const char *, double))'
|
105
|
+
' void (*)(double, double, const char *, double),' \
|
106
|
+
' void (*)(double, double, const char *, double))'
|
104
107
|
try_extern 'void gr_grid(double, double, double, double, int, int)'
|
105
108
|
try_extern 'void gr_grid3d(double, double, double, double, double, double, int, int, int)'
|
106
109
|
try_extern 'void gr_verrorbars(int, double *, double *, double *, double *)'
|
@@ -158,6 +161,7 @@ module GR
|
|
158
161
|
try_extern 'void gr_resizeselection(int, double, double)'
|
159
162
|
try_extern 'void gr_inqbbox(double *, double *, double *, double *)'
|
160
163
|
try_extern 'double gr_precision(void)'
|
164
|
+
try_extern 'int gr_text_maxsize(void)'
|
161
165
|
try_extern 'void gr_setregenflags(int)'
|
162
166
|
try_extern 'int gr_inqregenflags(void)'
|
163
167
|
try_extern 'void gr_savestate(void)'
|
@@ -171,30 +175,30 @@ module GR
|
|
171
175
|
try_extern 'void gr_gradient(int, int, double *, double *, double *, double *, double *)'
|
172
176
|
try_extern 'void gr_quiver(int, int, double *, double *, double *, double *, int)'
|
173
177
|
try_extern 'void gr_interp2(int nx, int ny, const double *x, const double *y, const double *z,' \
|
174
|
-
'int nxq, int nyq, const double *xq, const double *yq, double *zq, int method, double extrapval)'
|
178
|
+
' int nxq, int nyq, const double *xq, const double *yq, double *zq, int method, double extrapval)'
|
175
179
|
try_extern 'const char *gr_version(void)'
|
176
180
|
try_extern 'void gr_shade(int, double *, double *, int, int, double *, int, int, int *)'
|
177
181
|
try_extern 'void gr_shadepoints(int, double *, double *, int, int, int)'
|
178
182
|
try_extern 'void gr_shadelines(int, double *, double *, int, int, int)'
|
179
183
|
try_extern 'void gr_panzoom(double, double, double, double, double *, double *, double *, double *)'
|
180
184
|
try_extern 'int gr_findboundary(int, double *, double *, double, double (*)(double, double), int, int *)'
|
181
|
-
try_extern 'void gr_setresamplemethod(unsigned int
|
182
|
-
try_extern 'void gr_inqresamplemethod(unsigned int *
|
185
|
+
try_extern 'void gr_setresamplemethod(unsigned int)'
|
186
|
+
try_extern 'void gr_inqresamplemethod(unsigned int *)'
|
183
187
|
try_extern 'void gr_path(int, double *, double *, const char *)'
|
184
188
|
try_extern 'void gr_setborderwidth(double)'
|
185
189
|
try_extern 'void gr_inqborderwidth(double *)'
|
186
190
|
try_extern 'void gr_setbordercolorind(int)'
|
187
191
|
try_extern 'void gr_inqbordercolorind(int *)'
|
188
192
|
try_extern 'void gr_selectclipxform(int)'
|
189
|
-
try_extern 'void gr_inqclipxform(int *)
|
193
|
+
try_extern 'void gr_inqclipxform(int *)'
|
190
194
|
try_extern 'void gr_setprojectiontype(int)'
|
191
195
|
try_extern 'void gr_inqprojectiontype(int *)'
|
192
196
|
try_extern 'void gr_setperspectiveprojection(double, double, double)'
|
193
197
|
try_extern 'void gr_inqperspectiveprojection(double *, double *, double *)'
|
194
|
-
try_extern 'void gr_settransformationparameters(double, double, double,
|
195
|
-
'double, double, double, double, double, double)'
|
196
|
-
try_extern 'void gr_inqtransformationparameters(double *, double *, double *,
|
197
|
-
'double *, double *, double *, double *, double *, double *)
|
198
|
+
try_extern 'void gr_settransformationparameters(double, double, double,' \
|
199
|
+
' double, double, double, double, double, double)'
|
200
|
+
try_extern 'void gr_inqtransformationparameters(double *, double *, double *,' \
|
201
|
+
' double *, double *, double *, double *, double *, double *)'
|
198
202
|
try_extern 'void gr_setorthographicprojection(double, double, double, double, double, double)'
|
199
203
|
try_extern 'void gr_inqorthographicprojection(double *, double *, double *, double *, double *, double *)'
|
200
204
|
try_extern 'void gr_camerainteraction(double, double, double, double)'
|
@@ -208,7 +212,7 @@ module GR
|
|
208
212
|
try_extern 'void gr_settextencoding(int)'
|
209
213
|
try_extern 'void gr_inqtextencoding(int *)'
|
210
214
|
try_extern 'void gr_loadfont(char *, int *)'
|
211
|
-
|
215
|
+
try_extern 'void gr_setcallback(char *(*)(const char *))'
|
212
216
|
try_extern 'void gr_setthreadnumber(int)'
|
213
217
|
try_extern 'void gr_setpicturesizeforvolume(int, int)'
|
214
218
|
try_extern 'void gr_setvolumebordercalculation(int)'
|
data/lib/gr.rb
CHANGED
@@ -268,12 +268,38 @@ module GR
|
|
268
268
|
#
|
269
269
|
# @!method text
|
270
270
|
|
271
|
+
# Draw a text at position `x`, `y` using the given options and current text
|
272
|
+
# attributes.
|
273
|
+
#
|
274
|
+
# @param x [Numeric] The X coordinate of the starting position of the text string
|
275
|
+
# @param y [Numeric] The Y coordinate of the starting position of the text string
|
276
|
+
# @param string [String] The text to be drawn
|
277
|
+
# @param opts [Integer] Bit mask including text options (GR_TEXT_USE_WC,
|
278
|
+
# GR_TEXT_ENABLE_INLINE_MATH)
|
279
|
+
#
|
280
|
+
# The values for `x` and `y` specify the text position. If the GR_TEXT_USE_WC
|
281
|
+
# option is set, they are interpreted as world cordinates, otherwise as
|
282
|
+
# normalized device coordinates. The string may contain new line characters
|
283
|
+
# and inline math expressions ($...$). The latter are only taken into account,
|
284
|
+
# if the GR_TEXT_ENABLE_INLINE_MATH option is set.
|
285
|
+
# The attributes that control the appearance of text are text font and
|
286
|
+
# precision, character expansion factor, character spacing, text color index,
|
287
|
+
# character height, character up vector, text path and text alignment.
|
288
|
+
#
|
289
|
+
# @!method textx
|
290
|
+
|
271
291
|
def inqtext(x, y, string)
|
272
292
|
inquiry [{ double: 4 }, { double: 4 }] do |tbx, tby|
|
273
293
|
super(x, y, string, tbx, tby)
|
274
294
|
end
|
275
295
|
end
|
276
296
|
|
297
|
+
def inqtextx(x, y, string, opts)
|
298
|
+
inquiry [{ double: 4 }, { double: 4 }] do |tbx, tby|
|
299
|
+
super(x, y, string, opts, tbx, tby)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
277
303
|
# Allows you to specify a polygonal shape of an area to be filled.
|
278
304
|
#
|
279
305
|
# @param x [Array, NArray] A list containing the X coordinates
|
@@ -1820,7 +1846,9 @@ module GR
|
|
1820
1846
|
end
|
1821
1847
|
|
1822
1848
|
# @return [Numeric]
|
1823
|
-
# @!method
|
1849
|
+
# @!method
|
1850
|
+
|
1851
|
+
# @!method text_maxsize
|
1824
1852
|
|
1825
1853
|
# @!method setregenflags
|
1826
1854
|
|
@@ -2593,8 +2621,8 @@ module GR
|
|
2593
2621
|
PATH_CURVE4 = 0x04
|
2594
2622
|
PATH_CLOSEPOLY = 0x4f
|
2595
2623
|
|
2596
|
-
GDP_DRAW_PATH
|
2597
|
-
GDP_DRAW_LINES
|
2624
|
+
GDP_DRAW_PATH = 1
|
2625
|
+
GDP_DRAW_LINES = 2
|
2598
2626
|
GDP_DRAW_MARKERS = 3
|
2599
2627
|
|
2600
2628
|
MPL_SUPPRESS_CLEAR = 1
|
@@ -2640,7 +2668,17 @@ module GR
|
|
2640
2668
|
(UPSAMPLE_VERTICAL_LANCZOS | UPSAMPLE_HORIZONTAL_LANCZOS |
|
2641
2669
|
DOWNSAMPLE_VERTICAL_LANCZOS | DOWNSAMPLE_HORIZONTAL_LANCZOS)
|
2642
2670
|
|
2643
|
-
PROJECTION_DEFAULT
|
2671
|
+
PROJECTION_DEFAULT = 0
|
2644
2672
|
PROJECTION_ORTHOGRAPHIC = 1
|
2645
|
-
PROJECTION_PERSPECTIVE
|
2673
|
+
PROJECTION_PERSPECTIVE = 2
|
2674
|
+
|
2675
|
+
VOLUME_WITHOUT_BORDER = 0
|
2676
|
+
VOLUME_WITH_BORDER = 1
|
2677
|
+
|
2678
|
+
VOLUME_EMISSION = 0
|
2679
|
+
VOLUME_ABSORPTION = 1
|
2680
|
+
VOLUME_MIP = 2
|
2681
|
+
|
2682
|
+
TEXT_USE_WC = (1 << 0)
|
2683
|
+
TEXT_ENABLE_INLINE_MATH = (1 << 1)
|
2646
2684
|
end
|
data/lib/gr3/ffi.rb
CHANGED
@@ -32,41 +32,41 @@ module GR3
|
|
32
32
|
try_extern 'int gr3_setquality(int quality)'
|
33
33
|
try_extern 'int gr3_getimage(int width, int height, int use_alpha, char *pixels)'
|
34
34
|
try_extern 'int gr3_export(const char *filename, int width, int height)'
|
35
|
-
try_extern 'int gr3_drawimage(float xmin, float xmax, float ymin, float ymax,
|
36
|
-
|
37
|
-
try_extern 'int gr3_createmesh_nocopy(int *mesh, int n,
|
38
|
-
|
39
|
-
try_extern 'int gr3_createmesh(int *mesh, int n,
|
40
|
-
|
41
|
-
try_extern 'int gr3_createindexedmesh_nocopy(int *mesh, int number_of_vertices,
|
42
|
-
|
43
|
-
try_extern 'int gr3_createindexedmesh(int *mesh, int number_of_vertices,
|
44
|
-
|
45
|
-
|
46
|
-
try_extern 'void gr3_drawmesh(int mesh, int n,
|
47
|
-
|
48
|
-
|
35
|
+
try_extern 'int gr3_drawimage(float xmin, float xmax, float ymin, float ymax,' \
|
36
|
+
' int width, int height, int drawable_type)'
|
37
|
+
try_extern 'int gr3_createmesh_nocopy(int *mesh, int n,' \
|
38
|
+
' float *vertices, float *normals, float *colors)'
|
39
|
+
try_extern 'int gr3_createmesh(int *mesh, int n,' \
|
40
|
+
' const float *vertices, const float *normals, const float *colors)'
|
41
|
+
try_extern 'int gr3_createindexedmesh_nocopy(int *mesh, int number_of_vertices,' \
|
42
|
+
' float *vertices, float *normals, float *colors, int number_of_indices, int *indices)'
|
43
|
+
try_extern 'int gr3_createindexedmesh(int *mesh, int number_of_vertices,' \
|
44
|
+
' const float *vertices, const float *normals, const float *colors,' \
|
45
|
+
' int number_of_indices, const int *indices)'
|
46
|
+
try_extern 'void gr3_drawmesh(int mesh, int n,' \
|
47
|
+
' const float *positions, const float *directions, const float *ups,' \
|
48
|
+
' const float *colors, const float *scales)'
|
49
49
|
try_extern 'void gr3_deletemesh(int mesh)'
|
50
|
-
try_extern 'void gr3_cameralookat(float camera_x, float camera_y, float camera_z,
|
51
|
-
|
52
|
-
|
53
|
-
try_extern 'int gr3_setcameraprojectionparameters(float vertical_field_of_view,
|
54
|
-
|
50
|
+
try_extern 'void gr3_cameralookat(float camera_x, float camera_y, float camera_z,' \
|
51
|
+
' float center_x, float center_y, float center_z,' \
|
52
|
+
' float up_x, float up_y, float up_z)'
|
53
|
+
try_extern 'int gr3_setcameraprojectionparameters(float vertical_field_of_view,' \
|
54
|
+
' float zNear, float zFar)'
|
55
55
|
try_extern 'int gr3_getcameraprojectionparameters(float *vfov, float *znear, float *zfar)'
|
56
56
|
try_extern 'void gr3_setlightdirection(float x, float y, float z)'
|
57
57
|
try_extern 'void gr3_setbackgroundcolor(float red, float green, float blue, float alpha)'
|
58
58
|
try_extern 'int gr3_createheightmapmesh(const float *heightmap, int num_columns, int num_rows)'
|
59
|
-
try_extern 'void gr3_drawheightmap(const float *heightmap,
|
60
|
-
|
61
|
-
try_extern 'void gr3_drawconemesh(int n, const float *positions, const float *directions,
|
62
|
-
|
63
|
-
try_extern 'void gr3_drawcylindermesh(int n, const float *positions, const float *directions,
|
64
|
-
|
65
|
-
try_extern 'void gr3_drawspheremesh(int n, const float *positions,
|
66
|
-
|
67
|
-
try_extern 'void gr3_drawcubemesh(int n,
|
68
|
-
|
69
|
-
|
59
|
+
try_extern 'void gr3_drawheightmap(const float *heightmap,' \
|
60
|
+
' int num_columns, int num_rows, const float *positions, const float *scales)'
|
61
|
+
try_extern 'void gr3_drawconemesh(int n, const float *positions, const float *directions,' \
|
62
|
+
' const float *colors, const float *radii, const float *lengths)'
|
63
|
+
try_extern 'void gr3_drawcylindermesh(int n, const float *positions, const float *directions,' \
|
64
|
+
' const float *colors, const float *radii, const float *lengths)'
|
65
|
+
try_extern 'void gr3_drawspheremesh(int n, const float *positions,' \
|
66
|
+
' const float *colors, const float *radii)'
|
67
|
+
try_extern 'void gr3_drawcubemesh(int n,' \
|
68
|
+
' const float *positions, const float *directions, const float *ups,' \
|
69
|
+
' const float *colors, const float *scales)'
|
70
70
|
try_extern 'void gr3_setobjectid(int id)'
|
71
71
|
try_extern 'int gr3_selectid(int x, int y, int width, int height, int *selection_id)'
|
72
72
|
try_extern 'void gr3_getviewmatrix(float *m)'
|
@@ -84,65 +84,72 @@ module GR3
|
|
84
84
|
# 'double step_x, double step_y, double step_z, double offset_x, double offset_y, double offset_z, ' \
|
85
85
|
# 'unsigned int *num_vertices, gr3_coord_t **vertices, gr3_coord_t **normals, ' \
|
86
86
|
# 'unsigned int *num_indices, unsigned int **indices)'
|
87
|
-
try_extern 'int gr3_createisosurfacemesh(int *mesh, unsigned short *data,
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
try_extern 'int gr3_createsurfacemesh(int *mesh, int nx, int ny,
|
93
|
-
|
94
|
-
try_extern 'int gr3_createsurface3dmesh(int *mesh, int ncols, int nrows,
|
95
|
-
|
96
|
-
try_extern 'void gr3_drawmesh_grlike(int mesh, int n,
|
97
|
-
|
98
|
-
|
87
|
+
try_extern 'int gr3_createisosurfacemesh(int *mesh, unsigned short *data,' \
|
88
|
+
' unsigned short isolevel, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
89
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
90
|
+
' double step_x, double step_y, double step_z,' \
|
91
|
+
' double offset_x, double offset_y, double offset_z)'
|
92
|
+
try_extern 'int gr3_createsurfacemesh(int *mesh, int nx, int ny,' \
|
93
|
+
' float *px, float *py, float *pz, int option)'
|
94
|
+
try_extern 'int gr3_createsurface3dmesh(int *mesh, int ncols, int nrows,' \
|
95
|
+
' float *px, float *py, float *pz)'
|
96
|
+
try_extern 'void gr3_drawmesh_grlike(int mesh, int n,' \
|
97
|
+
' const float *positions, const float *directions, const float *ups,' \
|
98
|
+
' const float *colors, const float *scales)'
|
99
99
|
try_extern 'void gr3_drawsurface(int mesh)'
|
100
100
|
try_extern 'void gr3_surface(int nx, int ny, float *px, float *py, float *pz, int option)'
|
101
|
-
try_extern 'int gr3_drawtubemesh(int n, float *points, float *colors, float *radii,
|
102
|
-
|
103
|
-
try_extern 'int gr3_createtubemesh(int *mesh, int n,
|
104
|
-
|
105
|
-
|
106
|
-
try_extern 'void gr3_drawspins(int n, const float *positions, const float *directions, const float *colors,
|
107
|
-
|
108
|
-
try_extern 'void gr3_drawmolecule(int n, const float *positions, const float *colors, const float *radii,
|
109
|
-
|
110
|
-
try_extern 'void gr3_createxslicemesh(int *mesh, const unsigned short *data,
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
try_extern 'void gr3_createyslicemesh(int *mesh, const unsigned short *data,
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
try_extern 'void gr3_createzslicemesh(int *mesh, const unsigned short *data,
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
101
|
+
try_extern 'int gr3_drawtubemesh(int n, float *points, float *colors, float *radii,' \
|
102
|
+
' int num_steps, int num_segments)'
|
103
|
+
try_extern 'int gr3_createtubemesh(int *mesh, int n,' \
|
104
|
+
' const float *points, const float *colors, const float *radii,' \
|
105
|
+
' int num_steps, int num_segments)'
|
106
|
+
try_extern 'void gr3_drawspins(int n, const float *positions, const float *directions, const float *colors,' \
|
107
|
+
' float cone_radius, float cylinder_radius, float cone_height, float cylinder_height)'
|
108
|
+
try_extern 'void gr3_drawmolecule(int n, const float *positions, const float *colors, const float *radii,' \
|
109
|
+
' float bond_radius, const float bond_color[3], float bond_delta)'
|
110
|
+
try_extern 'void gr3_createxslicemesh(int *mesh, const unsigned short *data,' \
|
111
|
+
' unsigned int ix, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
112
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
113
|
+
' double step_x, double step_y, double step_z,' \
|
114
|
+
' double offset_x, double offset_y, double offset_z)'
|
115
|
+
try_extern 'void gr3_createyslicemesh(int *mesh, const unsigned short *data,' \
|
116
|
+
' unsigned int iy, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
117
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
118
|
+
' double step_x, double step_y, double step_z,' \
|
119
|
+
' double offset_x, double offset_y, double offset_z)'
|
120
|
+
try_extern 'void gr3_createzslicemesh(int *mesh, const unsigned short *data,' \
|
121
|
+
' unsigned int iz, unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
122
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
123
|
+
' double step_x, double step_y, double step_z,' \
|
124
|
+
' double offset_x, double offset_y, double offset_z)'
|
125
125
|
try_extern 'void gr3_drawxslicemesh(const unsigned short *data, unsigned int ix,' \
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
try_extern 'void gr3_drawyslicemesh(const unsigned short *data, unsigned int iy,
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
try_extern 'void gr3_drawzslicemesh(const unsigned short *data, unsigned int iz,
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
try_extern 'void gr_volume(int nx, int ny, int nz, double *data,
|
142
|
-
|
126
|
+
' unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
127
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
128
|
+
' double step_x, double step_y, double step_z,' \
|
129
|
+
' double offset_x, double offset_y, double offset_z)'
|
130
|
+
try_extern 'void gr3_drawyslicemesh(const unsigned short *data, unsigned int iy,' \
|
131
|
+
' unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
132
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
133
|
+
' double step_x, double step_y, double step_z,' \
|
134
|
+
' double offset_x, double offset_y, double offset_z)'
|
135
|
+
try_extern 'void gr3_drawzslicemesh(const unsigned short *data, unsigned int iz,' \
|
136
|
+
' unsigned int dim_x, unsigned int dim_y, unsigned int dim_z,' \
|
137
|
+
' unsigned int stride_x, unsigned int stride_y, unsigned int stride_z,' \
|
138
|
+
' double step_x, double step_y, double step_z,' \
|
139
|
+
' double offset_x, double offset_y, double offset_z)'
|
140
|
+
try_extern 'void gr3_drawtrianglesurface(int n, const float *triangles)'
|
141
|
+
try_extern 'void gr_volume(int nx, int ny, int nz, double *data,' \
|
142
|
+
' int algorithm, double *dmin_ptr, double *dmax_ptr)'
|
143
143
|
try_extern 'void gr3_setorthographicprojection' \
|
144
|
-
|
144
|
+
'(float left, float right, float bottom, float top, float znear, float zfar)'
|
145
145
|
try_extern 'void gr3_setsurfaceoption(int option)'
|
146
146
|
try_extern 'int gr3_getsurfaceoption(void)'
|
147
|
+
try_extern 'int gr3_getlightsources(int max_num_lights, float *positions, float *colors)'
|
148
|
+
try_extern 'int gr3_setlightsources(int num_lights, float *positions, float *colors)'
|
149
|
+
try_extern 'void gr3_setlightparameters(float ambient, float diffuse, float specular, float specular_power)'
|
150
|
+
try_extern 'void gr3_getlightparameters(float *ambient, float *diffuse, float *specular, float *specular_power)'
|
151
|
+
try_extern 'void gr3_setdefaultlightparameters()'
|
152
|
+
try_extern 'void gr3_setclipping(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)'
|
153
|
+
try_extern 'void gr3_getclipping(float *xmin, float *xmax, float *ymin, float *ymax, float *zmin, float *zmax)'
|
147
154
|
end
|
148
155
|
end
|
data/lib/gr_commons/version.rb
CHANGED
data/lib/grm/ffi.rb
CHANGED
@@ -70,8 +70,5 @@ module GRM
|
|
70
70
|
try_extern 'int grm_merge_named(const grm_args_t *args, const char *identificator)'
|
71
71
|
try_extern 'int grm_plot(const grm_args_t *args)'
|
72
72
|
try_extern 'int grm_switch(unsigned int id)'
|
73
|
-
|
74
|
-
# https://github.com/sciapp/gr/blob/master/lib/grm/util.h
|
75
|
-
try_extern 'FILE *grm_get_stdout(void)'
|
76
73
|
end
|
77
74
|
end
|