ruby-gr 0.0.19 → 0.0.24

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.
data/lib/gr3.rb CHANGED
@@ -40,16 +40,18 @@
40
40
  #
41
41
  # Fiddley is Ruby-FFI compatible API layer for Fiddle.
42
42
  #
43
- # Why not GR::GR3?
44
- # * kojix2 did not want to force gr3 to be loaded when gr is loaded.
45
- # * kojix2 did not want to write `GR3 = GR::GR3` or something.
46
- # * This is a opinion of kojix2 and may be changed by future maintainers.
43
+ # @note
44
+ # Why not GR::GR3?
45
+ # * kojix2 did not want to force gr3 to be loaded when gr is loaded.
46
+ # * kojix2 did not want to write `GR3 = GR::GR3` or something.
47
+ # * This is a opinion of kojix2 and may be changed by future maintainers.
47
48
  #
48
- # GR3 uses Numo::Narrray.
49
- # * It is difficult to write GR3 modules with only Ruby arrays.
50
- # * Numo::Narray has better performance and is easier to read.
51
- # * Numo::Narray does not work with JRuby.
52
- # * https://github.com/ruby-numo/numo-narray/issues/147
49
+ # @note
50
+ # GR3 uses Numo::Narrray.
51
+ # * It is difficult to write GR3 modules with only Ruby arrays.
52
+ # * Numo::Narray has better performance and is easier to read.
53
+ # * Numo::Narray does not work with JRuby.
54
+ # * https://github.com/ruby-numo/numo-narray/issues/147
53
55
  #
54
56
  # This is a procedural interface to the GR3 in GR plotting library,
55
57
  # https://github.com/sciapp/gr
@@ -60,27 +62,20 @@ module GR3
60
62
  attr_accessor :ffi_lib
61
63
  end
62
64
 
65
+ require_relative 'gr_commons/gr_commons'
66
+ extend GRCommons::SearchSharedLibrary
67
+
63
68
  # Platforms | path
64
69
  # Windows | bin/libGR3.dll
65
70
  # MacOSX | lib/libGR3.so (NOT .dylib)
66
71
  # Ubuntu | lib/libGR3.so
67
- if Object.const_defined?(:RubyInstaller)
68
- ENV['GRDIR'] ||= [
69
- RubyInstaller::Runtime.msys2_installation.msys_path,
70
- RubyInstaller::Runtime.msys2_installation.mingwarch
71
- ].join(File::ALT_SEPARATOR)
72
- self.ffi_lib = File.expand_path('bin/libGR3.dll', ENV['GRDIR'])
73
- RubyInstaller::Runtime.add_dll_directory(File.dirname(ffi_lib))
74
- else
75
- raise Error, 'Please set env variable GRDIR' unless ENV['GRDIR']
76
-
77
- self.ffi_lib = File.expand_path('lib/libGR3.so', ENV['GRDIR'])
78
- end
79
-
80
- # change the default encoding to UTF-8.
81
- ENV['GKS_ENCODING'] ||= 'utf8'
72
+ self.ffi_lib = case RbConfig::CONFIG['host_os']
73
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
74
+ search_shared_library('libGR3.dll', 'gr3')
75
+ else
76
+ search_shared_library('libGR3.so', 'gr3')
77
+ end
82
78
 
83
- require_relative 'gr_commons/gr_commons'
84
79
  require_relative 'gr3/version'
85
80
  require_relative 'gr3/ffi'
86
81
  require_relative 'gr3/gr3base'
@@ -124,70 +119,82 @@ module GR3
124
119
  end
125
120
  extend CheckError
126
121
 
127
- # Now you can see a lot of methods just calling super here.
128
- # They are written to help the yard generate the documentation.
129
122
  class << self
130
123
  # This method initializes the gr3 context.
124
+ #
131
125
  # @return [Integer]
132
- def gr3_init(*)
133
- super
134
- end
126
+ #
127
+ # @!method gr3_init
135
128
 
136
- def free(*)
137
- super
138
- end
129
+ # @!method free
139
130
 
140
131
  # This function terminates the gr3 context.
141
- def terminate(*)
142
- super
143
- end
132
+ #
133
+ # After calling this function, gr3 is in the same state as when it was first
134
+ # loaded, except for context-independent variables, i.e. the logging callback.
135
+ #
136
+ # @!method terminate
144
137
 
145
- # @!method geterror
138
+ # @note This method is defined in the CheckError module.
139
+ #
146
140
  # This function returns information on the most recent GR3 error.
141
+ #
147
142
  # @return [Integer]
148
- # @note This method is defined in the CheckError module.
143
+ #
144
+ # @!method geterror
149
145
 
150
146
  # This function allows the user to find out how his commands are rendered.
147
+ #
151
148
  # If gr3 is initialized, a string in the format:
