ruby-gr 0.0.15 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +109 -28
- data/lib/gr.rb +105 -66
- data/lib/gr/ffi.rb +6 -1
- data/lib/gr/grbase.rb +2 -3
- data/lib/gr/plot.rb +251 -202
- data/lib/gr3.rb +51 -40
- data/lib/gr3/gr3base.rb +2 -3
- data/lib/gr_commons/define_methods.rb +2 -2
- data/lib/gr_commons/fiddley.rb +1 -1
- data/lib/gr_commons/gr_common_utils.rb +53 -27
- data/lib/gr_commons/version.rb +1 -1
- data/lib/grm.rb +45 -0
- data/lib/grm/ffi.rb +63 -0
- data/lib/grm/grmbase.rb +13 -0
- data/lib/grm/version.rb +5 -0
- metadata +13 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 29a78c0f4c5e3ab3afdc4245ab4dd6d9ce7d6c4f38638901a93487e366c219c6
         | 
| 4 | 
            +
              data.tar.gz: 72f3fb64d9508c28338214583b185c041362f3e8b31a138ab9990cba4669b27a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e0b0766224a375477115ff004467b4b5196689bff28846efabd31f078bd7f36d00a5f736e088f0a8333327d9eb6f8d80e398365e79d26e99f6303e2975b66c1c
         | 
| 7 | 
            +
              data.tar.gz: 69dbc6bc3859bad4e3d67c2d2131b48c41c659e79c2f9b8b0f3250fb15cb94a3c29cc0b10c217fd1b354784ac969f2d82d9be256f59e5f0224d4d597b94ea131
         | 
    
        data/README.md
    CHANGED
    
    | @@ -6,32 +6,38 @@ | |
