ruby-gr 0.0.20 → 0.0.25

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/gr/ffi.rb CHANGED
@@ -15,7 +15,7 @@ module GR
15
15
  raise LoadError, 'Could not find GR Framework'
16
16
  end
17
17
 
18
- extend GRCommons::Extern
18
+ extend GRCommons::TryExtern
19
19
 
20
20
  # https://github.com/sciapp/gr/blob/master/lib/gr/gr.h
21
21
  # keep same order
@@ -41,6 +41,8 @@ module GR
41
41
  'int, int, int, int, int, int, int *)'
42
42
  try_extern 'void gr_polarcellarray(double, double, double, double, double, double, ' \
43
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 *);'
44
46
  try_extern 'void gr_gdp(int, double *, double *, int, int, int *)'
45
47
  try_extern 'void gr_spline(int, double *, double *, int, int)'
46
48
  try_extern 'void gr_gridit(int, double *, double *, double *, int, int, ' \
@@ -174,7 +176,7 @@ module GR
174
176
  try_extern 'void gr_shadepoints(int, double *, double *, int, int, int)'
175
177
  try_extern 'void gr_shadelines(int, double *, double *, int, int, int)'
176
178
  try_extern 'void gr_panzoom(double, double, double, double, double *, double *, double *, double *)'
177
- # try_extern 'int gr_findboundary(int, double *, double *, double, double (*)(double, double), int, int *)'
179
+ try_extern 'int gr_findboundary(int, double *, double *, double, double (*)(double, double), int, int *)'
178
180
  try_extern 'void gr_setresamplemethod(unsigned int flag)'
179
181
  try_extern 'void gr_inqresamplemethod(unsigned int *flag)'
180
182
  try_extern 'void gr_path(int, double *, double *, const char *)'
@@ -202,5 +204,6 @@ module GR
202
204
  try_extern 'void gr_inqtext3d(double, double, double, char *, int axis, double *, double *)'
203
205
  try_extern 'void gr_settextencoding(int)'
204
206
  try_extern 'void gr_inqtextencoding(int *)'
207
+ # gr_setcallback(char *(*)(const char *));
205
208
  end
206
209
  end
data/lib/gr/plot.rb CHANGED
@@ -38,12 +38,49 @@ module GR
38
38
 
39
39
  # Keyword options conform to GR.jl.
40
40
  KW_ARGS = %i[accelerate algorithm alpha ax backgroundcolor barwidth baseline
41
- clabels clear clim color colormap crange figsize grid horizontal
42
- isovalue kind label labels levels location nbins ratio rotation
43
- scale size spec subplot tilt title update xaxis xflip xform
44
- xlabel xlim xlog xrange xticks yaxis yflip ylabel ylim ylog
45
- zflip yrange yticks viewport vp where window zaxis zlabel zlim
46
- zlog zrange zticks].freeze
41
+ clabels clear clim color colormap crange figsize font grid
42
+ horizontal isovalue kind label labels levels location nbins
43
+ ratio rotation scale size spec subplot tilt title update xaxis
44
+ xflip xform xlabel xlim xlog xrange xticks yaxis yflip ylabel
45
+ ylim ylog zflip yrange yticks viewport vp where window zaxis
46
+ zlabel zlim zlog zrange zticks].freeze
47
+
48
+ FONTS = {
49
+ times_roman: 101,
50
+ times_italic: 102,
51
+ times_bold: 103,
52
+ times_bolditalic: 104,
53
+ helvetica_regular: 105,
54
+ helvetica_oblique: 106,
55
+ helvetica_bold: 107,
56
+ helvetica_boldoblique: 108,
57
+ courier_regular: 109,
58
+ courier_oblique: 110,
59
+ courier_bold: 111,
60
+ courier_boldoblique: 112,
61
+ symbol: 113,
62
+ bookman_light: 114,
63
+ bookman_lightitalic: 115,
64
+ bookman_demi: 116,
65
+ bookman_demiitalic: 117,
66
+ newcenturyschlbk_roman: 118,
67
+ newcenturyschlbk_italic: 119,
68
+ newcenturyschlbk_bold: 120,
69
+ newcenturyschlbk_bolditalic: 121,
70
+ avantgarde_book: 122,
71
+ avantgarde_bookoblique: 123,
72
+ avantgarde_demi: 124,
73
+ avantgarde_demioblique: 125,
74
+ palatino_roman: 126,
75
+ palatino_italic: 127,
76
+ palatino_bold: 128,
77
+ palatino_bolditalic: 129,
78
+ zapfchancery_mediumitalic: 130,
79
+ zapfdingbats: 131,
80
+ cmuserif_math: 232, # original: cmuserif-math
81
+ dejavusans: 233,
82
+ pingfangsc: 234
83
+ }.freeze
47
84
 
48
85
  @last_plot = nil
49
86
  class << self
@@ -62,7 +99,7 @@ module GR
62
99
  # label(singular form) is a original keyword arg which GR.jl does not have.
63
100
  kvs[:labels] ||= [kvs[:label]] if kvs.has_key? :label
64
101
 
65
- # Don't use || because we need to tell `false` from `nil`
102
+ # Don't use ||= here, because we need to tell `false` from `nil`
66
103
  kvs[:size] = [600, 450] unless kvs.has_key? :size
67
104
  kvs[:ax] = false unless kvs.has_key? :ax