152
- # `"gr3 - " + window toolkit + " - " + framebuffer extension + " - " + OpenGL version + " - " + OpenGL renderer string`.
153
- # For example `"gr3 - GLX - GL_ARB_framebuffer_object - 2.1 Mesa 7.10.2 - Software Rasterizer"`
154
- # might be returned on a Linux system (using GLX) with an available GL_ARB_framebuffer_object implementation.
149
+ # `"gr3 - " + window toolkit + " - " + framebuffer extension + " - "
150
+ # + OpenGL version + " - " + OpenGL renderer string`.
151
+ # For example
152
+ # `"gr3 - GLX - GL_ARB_framebuffer_object - 2.1 Mesa 7.10.2 - Software Rasterizer"`
153
+ # might be returned on a Linux system (using GLX) with an available
154
+ # GL_ARB_framebuffer_object implementation.
155
155
  # If gr3 is not initialized `"Not initialized"` is returned.
156
+ #
156
157
  # @return [String]
158
+ #
157
159
  def getrenderpathstring(*)
158
160
  super.to_s
159
161
  end
160
162
 
161
163
  # This function returns a string representation of a given error code.
164
+ #
162
165
  # @return [String]
166
+ #
163
167
  def geterrorstring(*)
164
168
  super.to_s
165
169
  end
166
170
 
167
171
  # This function clears the draw list.
172
+ #
168
173
  # @return [Integer]
169
- def clear(*)
170
- super
171
- end
174
+ #
175
+ # @!method clear
172
176
 
173
- # Use the currently bound framebuffer as the framebuffer used for drawing to OpenGL (using gr3.drawimage).
174
- # This function is only needed when you do not want to render to 0, the default framebuffer.
175
- def usecurrentframebuffer(*)
176
- super
177
- end
177
+ # Use the currently bound framebuffer as the framebuffer used for drawing to
178
+ # OpenGL (using gr3.drawimage).
179
+ # This function is only needed when you do not want to render to 0, the
180
+ # default framebuffer.
181
+ #
182
+ # @!method usecurrentframebuffer
178
183
 
179
184
  # Set the framebuffer used for drawing to OpenGL (using gr3.drawimage).
180
- # This function is only needed when you do not want to render to 0, the default framebuffer.
181
- def useframebuffer(*)
182
- super
183
- end
185
+ #
186
+ # This function is only needed when you do not want to render to 0, the
187
+ # default framebuffer.
188
+ #
189
+ # @!method useframebuffer
184
190
 
185
191
  # Set rendering quality
192
+ #
186
193
  # @param quality [] The quality to set
194
+ #
187
195
  # @return [Integer]
188
- def setquality(*)
189
- super
190
- end
196
+ #
197
+ # @!method setquality
191
198
 
192
199
  # @return [Integer]
193
200
  def getimage(width, height, use_alpha = true)
@@ -198,31 +205,31 @@ module GR3
198
205
  end
199
206
 
200
207
  # @return [Integer]
201
- def export(*)
202
- super
203
- end
208
+ # @!method export
204
209
 
205
210
  # @return [Integer]
206
- def drawimage(*)
207
- super
208
- end
211
+ # @!method drawimage
209
212
 
210
- # createmesh_nocopy
213
+ # This function creates a mesh from vertex position, normal and color data.
214
+ #
211
215
  # @return [Integer]
212
- def createmesh_nocopy(_n, vertices, normals, colors)
216
+ def createmesh_nocopy(n, vertices, normals, colors)
213
217
  inquiry_int do |mesh|
214
- super(mesh, vertices, normals, colors)
218
+ super(mesh, n, vertices, normals, colors)
215
219
  end
216
220
  end
217
221
 
218
222
  # This function creates a int from vertex position, normal and color data.
219
223
  # Returns a mesh.
220
- # @param n [Integer] the number of vertices in the mesh
224
+ #
225
+ # @param n [Integer] the number of vertices in the mesh
221
226
  # @param vertices [Array, NArray] the vertex positions
222
- # @param normals [Array, NArray] the vertex normals
223
- # @param colors [Array, NArray] the vertex colors,
224
- # they should be white (1,1,1) if you want to change the color for each drawn mesh
227
+ # @param normals [Array, NArray] the vertex normals
228
+ # @param colors [Array, NArray] the vertex colors, they should be
229
+ # white (1,1,1) if you want to change the color for each drawn mesh
230
+ #
225
231
  # @return [Integer]
232
+ #
226
233
  def createmesh(n, vertices, normals, colors)
227
234
  inquiry_int do |mesh|
228
235
  super(mesh, n, vertices, normals, colors)
@@ -230,6 +237,7 @@ module GR3
230
237
  end
231
238
 
232
239
  # This function creates a mesh from vertex position, normal and color data.