| 6 6 | 
             
            [](https://gitter.im/red-data-tools/en)
         | 
| 7 7 | 
             
            [](https://rubydoc.info/gems/ruby-gr)
         | 
| 8 8 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 9 | 
            +
            
         | 
| 10 | 
            +
            
         | 
| 11 | 
            +
            
         | 
| 12 | 
            +
            
         | 
| 13 | 
            +
            
         | 
| 14 | 
            +
            
         | 
| 15 | 
            +
            
         | 
| 16 | 
            +
            
         | 
| 17 | 
            +
            
         | 
| 18 | 
            +
            
         | 
| 19 | 
            +
            
         | 
| 20 | 
            +
            
         | 
| 21 | 
            +
            
         | 
| 22 | 
            +
            
         | 
| 23 | 
            +
            
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            :bar_chart:  [GR framework](https://github.com/sciapp/gr) - powerful visualization library - for Ruby
         | 
| 14 26 |  | 
| 15 27 | 
             
            ## Installation
         | 
| 16 28 |  | 
| 17 29 | 
             
            GR.rb supports Ruby 2.4+.
         | 
| 18 30 |  | 
| 19 | 
            -
            [ | 
| 20 | 
            -
             | 
| 21 | 
            -
            Set environment variable GRDIR, if you have not already done. 
         | 
| 31 | 
            +
            First, [install GR](#gr-installation). Next, set environment variable `GRDIR`. 
         | 
| 22 32 |  | 
| 23 33 | 
             
            ```sh
         | 
| 24 34 | 
             
            export GRDIR="/your/path/to/gr"
         | 
| 25 35 | 
             
            ```
         | 
| 26 36 |  | 
| 27 | 
            -
            Add this line to your application's Gemfile:
         | 
| 28 | 
            -
             | 
| 29 37 | 
             
            ```sh
         | 
| 30 | 
            -
            gem  | 
| 38 | 
            +
            gem install ruby-gr
         | 
| 31 39 | 
             
            ```
         | 
| 32 40 |  | 
| 33 | 
            -
            GR3 and GR::Plot require [numo-narray](https://github.com/ruby-numo/numo-narray).
         | 
| 34 | 
            -
             | 
| 35 41 | 
             
            ## Quick Start
         | 
| 36 42 |  | 
| 37 43 | 
             
            <p align="center">
         | 
| @@ -47,42 +53,103 @@ y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7] | |
| 47 53 | 
             
            GR.plot(x, y)
         | 
| 48 54 | 
             
            ```
         | 
| 49 55 |  | 
| 50 | 
            -
             | 
| 56 | 
            +
            <p align="center">
         | 
| 57 | 
            +
              <img src="https://user-images.githubusercontent.com/5798442/84570709-242ab880-adca-11ea-9099-3a6b3418bf19.png">
         | 
| 58 | 
            +
            </p>
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            ```ruby
         | 
| 61 | 
            +
            require 'gr/plot'
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            x  = Numo::DFloat.linspace(0, 10, 101)
         | 
| 64 | 
            +
            y1 = Numo::NMath.sin(x)
         | 
| 65 | 
            +
            y2 = Numo::NMath.cos(x)
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            GR.plot(
         | 
| 68 | 
            +
              [x, y1, 'bo'], [x, y2, 'g*'],
         | 
| 69 | 
            +
              title:    "Multiple plot example",
         | 
| 70 | 
            +
              xlabel:   "x",
         | 
| 71 | 
            +
              ylabel:   "y",
         | 
| 72 | 
            +
              ylim:     [-1.2, 1.2],
         | 
| 73 | 
            +
              labels:   ["sin(x)", "cos(x)"],
         | 
| 74 | 
            +
              location: 11
         | 
| 75 | 
            +
            )
         | 
| 76 | 
            +
            ```
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            Save in PNG format.
         | 
| 51 79 |  | 
| 52 | 
            -
             | 
| 80 | 
            +
            ```ruby
         | 
| 81 | 
            +
            GR.savefig("figure.png")
         | 
| 82 | 
            +
            ```
         | 
| 53 83 |  | 
| 54 | 
            -
            ##  | 
| 84 | 
            +
            ## API Overview
         | 
| 55 85 |  | 
| 56 | 
            -
             | 
| 86 | 
            +
            There are two different approaches to plotting with GR.rb. One way is to call Matlab-like APIs. The other is to call GR/GR3 native functions. We are planning to prepare a more object-oriented interface based on [GRUtils.jl](https://github.com/heliosdrm/GRUtils.jl) in the future.
         | 
| 57 87 |  | 
| 58 | 
            -
            A simple, matlab-style API.
         | 
| 88 | 
            +
            #### GR::Plot - A simple, matlab-style API. 
         | 
| 59 89 |  | 
| 60 90 | 
             
            ```ruby
         | 
| 61 91 | 
             
            require 'gr/plot'
         | 
| 92 | 
            +
            GR.plot(x, y)
         | 
| 62 93 | 
             
            ```
         | 
| 63 94 |  | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 95 | 
            +
            List of vailable functions. See [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki) for details.
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            [`plot`](../../wiki/Plotting-functions#plot)
         | 
| 98 | 
            +
            [`step`](../../wiki/Plotting-functions#step)
         | 
| 99 | 
            +
            [`plot3`](../../wiki/Plotting-functions#plot3)
         | 
| 100 | 
            +
            [`polar`](../../wiki/Plotting-functions#polar)
         | 
| 101 | 
            +
            [`scatter`](../../wiki/Plotting-functions#scatter)
         | 
| 102 | 
            +
            [`scatter3`](../../wiki/Plotting-functions#scatter3)
         | 
| 103 | 
            +
            [`stem`](../../wiki/Plotting-functions#stem)
         | 
| 104 | 
            +
            [`barplot`](../../wiki/Plotting-functions#barplot)
         | 
| 105 | 
            +
            [`histogram`](../../wiki/Plotting-functions#histogram)
         | 
| 106 | 
            +
            [`polarhistogram`](../../wiki/Plotting-functions#polarhistogram)
         | 
| 107 | 
            +
            [`hexbin`](../../wiki/Plotting-functions#hexbin)
         | 
| 108 | 
            +
            [`contour`](../../wiki/Plotting-functions#contour)
         | 
| 109 | 
            +
            [`contourf`](../../wiki/Plotting-functions#contourf)
         | 
| 110 | 
            +
            [`tricont`](../../wiki/Plotting-functions#tricont)
         | 
| 111 | 
            +
            [`surface`](../../wiki/Plotting-functions#surface)
         | 
| 112 | 
            +
            [`trisurf`](../../wiki/Plotting-functions#trisurf)
         | 
| 113 | 
            +
            [`wireframe`](../../wiki/Plotting-functions#wireframe)
         | 
| 114 | 
            +
            [`volume`](../../wiki/Plotting-functions#volume)
         | 
| 115 | 
            +
            [`heatmap`](../../wiki/Plotting-functions#heatmap)
         | 
| 116 | 
            +
            [`polarheatmap`](../../wiki/Plotting-functions#polarheatmap)
         | 
| 117 | 
            +
            [`shade`](../../wiki/Plotting-functions#shade)
         | 
| 118 | 
            +
            [`imshow`](../../wiki/Plotting-functions#imshow)
         | 
| 119 | 
            +
            [`isosurface`](../../wiki/Plotting-functions#isosurface)
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            #### GR - A module for calling native GR functions.
         | 
| 122 | 
            +
             | 
| 123 | 
            +
            2-D Plots and common 3-D Plots.
         | 
| 67 124 |  | 
| 68 125 | 
             
            ```ruby
         | 
| 69 126 | 
             
            require 'gr'
         | 
| 127 | 
            +
             | 
| 128 | 
            +
            # For example
         | 
| 129 | 
            +
            GR.setviewport(0.1, 0.9, 0.1, 0.9)
         | 
| 130 | 
            +
            GR.setwindow(0.0, 20.0, 0.0, 20.0)
         | 
| 70 131 | 
             
            ```
         | 
| 71 132 |  | 
| 72 | 
            -
            #### GR3
         | 
| 133 | 
            +
            #### GR3 - A module for calling native GR3 functions.
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            Complex 3D scenes.
         | 
| 73 136 |  | 
| 74 137 | 
             
            ```ruby
         | 
| 75 138 | 
             
            require 'gr3'
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            # For example
         | 
| 141 | 
            +
            GR3.cameralookat(-3, 2, -2, 0, 0, 0, 0, 0, -1)
         | 
| 76 142 | 
             
            ```
         | 
| 77 143 |  | 
| 78 144 | 
             
            ## Documentation
         | 
| 79 145 |  | 
| 146 | 
            +
            - [GR.rb Wiki](https://github.com/red-data-tools/GR.rb/wiki)
         | 
| 80 147 | 
             
            - [GR Framework](https://gr-framework.org/)
         | 
| 81 148 | 
             
            - [GR.rb API Documentation](https://rubydoc.info/gems/ruby-gr)
         | 
| 82 149 |  | 
| 83 150 | 
             
            ## GR Installation
         | 
| 84 151 |  | 
| 85 | 
            -
            ###  | 
| 152 | 
            +
            ### Installing an official release (recommended)
         | 
| 86 153 |  | 
| 87 154 | 
             
            Download the [latest release](https://github.com/sciapp/gr/releases).
         | 
| 88 155 |  | 
| @@ -92,23 +159,36 @@ Set environment variable GRDIR. | |
| 92 159 | 
             
            export GRDIR="your/path/to/gr"
         | 
| 93 160 | 
             
            ```
         | 
| 94 161 |  | 
| 95 | 
            -
             | 
| 162 | 
            +
            * macOS Catalina and macOS Mojave: See the "How to open an app that hasn’t been notarized or is from an unidentified developer" section of [Safely open apps on your Mac](https://support.apple.com/en-us/HT202491) in the Apple documentation.
         | 
| 163 | 
            +
             | 
| 164 | 
            +
            ### Using your package manager
         | 
| 165 | 
            +
             | 
| 166 | 
            +
            * The third party GR packages for Mac, Linux and Windows are available (for advanced users).
         | 
| 167 | 
            +
            * If you find any problem, please report the issue [here](https://github.com/red-data-tools/GR.rb/issues).
         | 
| 168 | 
            +
             | 
| 169 | 
            +
            #### Mac - Homebrew
         | 
| 96 170 |  | 
| 97 171 | 
             
            ```sh
         | 
| 98 172 | 
             
            brew install libgr
         | 
| 99 173 | 
             
            ```
         | 
| 100 174 |  | 
| 101 | 
            -
            Set environment variable GRDIR | 
| 175 | 
            +
            Set environment variable `GRDIR`.
         | 
| 102 176 |  | 
| 103 177 | 
             
            ```sh
         | 
| 104 178 | 
             
            export GRDIR=$(brew --prefix libgr)
         | 
| 105 179 | 
             
            ```
         | 
| 106 180 |  | 
| 107 | 
            -
             | 
| 181 | 
            +
            #### Linux - APT Yum
         | 
| 182 | 
            +
             | 
| 183 | 
            +
            [packages.red-data-tools.org](https://github.com/red-data-tools/packages.red-data-tools.org) provides `libgr-dev` and `libgr3-dev`.
         | 
| 184 | 
            +
             | 
| 185 | 
            +
            #### Windows - MSYS2
         | 
| 186 | 
            +
             | 
| 187 | 
            +
            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.
         | 
| 108 188 |  | 
| 109 189 | 
             
            ## Backend for Charty
         | 
| 110 190 |  | 
| 111 | 
            -
            GR.rb  | 
| 191 | 
            +
            GR.rb will be the default backend for [Charty](https://github.com/red-data-tools/charty).
         | 
| 112 192 |  | 
| 113 193 | 
             
            ## Contributing
         | 
| 114 194 |  | 
| @@ -116,8 +196,9 @@ GR.rb is expected to be the backend for [Charty](https://github.com/red-data-too | |
| 116 196 | 
             
            * Fix bugs and submit pull requests
         | 
| 117 197 | 
             
            * Write, clarify, or fix documentation
         | 
| 118 198 | 
             
            * Suggest or add new features
         | 
| 199 | 
            +
            * Create visualization library based on GR.rb
         | 
| 119 200 |  | 
| 120 201 | 
             
            ## Acknowledgements
         | 
| 121 202 |  | 
| 122 | 
            -
            We would like to thank Josef Heinen, the creator of [GR.jl](https://github.com/jheinen/GR.jl)  | 
| 203 | 
            +
            We would like to thank Josef Heinen, the creator of [GR.jl](https://github.com/jheinen/GR.jl), Florian Rhiem, the creator of  [python-gr](https://github.com/sciapp/python-gr), and [GR](https://github.com/sciapp/gr) developers.
         | 
| 123 204 |  | 
    
        data/lib/gr.rb
    CHANGED
    
    | @@ -2,40 +2,46 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            # OverView of GR.rb
         | 
| 4 4 | 
             
            #
         | 
| 5 | 
            -
            # | 
| 6 | 
            -
            # | 
| 7 | 
            -
            # | 
| 8 | 
            -
            # | 
| 9 | 
            -
            # | 
| 10 | 
            -
            # | 
| 11 | 
            -
            # | 
| 12 | 
            -
            # | 
| 13 | 
            -
            # | 
| 14 | 
            -
            # | 
| 15 | 
            -
            # | 
| 16 | 
            -
            # | 
| 17 | 
            -
            # | 
| 18 | 
            -
            # | 
| 19 | 
            -
            # | 
| 20 | 
            -
            # | 
| 21 | 
            -
            # | 
| 22 | 
            -
            # | 
| 23 | 
            -
            # | 
| 24 | 
            -
            # | 
| 25 | 
            -
            # | 
| 26 | 
            -
            # | 
| 27 | 
            -
            # | 
| 28 | 
            -
            # | 
| 29 | 
            -
            # | 
| 30 | 
            -
            # | 
| 31 | 
            -
            # | 
| 32 | 
            -
            # | 
| 33 | 
            -
            # | 
| 34 | 
            -
            # | 
| 35 | 
            -
            # | 
| 36 | 
            -
            # | 
| 5 | 
            +
            #  +--------------------+  +--------------------+
         | 
| 6 | 
            +
            #  | GR module          |  | GR3 module         |
         | 
| 7 | 
            +
            #  | +----------------+ |  | +----------------+ |
         | 
| 8 | 
            +
            #  | | GR::FFI        | |  | | GR3::FFI       | |
         | 
| 9 | 
            +
            #  | | +   libGR.so   | |  | | +    libGR3.so | |
         | 
| 10 | 
            +
            #  | +----------------+ |  | +----------------+ |
         | 
| 11 | 
            +
            #  |   | define_method  |  |   | define_method  |
         | 
| 12 | 
            +
            #  | +----------------+ |  | +----------------+ |
         | 
| 13 | 
            +
            #  | | | GR::GRBase   | |  | | | GR3::GR3Base | |
         | 
| 14 | 
            +
            #  | | v  (Pri^ate)   | |  | | v  (Pri^ate)   | |
         | 
| 15 | 
            +
            #  | +++--------------+ |  | +++--------------+ |
         | 
| 16 | 
            +
            #  |  | Extend          |  |  | Extend          |
         | 
| 17 | 
            +
            #  |  v                 |  |  v       +-------+ |
         | 
| 18 | 
            +
            #  |      +-----------+ |  |          | Check | |
         | 
| 19 | 
            +
            #  |      | GR::Plot  | |  |       <--+ Error | |
         | 
| 20 | 
            +
            #  |      +-----------+ |  |          +-------+ |
         | 
| 21 | 
            +
            #  +--------------------+  +----------+---------+
         | 
| 22 | 
            +
            #            ^                        ^
         | 
| 23 | 
            +
            #            |  +------------------+  |
         | 
| 24 | 
            +
            #     Extend |  | GRCommons module |  | Extend
         | 
| 25 | 
            +
            #            |  | +--------------+ |  |
         | 
| 26 | 
            +
            #            |  | |    Fiddley   | |  |
         | 
| 27 | 
            +
            #            |  | +--------------+ |  |
         | 
| 28 | 
            +
            #            |  | +--------------+ |  |
         | 
| 29 | 
            +
            #            +----+ CommonUtils  +----+
         | 
| 30 | 
            +
            #            |  | +--------------+ |  |
         | 
| 31 | 
            +
            #            |  | +--------------+ |  |
         | 
| 32 | 
            +
            #            +----+    Version   +----+
         | 
| 33 | 
            +
            #            |  | +--------------+ |
         | 
| 34 | 
            +
            #            |  | +--------------+ |
         | 
| 35 | 
            +
            #            +----+JupyterSupport| |
         | 
| 36 | 
            +
            #               | +--------------+ |
         | 
| 37 | 
            +
            #               +------------------+
         | 
| 38 | 
            +
            #
         | 
| 39 | 
            +
            # (You can edit the above AA diagram with http://asciiflow.com/))
         | 
| 40 | 
            +
            #
         | 
| 41 | 
            +
            # Fiddley is Ruby-FFI compatible API layer for Fiddle.
         | 
| 37 42 | 
             
            #
         | 
| 38 43 | 
             
            # The GR module works without Numo::Narrray.
         | 
| 44 | 
            +
            # GR3 and GR::Plot depends on numo-narray.
         | 
| 39 45 | 
             
            #
         | 
| 40 46 | 
             
            # This is a procedural interface to the GR plotting library,
         | 
| 41 47 | 
             
            # https://github.com/sciapp/gr
         | 
| @@ -46,20 +52,24 @@ module GR | |
| 46 52 | 
             
                attr_accessor :ffi_lib
         | 
| 47 53 | 
             
              end
         | 
| 48 54 |  | 
| 49 | 
            -
              raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
         | 
| 50 | 
            -
             | 
| 51 55 | 
             
              # Platforms |  path
         | 
| 52 56 | 
             
              # Windows   |  bin/libgr.dll
         | 
| 53 57 | 
             
              # MacOSX    |  lib/libGR.so (NOT .dylib)
         | 
| 54 58 | 
             
              # Ubuntu    |  lib/libGR.so
         | 
| 55 59 | 
             
              if Object.const_defined?(:RubyInstaller)
         | 
| 60 | 
            +
                ENV['GRDIR'] ||= [
         | 
| 61 | 
            +
                  RubyInstaller::Runtime.msys2_installation.msys_path,
         | 
| 62 | 
            +
                  RubyInstaller::Runtime.msys2_installation.mingwarch
         | 
| 63 | 
            +
                ].join(File::ALT_SEPARATOR)
         | 
| 56 64 | 
             
                self.ffi_lib = File.expand_path('bin/libgr.dll', ENV['GRDIR'])
         | 
| 57 65 | 
             
                RubyInstaller::Runtime.add_dll_directory(File.dirname(ffi_lib))
         | 
| 58 66 | 
             
              else
         | 
| 67 | 
            +
                raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
         | 
| 68 | 
            +
             | 
| 59 69 | 
             
                self.ffi_lib = File.expand_path('lib/libGR.so', ENV['GRDIR'])
         | 
| 60 70 | 
             
              end
         | 
| 61 71 |  | 
| 62 | 
            -
              # Change the default encoding to UTF-8
         | 
| 72 | 
            +
              # Change the default encoding to UTF-8.
         | 
| 63 73 | 
             
              ENV['GKS_ENCODING'] ||= 'utf8'
         | 
| 64 74 |  | 
| 65 75 | 
             
              require_relative 'gr_commons/gr_commons'
         | 
| @@ -67,16 +77,19 @@ module GR | |
| 67 77 | 
             
              require_relative 'gr/ffi'
         | 
| 68 78 | 
             
              require_relative 'gr/grbase'
         | 
| 69 79 |  | 
| 80 | 
            +
              # `inquiry` methods etc. are defined here.
         | 
| 81 | 
            +
              extend GRCommons::GRCommonUtils
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              # Support for Jupyter Notebook / Lab.
         | 
| 70 84 | 
             
              extend GRCommons::JupyterSupport
         | 
| 71 85 |  | 
| 72 | 
            -
              # `double` is the default type in GR
         | 
| 86 | 
            +
              # `double` is the default type in GR.
         | 
| 73 87 | 
             
              # A Ruby array or NArray passed to GR method is automatically converted to
         | 
| 74 | 
            -
              # a  | 
| 88 | 
            +
              # a Fiddley::MemoryPointer in the GRBase class.
         | 
| 75 89 | 
             
              extend GRBase
         | 
| 76 90 |  | 
| 77 91 | 
             
              # Now you can see a lot of methods just calling super here.
         | 
| 78 | 
            -
              #  | 
| 79 | 
            -
              # Yes. They are written to help the yard generate the documentation.
         | 
| 92 | 
            +
              # They are written to help the yard generate the documentation.
         | 
| 80 93 | 
             
              class << self
         | 
| 81 94 | 
             
                def initgr(*)
         | 
| 82 95 | 
             
                  super
         | 
| @@ -230,6 +243,9 @@ module GR | |
| 230 243 | 
             
                # @param dimx [Integer] X dimension of the color index array
         | 
| 231 244 | 
             
                # @param dimy [Integer] Y dimension of the color index array
         | 
| 232 245 | 
             
                # @param color [Array, NArray] Color index array
         | 
| 246 | 
            +
                # The values for `x` and `y` are in world coordinates. `x` must contain
         | 
| 247 | 
            +
                # `dimx` + 1 elements and `y` must contain `dimy` + 1 elements. The elements
         | 
| 248 | 
            +
                # i and i+1 are respectively the edges of the i-th cell in X and Y direction.
         | 
| 233 249 | 
             
                def nonuniformcellarray(x, y, dimx, dimy, color)
         | 
| 234 250 | 
             
                  raise ArgumentError unless x.length == dimx + 1 && y.length == dimy + 1
         | 
| 235 251 |  | 
| @@ -1579,10 +1595,10 @@ module GR | |
| 1579 1595 | 
             
                    super(npoints, x, y, ntri, triangles.ref)
         | 
| 1580 1596 | 
             
                  end
         | 
| 1581 1597 | 
             
                  if n_tri > 0
         | 
| 1582 | 
            -
                    tri = triangles.to_str( | 
| 1598 | 
            +
                    tri = triangles.to_str(dim * n_tri * Fiddle::SIZEOF_INT).unpack('l*') # Int32
         | 
| 1583 1599 | 
             
                    # Ruby  : 0-based indexing
         | 
| 1584 1600 | 
             
                    # Julia : 1-based indexing
         | 
| 1585 | 
            -
                    tri = tri.each_slice( | 
| 1601 | 
            +
                    tri = tri.each_slice(dim).to_a
         | 
| 1586 1602 | 
             
                    [n_tri, tri]
         | 
| 1587 1603 | 
             
                  else
         | 
| 1588 1604 | 
             
                    0
         | 
| @@ -1789,31 +1805,32 @@ module GR | |
| 1789 1805 | 
             
                  end
         | 
| 1790 1806 | 
             
                end
         | 
| 1791 1807 |  | 
| 1792 | 
            -
                # Draw paths using given vertices and path codes.
         | 
| 1808 | 
            +
                # Draw paths using the given vertices and path codes.
         | 
| 1793 1809 | 
             
                # @param x [Array, NArray] A list containing the X coordinates
         | 
| 1794 1810 | 
             
                # @param y [Array, NArray] A list containing the Y coordinates
         | 
| 1795 | 
            -
                # @param codes [String]  | 
| 1811 | 
            +
                # @param codes [String] A list containing the path codes
         | 
| 1796 1812 | 
             
                #  The following path codes are recognized:
         | 
| 1797 1813 | 
             
                #  * M, m
         | 
| 1798 | 
            -
                #    * moveto | 
| 1814 | 
            +
                #    * moveto                      x, y
         | 
| 1799 1815 | 
             
                #  * L, l
         | 
| 1800 | 
            -
                #    * lineto | 
| 1816 | 
            +
                #    * lineto                      x, y
         | 
| 1801 1817 | 
             
                #  * Q, q
         | 
| 1802 | 
            -
                #    * quadratic Bézier | 
| 1818 | 
            +
                #    * quadratic Bézier            x1, x2  y1, y2
         | 
| 1803 1819 | 
             
                #  * C, c
         | 
| 1804 | 
            -
                #    * cubic Bézier | 
| 1805 | 
            -
                #  * R, r
         | 
| 1806 | 
            -
                #    * rectangle        w, h
         | 
| 1820 | 
            +
                #    * cubic Bézier                x1, x2, x3  y1, y2, y3
         | 
| 1807 1821 | 
             
                #  * A, a
         | 
| 1808 | 
            -
                #    * arc | 
| 1822 | 
            +
                #    * arc                         rx, a1, reserved  ry, a2, reserved
         | 
| 1809 1823 | 
             
                #  * Z
         | 
| 1810 | 
            -
                #    *  | 
| 1824 | 
            +
                #    * close path                  -
         | 
| 1811 1825 | 
             
                #  * s
         | 
| 1812 | 
            -
                #    * stroke | 
| 1826 | 
            +
                #    * stroke                      -
         | 
| 1827 | 
            +
                #  * s
         | 
| 1828 | 
            +
                #    * close path and stroke       -
         | 
| 1813 1829 | 
             
                #  * f
         | 
| 1814 | 
            -
                #    * fill | 
| 1815 | 
            -
                #  | 
| 1816 | 
            -
                #  | 
| 1830 | 
            +
                #    * close path and fill         -
         | 
| 1831 | 
            +
                #  * F
         | 
| 1832 | 
            +
                #    * close path, fill and stroke -
         | 
| 1833 | 
            +
                # See https://gr-framework.org/python-gr.html#gr.path for more details.
         | 
| 1817 1834 | 
             
                def path(x, y, codes)
         | 
| 1818 1835 | 
             
                  n = equal_length(x, y)
         | 
| 1819 1836 | 
             
                  super(n, x, y, codes)
         | 
| @@ -1959,22 +1976,41 @@ module GR | |
| 1959 1976 | 
             
                  end
         | 
| 1960 1977 | 
             
                end
         | 
| 1961 1978 |  | 
| 1962 | 
            -
                #  | 
| 1963 | 
            -
                # rotate around an object.
         | 
| 1979 | 
            +
                # Set the camera for orthographic or perspective projection.
         | 
| 1964 1980 | 
             
                # The center of the 3d window is used as the focus point and the camera is
         | 
| 1965 | 
            -
                # positioned relative to it, using  | 
| 1966 | 
            -
                #  | 
| 1967 | 
            -
                # the  | 
| 1968 | 
            -
                # to  | 
| 1969 | 
            -
                #  | 
| 1970 | 
            -
                # @param phi [Numeric]  | 
| 1971 | 
            -
                # @param theta [Numeric]  | 
| 1981 | 
            +
                # positioned relative to it, using camera distance, rotation and tilt similar
         | 
| 1982 | 
            +
                # to gr_setspace. This function can be used if the user prefers spherical
         | 
| 1983 | 
            +
                # coordinates to setting the camera position directly, but has reduced
         | 
| 1984 | 
            +
                # functionality in comparison to GR.settransformationparameters,
         | 
| 1985 | 
            +
                # GR.setperspectiveprojection and GR.setorthographicprojection.
         | 
| 1986 | 
            +
                # @param phi [Numeric] azimuthal angle of the spherical coordinates
         | 
| 1987 | 
            +
                # @param theta [Numeric] polar angle of the spherical coordinates
         | 
| 1972 1988 | 
             
                # @param fov [Numeric] vertical field of view (0 or NaN for orthographic projection)
         | 
| 1973 | 
            -
                # @param  | 
| 1989 | 
            +
                # @param camera_distance [Numeric] distance between the camera and the focus point
         | 
| 1974 1990 | 
             
                #   (0 or NaN for the radius of the object's smallest bounding sphere)
         | 
| 1975 | 
            -
                def  | 
| 1991 | 
            +
                def setspace3d(*)
         | 
| 1992 | 
            +
                  super
         | 
| 1993 | 
            +
                end
         | 
| 1994 | 
            +
             | 
| 1995 | 
            +
                def text3d(*)
         | 
| 1976 1996 | 
             
                  super
         | 
| 1977 1997 | 
             
                end
         | 
| 1998 | 
            +
             | 
| 1999 | 
            +
                def inqtext3d(x, y, z, string, axis)
         | 
| 2000 | 
            +
                  inquiry [{ double: 16 }, { double: 16 }] do |tbx, tby|
         | 
| 2001 | 
            +
                    super(x, y, z, string, axis, tbx, tby)
         | 
| 2002 | 
            +
                  end
         | 
| 2003 | 
            +
                end
         | 
| 2004 | 
            +
             | 
| 2005 | 
            +
                def settextencoding(*)
         | 
| 2006 | 
            +
                  super
         | 
| 2007 | 
            +
                end
         | 
| 2008 | 
            +
             | 
| 2009 | 
            +
                def inqtextencoding
         | 
| 2010 | 
            +
                  inquiry_int do |encoding|
         | 
| 2011 | 
            +
                    super(encoding)
         | 
| 2012 | 
            +
                  end
         | 
| 2013 | 
            +
                end
         | 
| 1978 2014 | 
             
              end
         | 
| 1979 2015 |  | 
| 1980 2016 | 
             
              ASF_BUNDLED    = 0
         | 
| @@ -2193,6 +2229,9 @@ module GR | |
| 2193 2229 | 
             
              XFORM_CUBIC     = 4
         | 
| 2194 2230 | 
             
              XFORM_EQUALIZED = 5
         | 
| 2195 2231 |  | 
| 2232 | 
            +
              ENCODING_LATIN1 = 300
         | 
| 2233 | 
            +
              ENCODING_UTF8 = 301
         | 
| 2234 | 
            +
             | 
| 2196 2235 | 
             
              UPSAMPLE_VERTICAL_DEFAULT     = 0x00000000
         | 
| 2197 2236 | 
             
              UPSAMPLE_HORIZONTAL_DEFAULT   = 0x00000000
         | 
| 2198 2237 | 
             
              DOWNSAMPLE_VERTICAL_DEFAULT   = 0x00000000
         |