68
105
  kvs[:subplot] = [0, 1, 0, 1] unless kvs.has_key? :subplot
@@ -185,8 +222,12 @@ module GR
185
222
  minmax
186
223
  end
187
224
 
188
- major_count = %i[wireframe surface plot3 scatter3 polar polarhist
189
- polarheatmap trisurf volume].include?(kind) ? 2 : 5
225
+ major_count = if %i[wireframe surface plot3 scatter3 polar polarhist
226
+ polarheatmap trisurf volume].include?(kind)
227
+ 2
228
+ else
229
+ 5
230
+ end
190
231
 
191
232
  kvs[:xticks] = [kvs[:xticks], major_count] if kvs[:xticks].is_a? Numeric
192
233
  kvs[:yticks] = [kvs[:yticks], major_count] if kvs[:yticks].is_a? Numeric
@@ -198,10 +239,10 @@ module GR
198
239
  xmax += 0.5
199
240
  end
200
241
  xtick, majorx = if (scale & GR::OPTION_X_LOG) == 0
201
- unless %i[heatmap polarheatmap].include?(kind)
202
- unless kvs.has_key?(:xlim)
203
- xmin, xmax = GR.adjustlimits(xmin, xmax) unless kvs[:panzoom]
204
- end
242
+ if !%i[heatmap polarheatmap].include?(kind) &&
243
+ !kvs.has_key?(:xlim) &&
244
+ !kvs[:panzoom]
245
+ xmin, xmax = GR.adjustlimits(xmin, xmax)
205
246
  end
206
247
  if kvs.has_key?(:xticks)
207
248
  kvs[:xticks]
@@ -227,10 +268,10 @@ module GR
227
268
  end
228
269
  end
229
270
  ytick, majory = if (scale & GR::OPTION_Y_LOG) == 0
230
- unless %i[heatmap polarheatmap].include?(kind)
231
- unless kvs.has_key?(:ylim)
232
- ymin, ymax = GR.adjustlimits(ymin, ymax) unless kvs[:panzoom]
233
- end
271
+ if !%i[heatmap polarheatmap].include?(kind) &&
272
+ !kvs.has_key?(:ylim) &&
273
+ !kvs[:panzoom]
274
+ ymin, ymax = GR.adjustlimits(ymin, ymax)
234
275
  end
235
276
  if kvs.has_key?(:yticks)
236
277
  kvs[:yticks]
@@ -341,29 +382,29 @@ module GR
341
382
  GR.axes(xtick, ytick, xorg[1], yorg[1], -majorx, -majory, -ticksize)
342
383
  end
343
384
 
344
- if kvs[:title]
385
+ if kvs.has_key?(:title)
345
386
  GR.savestate
346
387
  GR.settextalign(GR::TEXT_HALIGN_CENTER, GR::TEXT_VALIGN_TOP)
347
- text(0.5 * (viewport[0] + viewport[1]), vp[3], kvs[:title])
388
+ text(0.5 * (viewport[0] + viewport[1]), vp[3], kvs[:title].to_s)
348
389
  GR.restorestate
349
390
  end
350
391
  if %i[wireframe surface plot3 scatter3 trisurf volume].include?(kind)
351
- xlabel = kvs[:xlabel] || ''
352
- ylabel = kvs[:ylabel] || ''
353
- zlabel = kvs[:zlabel] || ''
392
+ xlabel = (kvs[:xlabel] || '').to_s
393
+ ylabel = (kvs[:ylabel] || '').to_s
394
+ zlabel = (kvs[:zlabel] || '').to_s
354
395
  GR.titles3d(xlabel, ylabel, zlabel)
355
396
  else
356
397
  if kvs.has_key?(:xlabel)
357
398
  GR.savestate
358
399
  GR.settextalign(GR::TEXT_HALIGN_CENTER, GR::TEXT_VALIGN_BOTTOM)
359
- text(0.5 * (viewport[0] + viewport[1]), vp[2] + 0.5 * charheight, kvs[:xlabel])
400
+ text(0.5 * (viewport[0] + viewport[1]), vp[2] + 0.5 * charheight, kvs[:xlabel].to_s)
360
401
  GR.restorestate
361
402
  end
362
403
  if kvs.has_key?(:ylabel)
363
404
  GR.savestate
364
405
  GR.settextalign(GR::TEXT_HALIGN_CENTER, GR::TEXT_VALIGN_TOP)
365
406
  GR.setcharup(-1, 0)
366
- text(vp[0] + 0.5 * charheight, 0.5 * (viewport[2] + viewport[3]), kvs[:ylabel])
407
+ text(vp[0] + 0.5 * charheight, 0.5 * (viewport[2] + viewport[3]), kvs[:ylabel].to_s)
367
408
  GR.restorestate
368
409
  end
369
410
  end
@@ -471,7 +512,7 @@ module GR
471
512
  if kvs.has_key?(:title)
472
513
  GR.savestate
473
514
  GR.settextalign(GR::TEXT_HALIGN_CENTER, GR::TEXT_VALIGN_TOP)
474
- text(0.5 * (viewport[0] + viewport[1]), vp[3], kvs[:title])
515
+ text(0.5 * (viewport[0] + viewport[1]), vp[3], kvs[:title].to_s)
475
516
  GR.restorestate
476
517
  end
477
518
  GR.selntran(1)