240
+ #
233
241
  # @return [Integer]
234
242
  def createindexedmesh_nocopy(num_vertices, vertices, normals, colors, num_indices, indices)
235
243
  inquiry_int do |mesh|
@@ -240,150 +248,159 @@ module GR3
240
248
  # This function creates an indexed mesh from vertex information (position,
241
249
  # normal and color) and triangle information (indices).
242
250
  # Returns a mesh.
243
- # @param num_vertices [Integer] the number of vertices in the mesh
244
- # @param vertices [Array, NArray] the vertex positions
245
- # @param normals [Array, NArray] the vertex normals
246
- # @param colors [Array, NArray] the vertex colors,
247
- # they should be white (1,1,1) if you want to change the color for each drawn mesh
248
- # @param num_indices [Integer] the number of indices in the mesh (three times the number of triangles)
249
- # @param indices [Array, NArray] the index array (vertex indices for each triangle)
251
+ #
252
+ # @param num_vertices [Integer] the number of vertices in the mesh
253
+ # @param vertices [Array, NArray] the vertex positions
254
+ # @param normals [Array, NArray] the vertex normals
255
+ # @param colors [Array, NArray] the vertex colors, they should be
256
+ # white (1,1,1) if you want to change
257
+ # the color for each drawn mesh
258
+ # @param num_indices [Integer] the number of indices in the mesh
259
+ # (three times the number of triangles)
260
+ # @param indices [Array, NArray] the index array (vertex indices for
261
+ # each triangle)
262
+ #
250
263
  # @return [Integer]
264
+ #
251
265
  def createindexedmesh(num_vertices, vertices, normals, colors, num_indices, indices)
252
266
  inquiry_int do |mesh|
253
267
  super(mesh, num_vertices, vertices, normals, colors, num_indices, indices)
254
268
  end
255
269
  end
256
270
 
257
- # This function adds a mesh to the draw list, so it will be drawn when the user calls getpixmap.
258
- # The given data stays owned by the user, a copy will be saved in the draw list and the mesh reference counter will be increased.
259
- # @param mesh [Integer] The mesh to be drawn
260
- # @param n [Integer] The number of meshes to be drawn
261
- # @param positions [Array, NArray] The positions where the meshes should be drawn
271
+ # This function adds a mesh to the draw list, so it will be drawn when the
272
+ # user calls getpixmap. The given data stays owned by the user, a copy will
273
+ # be saved in the draw list and the mesh reference counter will be increased.
274
+ #
275
+ # This function does not return an error code, because of its asynchronous
276
+ # nature. If gr3_getpixmap_() returns a GR3_ERROR_OPENGL_ERR, this might be
277
+ # caused by this function saving unuseable data into the draw list.
278
+ #
279
+ # @param mesh [Integer] The mesh to be drawn
280
+ # @param n [Integer] The number of meshes to be drawn
281
+ # @param positions [Array, NArray] The positions where the meshes should be drawn
262
282
  # @param directions [Array, NArray] The forward directions the meshes should be facing at
263
- # @param ups [Array, NArray] The up directions
264
- # @param colors [Array, NArray] The colors the meshes should be drawn in, it will be multiplied with each vertex color
265
- # @param scales [Array, NArray] The scaling factors
266
- def drawmesh(*)
267
- super
268
- end
269
-
270
- # This function marks a mesh for deletion and removes the user’s reference from the mesh’s referenc counter,
271
- # so a user must not use the mesh after calling this function.
283
+ # @param ups [Array, NArray] The up directions
284
+ # @param colors [Array, NArray] The colors the meshes should be drawn in,
285
+ # it will be multiplied with each vertex color
286
+ # @param scales [Array, NArray] The scaling factors
287
+ #
288
+ # @!method drawmesh
289
+
290
+ # This function marks a mesh for deletion and removes the user’s reference
291
+ # from the mesh’s referenc counter, so a user must not use the mesh after
292
+ # calling this function.
293
+ #
272
294
  # @param mesh [Integer] The mesh that should be marked for deletion
273
- def deletemesh(*)
274
- super
275
- end
295
+ #
296
+ # @!method deletemesh
276
297
 
277
298
  # This function sets the view matrix by getting the position of the camera,
278
299
  # the position of the center of focus and the direction which should point up.
300
+ # This function takes effect when the next image is created. Therefore if
301
+ # you want to take pictures of the same data from different perspectives,
302
+ # you can call and gr3_cameralookat(), gr3_getpixmap_(), gr3_cameralookat(),
303
+ # gr3_getpixmap_(), … without calling gr3_clear() and gr3_drawmesh() again.
304
+ #
279
305
  # @param camera_x [Array, NArray] The x-coordinate of the camera
280
306
  # @param camera_y [Array, NArray] The y-coordinate of the camera
281
307
  # @param camera_z [Array, NArray] The z-coordinate of the camera
282
308
  # @param center_x [Array, NArray] The x-coordinate of the center of focus
283
309
  # @param center_y [Array, NArray] The y-coordinate of the center of focus
284
310
  # @param center_z [Array, NArray] The z-coordinate of the center of focus
285
- # @param up_x [Array, NArray] The x-component of the up direction
286
- # @param up_y [Array, NArray] The y-component of the up direction
287
- # @param up_z [Array, NArray] The z-component of the up direction
288
- def cameralookat(*)
289
- super
290
- end
311
+ # @param up_x [Array, NArray] The x-component of the up direction
312
+ # @param up_y [Array, NArray] The y-component of the up direction
313
+ # @param up_z [Array, NArray] The z-component of the up direction
314
+ #
315
+ # @!method cameralookat
291
316
 
292
317
  # This function sets the projection parameters.
293
318
  # This function takes effect when the next image is created.
294
- # @param vertical_field_of_view [Numeric] This parameter is the vertical field of view in degrees.
295
- # It must be greater than 0 and less than 180.
319
+ #
320
+ # The ratio between zFar and zNear influences the precision of the depth
321
+ # buffer, the greater (zFar/zNear), the more likely are errors. So you should
322
+ # try to keep both values as close to each other as possible while making
323
+ # sure everything you want to be visible, is visible.
324
+ #
325
+ # @param vertical_field_of_view [Numeric]
326
+ # This parameter is the vertical field of view in degrees.
327
+ # It must be greater than 0 and less than 180.
296
328
  # @param zNear [Numeric] The distance to the near clipping plane.
297
- # @param zFar [Numeric] The distance to the far clipping plane.
329
+ # @param zFar [Numeric] The distance to the far clipping plane.
330
+ #
298
331
  # @return [Integer]
299
- def setcameraprojectionparameters(*)
300
- super
301
- end
332
+ #
333
+ # @!method setcameraprojectionparameters
302
334
 
303
335
  # Get the projection parameters.
336
+ #
337
+ # @param vfov [Array, NArray] Vertical field of view in degrees
338
+ # @param znear [Array, NArray] The distance to the near clipping plane.
339
+ # @param zfar [Array, NArray] The distance to the far clipping plane.
340
+ #
304
341
  # @return [Integer]
305
- def getcameraprojectionparameters(*)
306
- super
307
- end
342
+ #
343
+ # @!method getcameraprojectionparameters
308
344
 
309
- # This function sets the direction of light.
310
- # If it is called with (0, 0, 0), the light is always pointing into the same direction as the camera.
345
+ # This function sets the direction of light. If it is called with (0, 0, 0),
346
+ # the light is always pointing into the same direction as the camera.
347
+ #
311
348
  # @param x [Numeric] The x-component of the light's direction
312
349
  # @param y [Numeric] The y-component of the light's direction
313
350
  # @param z [Numeric] The z-component of the light's direction
314
- def setlightdirection(*)
315
- super
316
- end
351
+ #
352
+ # @!method setlightdirection
317
353
 
318
354
  # This function sets the background color.
319
- def setbackgroundcolor(*)
320
- super
321
- end
355
+ # @!method setbackgroundcolor
322
356
 
323
357
  # @return [Integer]
324
- def createheightmapmesh(*)
325
- super
326
- end
358
+ # @!method createheightmapmesh
327
359
 
328
- def drawheightmap(*)
329
- super
330
- end
360
+ # @!method drawheightmap
331
361
 
332
362
  # This function allows drawing a cylinder without requiring a mesh.
333
- def drawconemesh(*)
334
- super
335
- end
363
+ # @!method drawconemesh
336
364
 
337
365
  # This function allows drawing a cylinder without requiring a mesh.
338
- def drawcylindermesh(*)
339
- super
340
- end
366
+ # @!method drawcylindermesh
341
367
 
342
368
  # This function allows drawing a sphere without requiring a mesh.
343
- def drawspheremesh(*)
344
- super
345
- end
369
+ # @!method drawspheremesh
346
370
 
347
- def drawcubemesh(*)
348
- super
349
- end
371
+ # @!method drawcubemesh
350
372
 
351
- def setobjectid(*)
352
- super
353
- end
373
+ # @!method setobjectid
354
374
 
355
375
  # @return [Integer]
356
- def selectid(*)
357
- super
358
- end
376
+ # @!method selectid
359
377
 
360
- def getviewmatrix(*)
361
- super
362
- end
378
+ # @param m [Array, NArray] the 4x4 column major view matrix
379
+ # @!method getviewmatrix
363
380
 
364
- def setviewmatrix(*)
365
- super
366
- end
381
+ # @param m [Array, NArray] the 4x4 column major view matrix
382
+ # @!method setviewmatrix
367
383
 