@@ -573,7 +614,22 @@ module GR
573
614
  # Not yet.
574
615
  end
575
616
 
576
- GR.settextfontprec(232, 3)
617
+ if kvs.has_key?(:font)
618
+ name = kvs[:font]
619
+ # 'Cmuserif-Math' => :cmuserif_math
620
+ sym_name = name.to_s.gsub('-', '_').downcase.to_sym
621
+ if FONTS.include?(sym_name)
622
+ font = FONTS[sym_name]
623
+ GR.settextfontprec(font, font > 200 ? 3 : 0)
624
+ else
625
+ warn "Unknown font name: #{name}" # should raise error?
626
+ end
627
+ else
628
+ # The following fonts are the default in GR.jl
629
+ # Japanese, Chinese, Korean, etc. cannot be displayed.
630
+
631
+ # GR.settextfontprec(232, 3) # CM Serif Roman
632
+ end
577
633
 
578
634
  set_viewport(kind, kvs[:subplot])
579
635
  unless kvs[:ax]
@@ -641,8 +697,7 @@ module GR
641
697
  if z || c
642
698
  if c
643
699
  cmin, cmax = kvs[:crange]
644
- c = c.to_a if narray?(c)
645
- c.map! { |i| normalize_color(i, cmin, cmax) }
700
+ c = c.map { |i| normalize_color(i, cmin, cmax) }
646
701
  cind = c.map { |i| (1000 + i * 255).round }
647
702
  end
648
703
  x.length.times do |i|
@@ -743,9 +798,10 @@ module GR
743
798
  else
744
799
  h = levels
745
800
  end
746
- if kind == :contour
801
+ case kind
802
+ when :contour
747
803
  GR._contour_(x, y, h, z, clabels ? 1 : 1000)
748
- elsif kind == :contourf
804
+ when :contourf
749
805
  GR._contourf_(x, y, h, z, clabels ? 1 : 0)
750
806
  end
751
807
  colorbar(0, h.length)
@@ -834,7 +890,7 @@ module GR
834
890
  GR.setmarkertype(GR::MARKERTYPE_SOLID_CIRCLE)
835
891
  if c
836
892
  cmin, cmax = kvs[:crange]
837
- c = c.map { |i| normalize_color(i, cmin, cmax) } # NArray -> Array
893
+ c = c.map { |i| normalize_color(i, cmin, cmax) }
838
894
  cind = c.map { |i| (1000 + i * 255).round }
839
895
  x.length.times do |i|
840
896
  GR.setmarkercolorind(cind[i])
@@ -1040,13 +1096,16 @@ module GR
1040
1096
 
1041
1097
  # Normalize a color c with the range [cmin, cmax]
1042
1098
  # 0 <= normalize_color(c, cmin, cmax) <= 1
1099
+ # Note: narray.map{|i| normalize_color(i)} There's room for speedup.
1043
1100
  def normalize_color(c, cmin, cmax)
1101
+ c = c.to_f # if c is Integer
1044
1102
  c = c.clamp(cmin, cmax) - cmin
1045
1103
  c /= (cmax - cmin) if cmin != cmax
1046
1104
  c
1047
1105
  end
1048
1106
 
1049
1107
  def inqtext(x, y, s)
1108
+ s = s.to_s
1050
1109
  if s.length >= 2 && s[0] == '$' && s[-1] == '$'
1051
1110
  GR.inqmathtex(x, y, s[1..-2])
1052
1111
  elsif s.include?('\\') || s.include?('_') || s.include?('^')
@@ -1057,6 +1116,7 @@ module GR
1057
1116
  end
1058
1117
 
1059
1118
  def text(x, y, s)
1119
+ s = s.to_s
1060
1120
  if s.length >= 2 && s[0] == '$' && s[-1] == '$'
1061
1121
  GR.mathtex(x, y, s[1..-2])
1062
1122
  elsif s.include?('\\') || s.include?('_') || s.include?('^')
@@ -1156,20 +1216,12 @@ module GR
1156
1216
  [w, h]
1157
1217
  end
1158
1218
 
1159
- # NOTE: duplicated definition (GRCommonUtils)
1160
1219
  def equal_length(*args)
1161
- lengths = args.map(&:length)
1162
- unless lengths.all? { |l| l == lengths[0] }
1163
- raise ArgumentError,
1164
- 'Sequences must have same length.'
1165
- end
1166
-
1167
- lengths[0]
1220
+ GRCommons::GRCommonUtils.equal_length(*args)
1168
1221
  end
1169
1222
 
1170
- # NOTE: duplicated definition (GRCommonUtils)
1171
1223
  def narray?(data)
1172
- defined?(Numo::NArray) && data.is_a?(Numo::NArray)
1224
+ GRCommons::GRCommonUtils.narray?(data)
1173
1225
  end
1174
1226
  end
1175
1227
 
data/lib/gr3.rb CHANGED
@@ -40,47 +40,52 @@
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
56
58
  module GR3
57
59
  class Error < StandardError; end
58
60
 
61
+ class NotFoundError < Error; end
62
+
59
63
  class << self
60
64
  attr_accessor :ffi_lib
61
65
  end
62
66
 
67
+ require_relative 'gr_commons/gr_commons'
68
+
63
69
  # Platforms | path
64
70
  # Windows | bin/libGR3.dll