368
- # the current projection type: GR3_PROJECTION_PERSPECTIVE or GR3_PROJECTION_PARALLEL
369
384
  # @return [Integer]
370
- def getprojectiontype(*)
371
- super
372
- end
385
+ # the current projection type: GR3_PROJECTION_PERSPECTIVE or GR3_PROJECTION_PARALLEL
386
+ # @!method getprojectiontype
373
387
 
374
- # @param type [Integer] the new projection type: GR3_PROJECTION_PERSPECTIVE or GR3_PROJECTION_PARALLEL
375
- def setprojectiontype(*)
376
- super
377
- end
388
+ # @param type [Integer]
389
+ # the new projection type: GR3_PROJECTION_PERSPECTIVE,
390
+ # GR3_PROJECTION_PARALLEL or GR3_PROJECTION_ORTHOGRAPHIC
391
+ # @!method setprojectiontype
378
392
 
379
393
  # This function creates an isosurface from voxel data using the
380
394
  # marching cubes algorithm.
381
395
  # Returns a mesh.
382
- # @param grid [NArray] 3D narray array containing the voxel data
383
- # @param step [Array] voxel sizes in each direction
384
- # @param offset [Array] coordinate origin in each direction
385
- # @param isolevel [Integer] isovalue at which the surface will be created
396
+ #
397
+ # @param grid [NArray] 3D narray array containing the voxel data
398
+ # @param step [Array, NArray] voxel sizes in each direction
399
+ # @param offset [Array, NArray] coordinate origin in each direction
400
+ # @param isolevel [Integer] isovalue at which the surface will be created
401
+ #
386
402
  # @return [Integer]
403
+ #
387
404
  def createisosurfacemesh(grid, step, offset, isolevel)
388
405
  args = _preprocess_createslicemesh(grid, step, offset)
389
406
  grid = args.shift
@@ -395,10 +412,11 @@ module GR3
395
412
  # Create a mesh of a surface plot similar to gr_surface.
396
413
  # Uses the current colormap. To apply changes of the colormap
397
414
  # a new mesh has to be created.
398
- # @param nx [Integer] number of points in x-direction
399
- # @param ny [Integer] number of points in y-direction
400
- # @param x [Array, NArray] an array containing the x-coordinates
401
- # @param y [Array, NArray] an array containing the y-coordinates
415
+ #
416
+ # @param nx [Integer] number of points in x-direction
417
+ # @param ny [Integer] number of points in y-direction
418
+ # @param x [Array, NArray] an array containing the x-coordinates
419
+ # @param y [Array, NArray] an array containing the y-coordinates
402
420
  # @param z [Array, NArray] an array of length nx * ny containing the z-coordinates
403
421
  # @param option [Integer] option for the surface mesh; the GR3_SURFACE constants can be combined with bitwise or. See the table below.
404
422
  # * 0 : GR3_SURFACE_DEFAULT
@@ -413,6 +431,7 @@ module GR3
413
431
  # * color the surface according to the current gr colormap
414
432
  # * 16 : GR3_SURFACE_GRZSHADED
415
433
  # * like GR3_SURFACE_GRCOLOR, but use the z-value directly as color index
434
+ #
416
435
  # @return [Integer]
417
436
  def createsurfacemesh(nx, ny, x, y, z, option = 0)
418
437
  inquiry_int do |mesh|
@@ -426,29 +445,32 @@ module GR3
426
445
  # the viewmatrix and the light direction. If necessary, the user has to
427
446
  # save them before the call to this function and restore them after
428
447
  # the call to gr3_drawimage.
429
- # @param mesh [Integer] the mesh to be drawn
430
- # @param n [Integer] the number of meshes to be drawn
431
- # @param positions [Array, NArray] the positions where the meshes should be drawn
448
+ #
449
+ # @param mesh [Integer] the mesh to be drawn
450
+ # @param n [Integer] the number of meshes to be drawn
451
+ # @param positions [Array, NArray] the positions where the meshes should be drawn
432
452
  # @param directions [Array, NArray] the forward directions the meshes should be facing at
433
- # @param ups [Array, NArray] the up directions
434
- # @param colors [Array, NArray] the colors the meshes should be drawn in, it will be multiplied with each vertex color
435
- # @param scales [Array, NArray] the scaling factors
436
- def drawmesh_grlike(*)
437
- super
438
- end
453
+ # @param ups [Array, NArray] the up directions
454
+ # @param colors [Array, NArray] the colors the meshes should be drawn in,
455
+ # it will be multiplied with each vertex color
456
+ # @param scales [Array, NArray] the scaling factors
457
+ #
458
+ # @!method drawmesh_grlike
439
459
 
440
460
  # Convenience function for drawing a surfacemesh.
461
+ #
441
462
  # @param mesh [Integer] the mesh to be drawn
442
- def drawsurface(*)
443
- super
444
- end
463
+ #
464
+ # @!method drawsurface
445
465
 
446
466
  # Create a surface plot with gr3 and draw it with gks as cellarray.
447
- # @param x [Array, NArray] an array containing the x-coordinates
448
- # @param y [Array, NArray] an array containing the y-coordinates
449
- # @param z [Array, NArray] an array of length nx * ny containing the z-coordinates
450
- # @param option [Integer] see the option parameter of gr_surface.
451
- # OPTION_COLORED_MESH and OPTION_Z_SHADED_MESH are supported.
467
+ #
468
+ # @param x [Array, NArray] an array containing the x-coordinates
469
+ # @param y [Array, NArray] an array containing the y-coordinates
470
+ # @param z [Array, NArray] an array of length nx * ny containing the z-coordinates
471
+ # @param option [Integer] see the option parameter of gr_surface.
472
+ # OPTION_COLORED_MESH and OPTION_Z_SHADED_MESH are supported.
473
+ #
452
474
  def surface(x, y, z, option)
453
475
  nx = x.length
454
476
  ny = y.length
@@ -456,17 +478,20 @@ module GR3
456
478
  super(nx, ny, x, y, z, option)
457
479
  end
458
480
 
459
- # drawtubemesh
460
481
  # Draw a tube following a path given by a list of points. The colors and
461
482
  # radii arrays specify the color and radius at each point.
462
- # @param n [Integer] the number of points given
483
+ #
484
+ # @param n [Integer] the number of points given
463
485
  # @param points [Array, NArray] the points the tube should go through
464
486
  # @param colors [Array, NArray] the color at each point
465
- # @param radii [Array, NArray] the desired tube radius at each point
466
- # @param num_steps [Integer] the number of steps between each point, allowing for a more smooth tube
467
- # @param num_segments [Integer] the number of segments each ring of the tube consists of,
468
- # e.g. 3 would yield a triangular tube
487
+ # @param radii [Array, NArray] the desired tube radius at each point
488
+ # @param num_steps [Integer] the number of steps between each point,
489
+ # allowing for a more smooth tube
490
+ # @param num_segments [Integer] the number of segments each ring of the tube
491
+ # consists of, e.g. 3 would yield a triangular tube
492
+ #
469
493
  # @return [Integer]
494
+ #
470
495
  def drawtubemesh(n, points, colors, radii, num_steps = 10, num_segments = 20)
471
496
  super(n, points, colors, radii, num_steps, num_segments)
472
497
  end
@@ -474,12 +499,17 @@ module GR3
474
499
  # Create a mesh object in the shape of a tube following a path given by a
475
500
  # list of points. The colors and radii arrays specify the color and radius at
476
501
  # each point.
477
- # @param n [Integer] the number of points given
478
- # @param points [Array, NArray] the points the tube should go through
479
- # @param colors [Array, NArray] the color at each point
480
- # @param radii [Array, NArray] the desired tube radius at each point
481
- # @param num_steps [Integer] the number of steps between each point, allowing for a more smooth tube
482
- # @param num_segments [Integer] the number of segments each ring of the tube consists of, e.g. 3 would yield a triangular tube
502
+ #
503
+ # @param n [Integer] the number of points given
504
+ # @param points [Array, NArray] the points the tube should go through
505
+ # @param colors [Array, NArray] the color at each point
506
+ # @param radii [Array, NArray] the desired tube radius at each point
507
+ # @param num_steps [Integer] the number of steps between each point,
508
+ # allowing for a more smooth tube
509
+ # @param num_segments [Integer] the number of segments each ring of the
510
+ # tube consists of, e.g. 3 would yield a
511
+ # triangular tube
512
+ #
483
513
  # @return [Integer]
484
514
  def createtubemesh(n, points, colors, radii, num_steps = 10, num_segments = 20)
485
515
  inquiry_uint do |mesh| # mesh should be Int?
@@ -554,12 +584,14 @@ module GR3
554
584
  # drawn and at which positions they should go through the data. If neither
555
585
  # x nor y nor z are set, 0.5 will be used for all three.
556
586
  # Returns meshes for the yz-slice, the xz-slice and the xy-slice.
557
- # @param grid [NArray] 3D narray array containing the voxel data
558
- # @param x [Numeric] the position of the slice through the xz-plane (0 to 1)
559
- # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
560
- # @param z [Numeric] the position of the slice through the xz-plane (0 to 1)
561
- # @param step [Array] voxel sizes in each direction
562
- # @param offset [Array] coordinate origin in each direction
587
+ #
588
+ # @param grid [NArray] 3D narray array containing the voxel data
589
+ # @param x [Numeric] the position of the slice through the xz-plane (0 to 1)
590
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
591
+ # @param z [Numeric] the position of the slice through the xz-plane (0 to 1)
592
+ # @param step [Array, NArray] voxel sizes in each direction
593
+ # @param offset [Array, NArray] coordinate origin in each direction
594
+ #
563
595
  def createslicemeshes(grid, x = nil, y = nil, z = nil, step = nil, offset = nil)