65
- # MacOSX | lib/libGR3.so (NOT .dylib)
71
+ # MacOSX | lib/libGR3.dylib (v0.53.0 .so)
66
72
  # 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
73
+ platform = RbConfig::CONFIG['host_os']
74
+ lib_names, pkg_name = \
75
+ case platform
76
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
77
+ [['libGR3.dll'], 'gr3']
78
+ when /darwin|mac os/
79
+ [['libGR3.dylib', 'libGR3.so'], 'gr3']
80
+ else
81
+ [['libGR3.so'], 'gr3']
82
+ end
83
+ lib_path = GRCommons::GRLib.search(lib_names, pkg_name)
79
84
 
80
- # change the default encoding to UTF-8.
81
- ENV['GKS_ENCODING'] ||= 'utf8'
85
+ raise NotFoundError, "#{lib_names} not found" if lib_path.nil?
86
+
87
+ self.ffi_lib = lib_path
82
88
 
83
- require_relative 'gr_commons/gr_commons'
84
89
  require_relative 'gr3/version'
85
90
  require_relative 'gr3/ffi'
86
91
  require_relative 'gr3/gr3base'
@@ -124,70 +129,82 @@ module GR3
124
129
  end
125
130
  extend CheckError
126
131
 
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
132
  class << self
130
133
  # This method initializes the gr3 context.
134
+ #
131
135
  # @return [Integer]
132
- def gr3_init(*)
133
- super
134
- end
136
+ #
137
+ # @!method gr3_init
135
138
 
136
- def free(*)
137
- super
138
- end
139
+ # @!method free
139
140
 
140
141
  # This function terminates the gr3 context.
141
- def terminate(*)
142
- super
143
- end
142
+ #
143
+ # After calling this function, gr3 is in the same state as when it was first
144
+ # loaded, except for context-independent variables, i.e. the logging callback.
145
+ #
146
+ # @!method terminate
144
147
 
145
- # @!method geterror
148
+ # @note This method is defined in the CheckError module.
149
+ #
146
150
  # This function returns information on the most recent GR3 error.
151
+ #
147
152
  # @return [Integer]
148
- # @note This method is defined in the CheckError module.
153
+ #
154
+ # @!method geterror
149
155
 
150
156
  # This function allows the user to find out how his commands are rendered.
157
+ #
151
158
  # 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.
159
+ # `"gr3 - " + window toolkit + " - " + framebuffer extension + " - "
160
+ # + OpenGL version + " - " + OpenGL renderer string`.
161
+ # For example
162
+ # `"gr3 - GLX - GL_ARB_framebuffer_object - 2.1 Mesa 7.10.2 - Software Rasterizer"`
163
+ # might be returned on a Linux system (using GLX) with an available
164
+ # GL_ARB_framebuffer_object implementation.
155
165
  # If gr3 is not initialized `"Not initialized"` is returned.
166
+ #
156
167
  # @return [String]
168
+ #
157
169
  def getrenderpathstring(*)
158
170
  super.to_s
159
171
  end
160
172
 
161
173
  # This function returns a string representation of a given error code.
174
+ #
162
175
  # @return [String]
176
+ #
163
177
  def geterrorstring(*)
164
178
  super.to_s
165
179
  end
166
180
 
167
181
  # This function clears the draw list.
182
+ #
168
183
  # @return [Integer]
169
- def clear(*)
170
- super
171
- end
184
+ #
185
+ # @!method clear
172
186
 
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
187
+ # Use the currently bound framebuffer as the framebuffer used for drawing to
188
+ # OpenGL (using gr3.drawimage).
189
+ # This function is only needed when you do not want to render to 0, the
190
+ # default framebuffer.
191
+ #
192
+ # @!method usecurrentframebuffer
178
193
 
179
194
  # 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
195
+ #
196
+ # This function is only needed when you do not want to render to 0, the
197
+ # default framebuffer.
198
+ #
199
+ # @!method useframebuffer
184
200
 
185
201
  # Set rendering quality
202
+ #
186
203
  # @param quality [] The quality to set
204
+ #
187
205
  # @return [Integer]
188
- def setquality(*)
189
- super
190
- end
206
+ #
207
+ # @!method setquality
191
208
 
192
209
  # @return [Integer]
193
210
  def getimage(width, height, use_alpha = true)
@@ -198,31 +215,31 @@ module GR3
198
215
  end
199
216
 
200
217
  # @return [Integer]
201
- def export(*)
202
- super
203
- end
218
+ # @!method export
204
219
 
205
220
  # @return [Integer]
206
- def drawimage(*)
207
- super
208
- end
221
+ # @!method drawimage
209
222
 
210
- # createmesh_nocopy
223
+ # This function creates a mesh from vertex position, normal and color data.
224
+ #
211
225
  # @return [Integer]
212
- def createmesh_nocopy(_n, vertices, normals, colors)
226
+ def createmesh_nocopy(n, vertices, normals, colors)
213
227
  inquiry_int do |mesh|
214
- super(mesh, vertices, normals, colors)
228
+ super(mesh, n, vertices, normals, colors)
215
229
  end
216
230
  end
217
231
 
218
232
  # This function creates a int from vertex position, normal and color data.
219
233
  # Returns a mesh.
220
- # @param n [Integer] the number of vertices in the mesh
234
+ #
235
+ # @param n [Integer] the number of vertices in the mesh
221
236
  # @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
237
+ # @param normals [Array, NArray] the vertex normals
238
+ # @param colors [Array, NArray] the vertex colors, they should be
239
+ # white (1,1,1) if you want to change the color for each drawn mesh
240
+ #
225
241
  # @return [Integer]
242
+ #
226
243
  def createmesh(n, vertices, normals, colors)
227
244
  inquiry_int do |mesh|
228
245
  super(mesh, n, vertices, normals, colors)
@@ -230,6 +247,7 @@ module GR3
230
247
  end
231
248
 
232
249
  # This function creates a mesh from vertex position, normal and color data.
250
+ #
233
251
  # @return [Integer]
234
252
  def createindexedmesh_nocopy(num_vertices, vertices, normals, colors, num_indices, indices)
235
253
  inquiry_int do |mesh|
@@ -240,150 +258,159 @@ module GR3
240
258
  # This function creates an indexed mesh from vertex information (position,
241
259
  # normal and color) and triangle information (indices).
242
260
  # 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)
261
+ #
262
+ # @param num_vertices [Integer] the number of vertices in the mesh
263
+ # @param vertices [Array, NArray] the vertex positions
264
+ # @param normals [Array, NArray] the vertex normals
265
+ # @param colors [Array, NArray] the vertex colors, they should be
266
+ # white (1,1,1) if you want to change
267
+ # the color for each drawn mesh
268
+ # @param num_indices [Integer] the number of indices in the mesh
269
+ # (three times the number of triangles)
270
+ # @param indices [Array, NArray] the index array (vertex indices for
271
+ # each triangle)
272
+ #
250
273
  # @return [Integer]
274
+ #
251
275
  def createindexedmesh(num_vertices, vertices, normals, colors, num_indices, indices)
252
276
  inquiry_int do |mesh|
253
277
  super(mesh, num_vertices, vertices, normals, colors, num_indices, indices)
254
278
  end
255
279
  end
256
280
 
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
281
+ # This function adds a mesh to the draw list, so it will be drawn when the
282
+ # user calls getpixmap. The given data stays owned by the user, a copy will
283
+ # be saved in the draw list and the mesh reference counter will be increased.
284
+ #
285
+ # This function does not return an error code, because of its asynchronous
286
+ # nature. If gr3_getpixmap_() returns a GR3_ERROR_OPENGL_ERR, this might be
287
+ # caused by this function saving unuseable data into the draw list.
288
+ #
289
+ # @param mesh [Integer] The mesh to be drawn
290
+ # @param n [Integer] The number of meshes to be drawn
291
+ # @param positions [Array, NArray] The positions where the meshes should be drawn
262
292
  # @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.
293
+ # @param ups [Array, NArray] The up directions
294
+ # @param colors [Array, NArray] The colors the meshes should be drawn in,
295
+ # it will be multiplied with each vertex color
296
+ # @param scales [Array, NArray] The scaling factors
297
+ #
298
+ # @!method drawmesh
299
+
300
+ # This function marks a mesh for deletion and removes the user’s reference
301
+ # from the mesh’s referenc counter, so a user must not use the mesh after
302
+ # calling this function.
303
+ #
272
304
  # @param mesh [Integer] The mesh that should be marked for deletion
273
- def deletemesh(*)
274
- super
275
- end
305
+ #
306
+ # @!method deletemesh
276
307
 
277
308
  # This function sets the view matrix by getting the position of the camera,
278
309
  # the position of the center of focus and the direction which should point up.
310
+ # This function takes effect when the next image is created. Therefore if
311
+ # you want to take pictures of the same data from different perspectives,
312
+ # you can call and gr3_cameralookat(), gr3_getpixmap_(), gr3_cameralookat(),
313
+ # gr3_getpixmap_(), … without calling gr3_clear() and gr3_drawmesh() again.
314
+ #
279
315
  # @param camera_x [Array, NArray] The x-coordinate of the camera
280
316
  # @param camera_y [Array, NArray] The y-coordinate of the camera
281
317
  # @param camera_z [Array, NArray] The z-coordinate of the camera
282
318
  # @param center_x [Array, NArray] The x-coordinate of the center of focus
283
319
  # @param center_y [Array, NArray] The y-coordinate of the center of focus
284
320
  # @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
321
+ # @param up_x [Array, NArray] The x-component of the up direction
322
+ # @param up_y [Array, NArray] The y-component of the up direction
323
+ # @param up_z [Array, NArray] The z-component of the up direction
324
+ #
325
+ # @!method cameralookat
291
326
 
292
327
  # This function sets the projection parameters.
293
328
  # 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.
329
+ #
330
+ # The ratio between zFar and zNear influences the precision of the depth
331
+ # buffer, the greater (zFar/zNear), the more likely are errors. So you should
332
+ # try to keep both values as close to each other as possible while making
333
+ # sure everything you want to be visible, is visible.
334
+ #
335
+ # @param vertical_field_of_view [Numeric]
336
+ # This parameter is the vertical field of view in degrees.
337
+ # It must be greater than 0 and less than 180.
296
338
  # @param zNear [Numeric] The distance to the near clipping plane.
297
- # @param zFar [Numeric] The distance to the far clipping plane.
339
+ # @param zFar [Numeric] The distance to the far clipping plane.
340
+ #
298
341
  # @return [Integer]