564
596
  if [x, y, z].all?(&:nil?)
565
597
  x = 0.5
@@ -576,10 +608,11 @@ module GR3
576
608
  # using the current GR colormap. Use the x parameter to set the position of
577
609
  # the yz-slice.
578
610
  # Returns a mesh for the yz-slice.
579
- # @param grid [NArray] 3D narray array containing the voxel data
580
- # @param x [Numeric] the position of the slice through the xz-plane (0 to 1)
581
- # @param step [Array] voxel sizes in each direction
582
- # @param offset [Array] coordinate origin in each direction
611
+ #
612
+ # @param grid [NArray] 3D narray array containing the voxel data
613
+ # @param x [Numeric] the position of the slice through the xz-plane (0 to 1)
614
+ # @param step [Array, NArray] voxel sizes in each direction
615
+ # @param offset [Array, NArray] coordinate origin in each direction
583
616
  def createxslicemesh(grid, x = 0.5, step = nil, offset = nil)
584
617
  args = _preprocess_createslicemesh(grid, step, offset)
585
618
  grid = args.shift
@@ -593,10 +626,12 @@ module GR3
593
626
  # using the current GR colormap. Use the y parameter to set the position of
594
627
  # the xz-slice.
595
628
  # Returns a mesh for the xz-slice.
596
- # @param grid [NArray] 3D narray array containing the voxel data
597
- # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
598
- # @param step [Array] voxel sizes in each direction
599
- # @param offset [Array] coordinate origin in each direction
629
+ #
630
+ # @param grid [NArray] 3D narray array containing the voxel data
631
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
632
+ # @param step [Array, NArray] voxel sizes in each direction
633
+ # @param offset [Array, NArray] coordinate origin in each direction
634
+ #
600
635
  def createyslicemesh(grid, y = 0.5, step = nil, offset = nil)
601
636
  args = _preprocess_createslicemesh(grid, step, offset)
602
637
  grid = args.shift
@@ -610,10 +645,12 @@ module GR3
610
645
  # using the current GR colormap. Use the z parameter to set the position of
611
646
  # the xy-slice.
612
647
  # Returns a mesh for the xy-slice.
613
- # @param grid [NArray] 3D narray array containing the voxel data
614
- # @param z [Numeric] the position of the slice through the xz-plane (0 to 1)
615
- # @param step [Array] voxel sizes in each direction
616
- # @param offset [Array] coordinate origin in each direction
648
+ #
649
+ # @param grid [NArray] 3D narray array containing the voxel data
650
+ # @param z [Numeric] the position of the slice through the xz-plane (0 to 1)
651
+ # @param step [Array, NArray] voxel sizes in each direction
652
+ # @param offset [Array, NArray] coordinate origin in each direction
653
+ #
617
654
  def createzslicemesh(grid, z = 0.5, step = nil, offset = nil)
618
655
  args = _preprocess_createslicemesh(grid, step, offset)
619
656
  grid = args.shift
@@ -624,15 +661,18 @@ module GR3
624
661
  end
625
662
 
626
663
  # Draw a yz-slice through the given data, using the current GR colormap.
627
- # @param grid [NArray] 3D narray array containing the voxel data
628
- # @param x [Numeric] the position of the slice through the yz-plane (0 to 1)
629
- # @param step [Array] voxel sizes in each direction
630
- # @param offset [Array] coordinate origin in each direction
631
- # @param position [Array] the positions where the meshes should be drawn
632
- # @param direction [Array] the forward directions the meshes should be facing at
633
- # @param up [Array] the up directions
634
- # @param color [Array] the colors the meshes should be drawn in, it will be multiplied with each vertex color
635
- # @param scale [Array] the scaling factors
664
+ #
665
+ # @param grid [NArray] 3D narray array containing the voxel data
666
+ # @param x [Numeric] the position of the slice through the yz-plane (0 to 1)
667
+ # @param step [Array, NArray] voxel sizes in each direction
668
+ # @param offset [Array, NArray] coordinate origin in each direction
669
+ # @param position [Array, NArray] the positions where the meshes should be drawn
670
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
671
+ # @param up [Array, NArray] the up directions
672
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
673
+ # it will be multiplied with each vertex color
674
+ # @param scale [Array, NArray] the scaling factors
675
+ #
636
676
  def drawxslicemesh(grid, x = 0.5, step = nil, offset = nil,
637
677
  position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
638
678
  color = [1, 1, 1], scale = [1, 1, 1])
@@ -642,15 +682,18 @@ module GR3
642
682
  end
643
683
 
644
684
  # Draw a xz-slice through the given data, using the current GR colormap.
645
- # @param grid [NArray] 3D narray array containing the voxel data
646
- # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
647
- # @param step [Array] voxel sizes in each direction
648
- # @param offset [Array] coordinate origin in each direction
649
- # @param position [Array] the positions where the meshes should be drawn
650
- # @param direction [Array] the forward directions the meshes should be facing at
651
- # @param up [Array] the up directions
652
- # @param color [Array] the colors the meshes should be drawn in, it will be multiplied with each vertex color
653
- # @param scale [Array] the scaling factors
685
+ #
686
+ # @param grid [NArray] 3D narray array containing the voxel data
687
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
688
+ # @param step [Array, NArray] voxel sizes in each direction
689
+ # @param offset [Array, NArray] coordinate origin in each direction
690
+ # @param position [Array, NArray] the positions where the meshes should be drawn
691
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
692
+ # @param up [Array, NArray] the up directions
693
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
694
+ # it will be multiplied with each vertex color
695
+ # @param scale [Array, NArray] the scaling factors
696
+ #
654
697
  def drawyslicemesh(grid, y = 0.5, step = nil, offset = nil,
655
698
  position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
656
699
  color = [1, 1, 1], scale = [1, 1, 1])
@@ -660,15 +703,18 @@ module GR3
660
703
  end
661
704
 
662
705
  # Draw a xy-slice through the given data, using the current GR colormap.
663
- # @param grid [NArray] 3D narray array containing the voxel data
664
- # @param z [Numeric] the position of the slice through the xy-plane (0 to 1)
665
- # @param step [Array] voxel sizes in each direction
666
- # @param offset [Array] coordinate origin in each direction
667
- # @param position [Array] the positions where the meshes should be drawn
668
- # @param direction [Array] the forward directions the meshes should be facing at
669
- # @param up [Array] the up directions
670
- # @param color [Array] the colors the meshes should be drawn in, it will be multiplied with each vertex color
671
- # @param scale [Array] the scaling factors
706
+ #
707
+ # @param grid [NArray] 3D narray array containing the voxel data
708
+ # @param z [Numeric] the position of the slice through the xy-plane (0 to 1)
709
+ # @param step [Array, NArray] voxel sizes in each direction
710
+ # @param offset [Array, NArray] coordinate origin in each direction
711
+ # @param position [Array, NArray] the positions where the meshes should be drawn
712
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
713
+ # @param up [Array, NArray] the up directions
714
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
715
+ # it will be multiplied with each vertex color
716
+ # @param scale [Array, NArray] the scaling factors
717
+ #
672
718
  def drawzslicemesh(grid, z = 0.5, step = nil, offset = nil,
673
719
  position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
674
720
  color = [1, 1, 1], scale = [1, 1, 1])
@@ -681,17 +727,20 @@ module GR3
681
727
  # Use the parameters x, y or z to specify what slices should be drawn and at
682
728
  # which positions they should go through the data. If neither x nor y nor
683
729
  # z are set, 0.5 will be used for all three.
730
+ #
684
731
  # @param grid [NArray] 3D narray array containing the voxel data
685
- # @param x [Numeric] the position of the slice through the yz-plane (0 to 1)
686
- # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
687
- # @param z [Numeric] the position of the slice through the xy-plane (0 to 1)
688
- # @param step [Array] voxel sizes in each direction
689
- # @param offset [Array] coordinate origin in each direction
690
- # @param position [Array] the positions where the meshes should be drawn
691
- # @param direction [Array] the forward directions the meshes should be facing at
692
- # @param up [Array] the up directions
693
- # @param color [Array] the colors the meshes should be drawn in, it will be multiplied with each vertex color
694
- # @param scale [Array] the scaling factors
732
+ # @param x [Numeric] the position of the slice through the yz-plane (0 to 1)
733
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
734
+ # @param z [Numeric] the position of the slice through the xy-plane (0 to 1)
735
+ # @param step [Array, NArray] voxel sizes in each direction
736
+ # @param offset [Array, NArray] coordinate origin in each direction
737
+ # @param position [Array, NArray] the positions where the meshes should be drawn
738
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
739
+ # @param up [Array, NArray] the up directions
740
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
741
+ # it will be multiplied with each vertex color
742
+ # @param scale [Array, NArray] the scaling factors
743
+ #
695
744
  def drawslicemeshes(grid, x = nil, y = nil, z = nil, step = nil,
696
745
  offset = nil, position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
697
746
  color = [1, 1, 1], scale = [1, 1, 1])