299
- def setcameraprojectionparameters(*)
300
- super
301
- end
342
+ #
343
+ # @!method setcameraprojectionparameters
302
344
 
303
345
  # Get the projection parameters.
346
+ #
347
+ # @param vfov [Array, NArray] Vertical field of view in degrees
348
+ # @param znear [Array, NArray] The distance to the near clipping plane.
349
+ # @param zfar [Array, NArray] The distance to the far clipping plane.
350
+ #
304
351
  # @return [Integer]
305
- def getcameraprojectionparameters(*)
306
- super
307
- end
352
+ #
353
+ # @!method getcameraprojectionparameters
308
354
 
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.
355
+ # This function sets the direction of light. If it is called with (0, 0, 0),
356
+ # the light is always pointing into the same direction as the camera.
357
+ #
311
358
  # @param x [Numeric] The x-component of the light's direction
312
359
  # @param y [Numeric] The y-component of the light's direction
313
360
  # @param z [Numeric] The z-component of the light's direction
314
- def setlightdirection(*)
315
- super
316
- end
361
+ #
362
+ # @!method setlightdirection
317
363
 
318
364
  # This function sets the background color.
319
- def setbackgroundcolor(*)
320
- super
321
- end
365
+ # @!method setbackgroundcolor
322
366
 
323
367
  # @return [Integer]
324
- def createheightmapmesh(*)
325
- super
326
- end
368
+ # @!method createheightmapmesh
327
369
 
328
- def drawheightmap(*)
329
- super
330
- end
370
+ # @!method drawheightmap
331
371
 
332
372
  # This function allows drawing a cylinder without requiring a mesh.
333
- def drawconemesh(*)
334
- super
335
- end
373
+ # @!method drawconemesh
336
374
 
337
375
  # This function allows drawing a cylinder without requiring a mesh.
338
- def drawcylindermesh(*)
339
- super
340
- end
376
+ # @!method drawcylindermesh
341
377
 
342
378
  # This function allows drawing a sphere without requiring a mesh.
343
- def drawspheremesh(*)
344
- super
345
- end
379
+ # @!method drawspheremesh
346
380
 
347
- def drawcubemesh(*)
348
- super
349
- end
381
+ # @!method drawcubemesh
350
382
 
351
- def setobjectid(*)
352
- super
353
- end
383
+ # @!method setobjectid
354
384
 
355
385
  # @return [Integer]
356
- def selectid(*)
357
- super
358
- end
386
+ # @!method selectid
359
387
 
360
- def getviewmatrix(*)
361
- super
362
- end
388
+ # @param m [Array, NArray] the 4x4 column major view matrix
389
+ # @!method getviewmatrix
363
390
 
364
- def setviewmatrix(*)
365
- super
366
- end
391
+ # @param m [Array, NArray] the 4x4 column major view matrix
392
+ # @!method setviewmatrix
367
393
 
368
- # the current projection type: GR3_PROJECTION_PERSPECTIVE or GR3_PROJECTION_PARALLEL
369
394
  # @return [Integer]
370
- def getprojectiontype(*)
371
- super
372
- end
395
+ # the current projection type: GR3_PROJECTION_PERSPECTIVE or GR3_PROJECTION_PARALLEL
396
+ # @!method getprojectiontype
373
397
 
374
- # @param type [Integer] the new projection type: GR3_PROJECTION_PERSPECTIVE or GR3_PROJECTION_PARALLEL
375
- def setprojectiontype(*)
376
- super
377
- end
398
+ # @param type [Integer]
399
+ # the new projection type: GR3_PROJECTION_PERSPECTIVE,
400
+ # GR3_PROJECTION_PARALLEL or GR3_PROJECTION_ORTHOGRAPHIC
401
+ # @!method setprojectiontype
378
402
 
379
403
  # This function creates an isosurface from voxel data using the
380
404
  # marching cubes algorithm.
381
405
  # 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
406
+ #
407
+ # @param grid [NArray] 3D narray array containing the voxel data
408
+ # @param step [Array, NArray] voxel sizes in each direction
409
+ # @param offset [Array, NArray] coordinate origin in each direction
410
+ # @param isolevel [Integer] isovalue at which the surface will be created
411
+ #
386
412
  # @return [Integer]
413
+ #
387
414
  def createisosurfacemesh(grid, step, offset, isolevel)
388
415
  args = _preprocess_createslicemesh(grid, step, offset)
389
416
  grid = args.shift
@@ -395,10 +422,11 @@ module GR3
395
422
  # Create a mesh of a surface plot similar to gr_surface.
396
423
  # Uses the current colormap. To apply changes of the colormap
397
424
  # 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
425
+ #
426
+ # @param nx [Integer] number of points in x-direction
427
+ # @param ny [Integer] number of points in y-direction
428
+ # @param x [Array, NArray] an array containing the x-coordinates
429
+ # @param y [Array, NArray] an array containing the y-coordinates
402
430
  # @param z [Array, NArray] an array of length nx * ny containing the z-coordinates
403
431
  # @param option [Integer] option for the surface mesh; the GR3_SURFACE constants can be combined with bitwise or. See the table below.
404
432
  # * 0 : GR3_SURFACE_DEFAULT
@@ -413,6 +441,7 @@ module GR3
413
441
  # * color the surface according to the current gr colormap
414
442
  # * 16 : GR3_SURFACE_GRZSHADED
415
443
  # * like GR3_SURFACE_GRCOLOR, but use the z-value directly as color index
444
+ #
416
445
  # @return [Integer]
417
446
  def createsurfacemesh(nx, ny, x, y, z, option = 0)
418
447
  inquiry_int do |mesh|
@@ -426,29 +455,32 @@ module GR3
426
455
  # the viewmatrix and the light direction. If necessary, the user has to
427
456
  # save them before the call to this function and restore them after
428
457
  # 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
458
+ #
459
+ # @param mesh [Integer] the mesh to be drawn
460
+ # @param n [Integer] the number of meshes to be drawn
461
+ # @param positions [Array, NArray] the positions where the meshes should be drawn
432
462
  # @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
463
+ # @param ups [Array, NArray] the up directions
464
+ # @param colors [Array, NArray] the colors the meshes should be drawn in,
465
+ # it will be multiplied with each vertex color
466
+ # @param scales [Array, NArray] the scaling factors
467
+ #
468
+ # @!method drawmesh_grlike
439
469
 
440
470
  # Convenience function for drawing a surfacemesh.
471
+ #
441
472
  # @param mesh [Integer] the mesh to be drawn
442
- def drawsurface(*)
443
- super
444
- end
473
+ #
474
+ # @!method drawsurface
445
475
 
446
476
  # 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.
477
+ #
478
+ # @param x [Array, NArray] an array containing the x-coordinates
479
+ # @param y [Array, NArray] an array containing the y-coordinates
480
+ # @param z [Array, NArray] an array of length nx * ny containing the z-coordinates
481
+ # @param option [Integer] see the option parameter of gr_surface.
482
+ # OPTION_COLORED_MESH and OPTION_Z_SHADED_MESH are supported.
483
+ #
452
484
  def surface(x, y, z, option)
453
485
  nx = x.length
454
486
  ny = y.length
@@ -456,17 +488,20 @@ module GR3
456
488
  super(nx, ny, x, y, z, option)
457
489
  end
458
490
 
459
- # drawtubemesh
460
491
  # Draw a tube following a path given by a list of points. The colors and
461
492
  # radii arrays specify the color and radius at each point.
462
- # @param n [Integer] the number of points given
493
+ #
494
+ # @param n [Integer] the number of points given
463
495
  # @param points [Array, NArray] the points the tube should go through
464
496
  # @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
497
+ # @param radii [Array, NArray] the desired tube radius at each point
498
+ # @param num_steps [Integer] the number of steps between each point,
499
+ # allowing for a more smooth tube
500
+ # @param num_segments [Integer] the number of segments each ring of the tube
501
+ # consists of, e.g. 3 would yield a triangular tube
502
+ #
469
503
  # @return [Integer]
504
+ #
470
505
  def drawtubemesh(n, points, colors, radii, num_steps = 10, num_segments = 20)
471
506
  super(n, points, colors, radii, num_steps, num_segments)
472
507
  end
@@ -474,12 +509,17 @@ module GR3
474
509
  # Create a mesh object in the shape of a tube following a path given by a
475
510
  # list of points. The colors and radii arrays specify the color and radius at
476
511
  # 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
512
+ #
513
+ # @param n [Integer] the number of points given
514
+ # @param points [Array, NArray] the points the tube should go through
515
+ # @param colors [Array, NArray] the color at each point
516
+ # @param radii [Array, NArray] the desired tube radius at each point
517
+ # @param num_steps [Integer] the number of steps between each point,
518
+ # allowing for a more smooth tube
519
+ # @param num_segments [Integer] the number of segments each ring of the
520
+ # tube consists of, e.g. 3 would yield a
521
+ # triangular tube
522
+ #
483
523
  # @return [Integer]
484
524
  def createtubemesh(n, points, colors, radii, num_steps = 10, num_segments = 20)
485
525
  inquiry_uint do |mesh| # mesh should be Int?
@@ -554,12 +594,14 @@ module GR3
554
594
  # drawn and at which positions they should go through the data. If neither
555
595
  # x nor y nor z are set, 0.5 will be used for all three.
556
596
  # 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
597
+ #
598
+ # @param grid [NArray] 3D narray array containing the voxel data
599
+ # @param x [Numeric] the position of the slice through the xz-plane (0 to 1)
600
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
601
+ # @param z [Numeric] the position of the slice through the xz-plane (0 to 1)
602
+ # @param step [Array, NArray] voxel sizes in each direction
603
+ # @param offset [Array, NArray] coordinate origin in each direction
604
+ #
563
605
  def createslicemeshes(grid, x = nil, y = nil, z = nil, step = nil, offset = nil)
564
606
  if [x, y, z].all?(&:nil?)
565
607
  x = 0.5
@@ -576,10 +618,11 @@ module GR3
576
618
  # using the current GR colormap. Use the x parameter to set the position of
577
619
  # the yz-slice.
578
620
  # 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
621
+ #
622
+ # @param grid [NArray] 3D narray array containing the voxel data
623
+ # @param x [Numeric] the position of the slice through the xz-plane (0 to 1)
624
+ # @param step [Array, NArray] voxel sizes in each direction
625
+ # @param offset [Array, NArray] coordinate origin in each direction
583
626
  def createxslicemesh(grid, x = 0.5, step = nil, offset = nil)
584
627
  args = _preprocess_createslicemesh(grid, step, offset)
585
628
  grid = args.shift
@@ -593,10 +636,12 @@ module GR3
593
636
  # using the current GR colormap. Use the y parameter to set the position of
594
637
  # the xz-slice.
595
638
  # 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
639
+ #
640
+ # @param grid [NArray] 3D narray array containing the voxel data
641
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
642
+ # @param step [Array, NArray] voxel sizes in each direction
643
+ # @param offset [Array, NArray] coordinate origin in each direction
644
+ #
600
645
  def createyslicemesh(grid, y = 0.5, step = nil, offset = nil)
601
646
  args = _preprocess_createslicemesh(grid, step, offset)
602
647
  grid = args.shift
@@ -610,10 +655,12 @@ module GR3
610
655
  # using the current GR colormap. Use the z parameter to set the position of
611
656
  # the xy-slice.
612
657
  # 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
658
+ #
659
+ # @param grid [NArray] 3D narray array containing the voxel data
660
+ # @param z [Numeric] the position of the slice through the xz-plane (0 to 1)
661
+ # @param step [Array, NArray] voxel sizes in each direction
662
+ # @param offset [Array, NArray] coordinate origin in each direction
663
+ #
617
664
  def createzslicemesh(grid, z = 0.5, step = nil, offset = nil)
618
665
  args = _preprocess_createslicemesh(grid, step, offset)
619
666
  grid = args.shift
@@ -624,15 +671,18 @@ module GR3
624
671
  end
625
672
 
626
673
  # 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
674
+ #
675
+ # @param grid [NArray] 3D narray array containing the voxel data
676
+ # @param x [Numeric] the position of the slice through the yz-plane (0 to 1)
677
+ # @param step [Array, NArray] voxel sizes in each direction
678
+ # @param offset [Array, NArray] coordinate origin in each direction
679
+ # @param position [Array, NArray] the positions where the meshes should be drawn
680
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
681
+ # @param up [Array, NArray] the up directions
682
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
683
+ # it will be multiplied with each vertex color
684
+ # @param scale [Array, NArray] the scaling factors
685
+ #
636
686
  def drawxslicemesh(grid, x = 0.5, step = nil, offset = nil,
637
687
  position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
638
688
  color = [1, 1, 1], scale = [1, 1, 1])
@@ -642,15 +692,18 @@ module GR3
642
692
  end
643
693
 
644
694
  # 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
695
+ #
696
+ # @param grid [NArray] 3D narray array containing the voxel data
697
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
698
+ # @param step [Array, NArray] voxel sizes in each direction
699
+ # @param offset [Array, NArray] coordinate origin in each direction
700
+ # @param position [Array, NArray] the positions where the meshes should be drawn
701
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
702
+ # @param up [Array, NArray] the up directions
703
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
704
+ # it will be multiplied with each vertex color
705
+ # @param scale [Array, NArray] the scaling factors
706
+ #
654
707
  def drawyslicemesh(grid, y = 0.5, step = nil, offset = nil,
655
708
  position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
656
709
  color = [1, 1, 1], scale = [1, 1, 1])
@@ -660,15 +713,18 @@ module GR3
660
713
  end
661
714
 
662
715
  # 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
716
+ #
717
+ # @param grid [NArray] 3D narray array containing the voxel data
718
+ # @param z [Numeric] the position of the slice through the xy-plane (0 to 1)
719
+ # @param step [Array, NArray] voxel sizes in each direction
720
+ # @param offset [Array, NArray] coordinate origin in each direction
721
+ # @param position [Array, NArray] the positions where the meshes should be drawn
722
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
723
+ # @param up [Array, NArray] the up directions
724
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
725
+ # it will be multiplied with each vertex color
726
+ # @param scale [Array, NArray] the scaling factors
727
+ #
672
728
  def drawzslicemesh(grid, z = 0.5, step = nil, offset = nil,
673
729
  position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
674
730
  color = [1, 1, 1], scale = [1, 1, 1])
@@ -681,17 +737,20 @@ module GR3
681
737
  # Use the parameters x, y or z to specify what slices should be drawn and at
682
738
  # which positions they should go through the data. If neither x nor y nor
683
739
  # z are set, 0.5 will be used for all three.
740
+ #
684
741
  # @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
742
+ # @param x [Numeric] the position of the slice through the yz-plane (0 to 1)
743
+ # @param y [Numeric] the position of the slice through the xz-plane (0 to 1)
744
+ # @param z [Numeric] the position of the slice through the xy-plane (0 to 1)
745
+ # @param step [Array, NArray] voxel sizes in each direction
746
+ # @param offset [Array, NArray] coordinate origin in each direction
747
+ # @param position [Array, NArray] the positions where the meshes should be drawn
748
+ # @param direction [Array, NArray] the forward directions the meshes should be facing at
749
+ # @param up [Array, NArray] the up directions
750
+ # @param color [Array, NArray] the colors the meshes should be drawn in,
751
+ # it will be multiplied with each vertex color
752
+ # @param scale [Array, NArray] the scaling factors
753
+ #
695
754
  def drawslicemeshes(grid, x = nil, y = nil, z = nil, step = nil,
696
755
  offset = nil, position = [0, 0, 0], direction = [0, 0, 1], up = [0, 1, 0],
697
756
  color = [1, 1, 1], scale = [1, 1, 1])