ffi-geos 1.2.2 → 2.3.0

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +49 -0
  3. data/.rubocop.yml +5117 -4
  4. data/FUNDING.yml +2 -0
  5. data/Gemfile +9 -16
  6. data/Guardfile +3 -4
  7. data/MIT-LICENSE +1 -1
  8. data/README.rdoc +2 -20
  9. data/Rakefile +3 -2
  10. data/ffi-geos.gemspec +7 -2
  11. data/lib/ffi-geos/buffer_params.rb +1 -1
  12. data/lib/ffi-geos/coordinate_sequence.rb +179 -177
  13. data/lib/ffi-geos/geometry.rb +118 -31
  14. data/lib/ffi-geos/geometry_collection.rb +26 -12
  15. data/lib/ffi-geos/interrupt.rb +11 -14
  16. data/lib/ffi-geos/line_string.rb +64 -49
  17. data/lib/ffi-geos/multi_line_string.rb +1 -1
  18. data/lib/ffi-geos/point.rb +18 -18
  19. data/lib/ffi-geos/polygon.rb +44 -30
  20. data/lib/ffi-geos/prepared_geometry.rb +1 -1
  21. data/lib/ffi-geos/strtree.rb +28 -30
  22. data/lib/ffi-geos/tools.rb +1 -1
  23. data/lib/ffi-geos/utils.rb +16 -23
  24. data/lib/ffi-geos/version.rb +1 -1
  25. data/lib/ffi-geos/wkb_reader.rb +1 -1
  26. data/lib/ffi-geos/wkb_writer.rb +4 -5
  27. data/lib/ffi-geos/wkt_reader.rb +1 -1
  28. data/lib/ffi-geos/wkt_writer.rb +7 -13
  29. data/lib/ffi-geos.rb +134 -48
  30. data/sonar-project.properties +16 -0
  31. data/test/coordinate_sequence_tests.rb +148 -126
  32. data/test/geometry_collection_tests.rb +41 -67
  33. data/test/geometry_tests.rb +341 -40
  34. data/test/interrupt_tests.rb +7 -7
  35. data/test/line_string_tests.rb +23 -15
  36. data/test/point_tests.rb +5 -5
  37. data/test/polygon_tests.rb +6 -7
  38. data/test/prepared_geometry_tests.rb +8 -8
  39. data/test/strtree_tests.rb +13 -12
  40. data/test/test_helper.rb +74 -56
  41. data/test/utils_tests.rb +69 -59
  42. data/test/wkb_reader_tests.rb +9 -9
  43. data/test/wkb_writer_tests.rb +14 -12
  44. data/test/wkt_reader_tests.rb +0 -1
  45. data/test/wkt_writer_tests.rb +2 -5
  46. metadata +12 -10
  47. data/.travis.yml +0 -21
@@ -43,6 +43,28 @@ class CoordinateSequenceTests < Minitest::Test
43
43
  assert_equal(2, @cs.dimensions)
44
44
  end
45
45
 
46
+ def test_counter_clockwise
47
+ skip unless ENV['FORCE_TESTS'] || Geos::CoordinateSequence.method_defined?(:counter_clockwise?)
48
+
49
+ cs = Geos::CoordinateSequence.new([
50
+ [0, 0],
51
+ [1, 0],
52
+ [1, 1],
53
+ [0, 0]
54
+ ])
55
+
56
+ assert(cs.counter_clockwise?)
57
+
58
+ cs = Geos::CoordinateSequence.new([
59
+ [0, 0],
60
+ [1, 1],
61
+ [1, 0],
62
+ [0, 0]
63
+ ])
64
+
65
+ refute(cs.counter_clockwise?)
66
+ end
67
+
46
68
  def test_check_bounds
47
69
  assert_raises(Geos::IndexBoundsError) { @cs.set_x(10, 0.1) }
48
70
  assert_raises(Geos::IndexBoundsError) { @cs.set_x(-1, 0.1) }
@@ -105,11 +127,11 @@ class CoordinateSequenceTests < Minitest::Test
105
127
 
106
128
  def test_read_from_array
107
129
  cs = Geos::CoordinateSequence.new([
108
- [ 0, 0 ],
109
- [ 1, 1 ],
110
- [ 2, 2 ],
111
- [ 3, 3 ],
112
- [ 4, 4 ]
130
+ [0, 0],
131
+ [1, 1],
132
+ [2, 2],
133
+ [3, 3],
134
+ [4, 4]
113
135
  ])
114
136
 
115
137
  assert_equal(2, cs.dimensions)
@@ -117,30 +139,30 @@ class CoordinateSequenceTests < Minitest::Test
117
139
 
118
140
  assert_raises(Geos::CoordinateSequence::ParseError) do
119
141
  cs = Geos::CoordinateSequence.new([
120
- [ 1, 2 ],
121
- [ 1, 2, 3 ]
142
+ [1, 2],
143
+ [1, 2, 3]
122
144
  ])
123
145
  end
124
146
 
125
147
  assert_raises(Geos::CoordinateSequence::ParseError) do
126
148
  cs = Geos::CoordinateSequence.new([
127
- [ 1, 2, 3, 4 ]
149
+ [1, 2, 3, 4]
128
150
  ])
129
151
  end
130
152
  end
131
153
 
132
154
  def test_to_point
133
- cs = Geos::CoordinateSequence.new([ 5, 7 ])
155
+ cs = Geos::CoordinateSequence.new([5, 7])
134
156
  assert_equal('POINT (5 7)', write(cs.to_point, trim: true))
135
157
  end
136
158
 
137
159
  def test_to_to_linear_ring
138
160
  cs = Geos::CoordinateSequence.new([
139
- [ 0, 0 ],
140
- [ 0, 5 ],
141
- [ 5, 5 ],
142
- [ 5, 0 ],
143
- [ 0, 0 ]
161
+ [0, 0],
162
+ [0, 5],
163
+ [5, 5],
164
+ [5, 0],
165
+ [0, 0]
144
166
  ])
145
167
 
146
168
  assert_equal('LINEARRING (0 0, 0 5, 5 5, 5 0, 0 0)', write(cs.to_linear_ring, trim: true))
@@ -150,7 +172,7 @@ class CoordinateSequenceTests < Minitest::Test
150
172
  cs = Geos::CoordinateSequence.new
151
173
  assert_geom_empty(cs)
152
174
 
153
- cs = Geos::CoordinateSequence.new([ 4, 1 ])
175
+ cs = Geos::CoordinateSequence.new([4, 1])
154
176
  refute_geom_empty(cs)
155
177
  end
156
178
 
@@ -162,10 +184,10 @@ class CoordinateSequenceTests < Minitest::Test
162
184
 
163
185
  def test_to_line_string
164
186
  cs = Geos::CoordinateSequence.new([
165
- [ 0, 0 ],
166
- [ 0, 5 ],
167
- [ 5, 5 ],
168
- [ 5, 0 ]
187
+ [0, 0],
188
+ [0, 5],
189
+ [5, 5],
190
+ [5, 0]
169
191
  ])
170
192
 
171
193
  assert_equal('LINESTRING (0 0, 0 5, 5 5, 5 0)', write(cs.to_line_string, trim: true))
@@ -179,11 +201,11 @@ class CoordinateSequenceTests < Minitest::Test
179
201
 
180
202
  def test_to_polygon
181
203
  cs = Geos::CoordinateSequence.new([
182
- [ 0, 0 ],
183
- [ 0, 5 ],
184
- [ 5, 5 ],
185
- [ 5, 0 ],
186
- [ 0, 0 ]
204
+ [0, 0],
205
+ [0, 5],
206
+ [5, 5],
207
+ [5, 0],
208
+ [0, 0]
187
209
  ])
188
210
 
189
211
  assert_equal('POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))', write(cs.to_polygon, trim: true))
@@ -262,7 +284,7 @@ class CoordinateSequenceTests < Minitest::Test
262
284
 
263
285
  assert_kind_of(Enumerable, cs.x.each)
264
286
  assert_kind_of(Enumerable, cs.x.to_enum)
265
- assert_equal(cs.x, cs.x.each {})
287
+ assert_equal(cs.x, cs.x.each(&EMPTY_BLOCK))
266
288
  end
267
289
 
268
290
  def test_options_hash
@@ -277,13 +299,13 @@ class CoordinateSequenceTests < Minitest::Test
277
299
 
278
300
  assert_kind_of(Enumerable, cs.each)
279
301
  assert_kind_of(Enumerable, cs.to_enum)
280
- assert_equal(cs, cs.each {})
302
+ assert_equal(cs, cs.each(&EMPTY_BLOCK))
281
303
  end
282
304
 
283
305
  def test_array_like_access
284
306
  cs = Geos::CoordinateSequence.new([
285
- [ 0, 1 ],
286
- [ 2, 3 ]
307
+ [0, 1],
308
+ [2, 3]
287
309
  ])
288
310
 
289
311
  assert_equal(0, cs[0][0])
@@ -292,7 +314,7 @@ class CoordinateSequenceTests < Minitest::Test
292
314
  assert_equal(3, cs[1][1])
293
315
 
294
316
  cs = Geos::CoordinateSequence.new([
295
- [ 4, 5, 6 ]
317
+ [4, 5, 6]
296
318
  ])
297
319
 
298
320
  assert_equal(4, cs[0][0])
@@ -302,9 +324,9 @@ class CoordinateSequenceTests < Minitest::Test
302
324
 
303
325
  def test_slice
304
326
  cs = Geos::CoordinateSequence.new([
305
- [ 0, 1 ],
306
- [ 2, 3 ],
307
- [ 4, 5 ]
327
+ [0, 1],
328
+ [2, 3],
329
+ [4, 5]
308
330
  ])
309
331
 
310
332
  assert_equal([[0, 1], [2, 3]], cs.slice(0..1))
@@ -313,21 +335,21 @@ class CoordinateSequenceTests < Minitest::Test
313
335
  end
314
336
 
315
337
  def test_proxy_clone
316
- cs = Geos::CoordinateSequence.new([ 10, 20 ])
317
- cs2 = cs.clone
338
+ cs = Geos::CoordinateSequence.new([10, 20])
339
+ cs_2 = cs.clone
318
340
 
319
341
  cs.x[0] = 100
320
342
 
321
343
  assert_equal(100, cs.x[0])
322
- assert_equal(10, cs2.x[0])
344
+ assert_equal(10, cs_2.x[0])
323
345
 
324
- refute_equal(cs.x, cs2.x)
325
- refute_equal(cs.y, cs2.y)
346
+ refute_equal(cs.x, cs_2.x)
347
+ refute_equal(cs.y, cs_2.y)
326
348
  end
327
349
 
328
350
  def test_has_z
329
- assert_geom_has_z(Geos::CoordinateSequence.new([ 0, 1, 2 ]))
330
- refute_geom_has_z(Geos::CoordinateSequence.new([ 0, 1 ]))
351
+ assert_geom_has_z(Geos::CoordinateSequence.new([0, 1, 2]))
352
+ refute_geom_has_z(Geos::CoordinateSequence.new([0, 1]))
331
353
  refute_geom_has_z(Geos::CoordinateSequence.new(1, 2))
332
354
  assert_geom_has_z(Geos::CoordinateSequence.new(1, 3))
333
355
  assert_geom_has_z(read('POINT (0 0 0)').coord_seq)
@@ -335,38 +357,38 @@ class CoordinateSequenceTests < Minitest::Test
335
357
  end
336
358
 
337
359
  def test_x_max
338
- cs = Geos::CoordinateSequence.new([ -10, -15 ], [ 0, 5 ], [ 10, 20 ])
360
+ cs = Geos::CoordinateSequence.new([-10, -15], [0, 5], [10, 20])
339
361
  assert_equal(10, cs.x_max)
340
362
  end
341
363
 
342
364
  def test_x_min
343
- cs = Geos::CoordinateSequence.new([ -10, -15 ], [ 0, 5 ], [ 10, 20 ])
365
+ cs = Geos::CoordinateSequence.new([-10, -15], [0, 5], [10, 20])
344
366
  assert_equal(-10, cs.x_min)
345
367
  end
346
368
 
347
369
  def test_y_max
348
- cs = Geos::CoordinateSequence.new([ -10, -15 ], [ 0, 5 ], [ 10, 20 ])
370
+ cs = Geos::CoordinateSequence.new([-10, -15], [0, 5], [10, 20])
349
371
  assert_equal(20, cs.y_max)
350
372
  end
351
373
 
352
374
  def test_y_min
353
- cs = Geos::CoordinateSequence.new([ -10, -15 ], [ 0, 5 ], [ 10, 20 ])
375
+ cs = Geos::CoordinateSequence.new([-10, -15], [0, 5], [10, 20])
354
376
  assert_equal(-15, cs.y_min)
355
377
  end
356
378
 
357
379
  def test_z_max
358
- cs = Geos::CoordinateSequence.new([ -10, -15 ], [ 0, 5 ], [ 10, 20 ])
359
- assert(cs.z_max.nan?, " Expected NaN")
380
+ cs = Geos::CoordinateSequence.new([-10, -15], [0, 5], [10, 20])
381
+ assert(cs.z_max.nan?, ' Expected NaN')
360
382
 
361
- cs = Geos::CoordinateSequence.new([ -10, -15, -20 ], [ 0, 5, 10 ], [ 10, 20, 30 ])
383
+ cs = Geos::CoordinateSequence.new([-10, -15, -20], [0, 5, 10], [10, 20, 30])
362
384
  assert_equal(30, cs.z_max)
363
385
  end
364
386
 
365
387
  def test_z_min
366
- cs = Geos::CoordinateSequence.new([ -10, -15 ], [ 0, 5 ], [ 10, 20 ])
367
- assert(cs.z_min.nan?, " Expected NaN")
388
+ cs = Geos::CoordinateSequence.new([-10, -15], [0, 5], [10, 20])
389
+ assert(cs.z_min.nan?, ' Expected NaN')
368
390
 
369
- cs = Geos::CoordinateSequence.new([ -10, -15, -20 ], [ 0, 5, 10 ], [ 10, 20, 30 ])
391
+ cs = Geos::CoordinateSequence.new([-10, -15, -20], [0, 5, 10], [10, 20, 30])
370
392
  assert_equal(-20, cs.z_min)
371
393
  end
372
394
 
@@ -384,9 +406,9 @@ class CoordinateSequenceTests < Minitest::Test
384
406
  ]
385
407
 
386
408
  coordinates = [
387
- [ -10.123456789, -15.123456789 ],
388
- [ 0.123456789, 5.123456789 ],
389
- [ 10.123456789, 20.123456789 ]
409
+ [-10.123456789, -15.123456789],
410
+ [0.123456789, 5.123456789],
411
+ [10.123456789, 20.123456789]
390
412
  ]
391
413
 
392
414
  9.times do |i|
@@ -407,54 +429,54 @@ class CoordinateSequenceTests < Minitest::Test
407
429
 
408
430
  def test_snap_to_grid_with_hash
409
431
  cs = Geos::CoordinateSequence.new(
410
- [ 10, 10 ],
411
- [ 20, 20 ],
412
- [ 30, 30 ]
432
+ [10, 10],
433
+ [20, 20],
434
+ [30, 30]
413
435
  )
414
- cs.snap_to_grid!(:size_x => 1, :size_y => 1, :offset_x => 12.5, :offset_y => 12.5)
436
+ cs.snap_to_grid!(size_x: 1, size_y: 1, offset_x: 12.5, offset_y: 12.5)
415
437
 
416
438
  assert_equal([
417
- [ 9.5, 9.5 ],
418
- [ 20.5, 20.5 ],
419
- [ 30.5, 30.5 ]
439
+ [9.5, 9.5],
440
+ [20.5, 20.5],
441
+ [30.5, 30.5]
420
442
  ], cs.to_a)
421
443
  end
422
444
 
423
445
  def test_snap_to_grid_with_geometry_origin
424
446
  cs = Geos::CoordinateSequence.new(
425
- [ 10, 10 ],
426
- [ 20, 20 ],
427
- [ 30, 30 ]
447
+ [10, 10],
448
+ [20, 20],
449
+ [30, 30]
428
450
  )
429
- cs.snap_to_grid!(:size => 1, :offset => read('LINESTRING (0 0, 25 25)'))
451
+ cs.snap_to_grid!(size: 1, offset: read('LINESTRING (0 0, 25 25)'))
430
452
 
431
453
  assert_equal([
432
- [ 9.5, 9.5 ],
433
- [ 20.5, 20.5 ],
434
- [ 30.5, 30.5 ]
454
+ [9.5, 9.5],
455
+ [20.5, 20.5],
456
+ [30.5, 30.5]
435
457
  ], cs.to_a)
436
458
  end
437
459
 
438
460
  def test_snap_to_grid_with_z
439
461
  cs = Geos::CoordinateSequence.new(
440
- [ 10, 10, 10 ],
441
- [ 20, 20, 20 ],
442
- [ 30, 30, 30 ]
462
+ [10, 10, 10],
463
+ [20, 20, 20],
464
+ [30, 30, 30]
443
465
  )
444
466
  cs.snap_to_grid!(
445
- :size_x => 1,
446
- :size_y => 1,
447
- :size_z => 1,
467
+ size_x: 1,
468
+ size_y: 1,
469
+ size_z: 1,
448
470
 
449
- :offset_x => 12.5,
450
- :offset_y => 12.5,
451
- :offset_z => 12.5
471
+ offset_x: 12.5,
472
+ offset_y: 12.5,
473
+ offset_z: 12.5
452
474
  )
453
475
 
454
476
  assert_equal([
455
- [ 9.5, 9.5, 9.5 ],
456
- [ 20.5, 20.5, 20.5 ],
457
- [ 30.5, 30.5, 30.5 ]
477
+ [9.5, 9.5, 9.5],
478
+ [20.5, 20.5, 20.5],
479
+ [30.5, 30.5, 30.5]
458
480
  ], cs.to_a)
459
481
  end
460
482
 
@@ -486,99 +508,99 @@ class CoordinateSequenceTests < Minitest::Test
486
508
  assert_equal(expected, cs.to_a)
487
509
 
488
510
  cs = Geos::CoordinateSequence.new(coords)
489
- cs2 = cs.snap_to_grid
511
+ cs_2 = cs.snap_to_grid
490
512
 
491
513
  assert_equal(coords, cs.to_a)
492
- assert_equal(expected, cs2.to_a)
514
+ assert_equal(expected, cs_2.to_a)
493
515
  end
494
516
 
495
517
  undef :affine_tester
496
- def affine_tester(method, expected, coords, *args)
518
+ def affine_tester(method, expected, coords, *args, **options)
497
519
  cs = Geos::CoordinateSequence.new(coords)
498
- cs.send("#{method}!", *args)
520
+ cs.__safe_send__("#{method}!", *args, **options)
499
521
 
500
522
  expected.length.times do |i|
501
523
  assert_in_delta(expected[i], cs.get_ordinate(0, i), TOLERANCE)
502
524
  end
503
525
 
504
526
  cs = Geos::CoordinateSequence.new(coords)
505
- cs2 = cs.send(method, *args)
527
+ cs_2 = cs.__safe_send__(method, *args, **options)
506
528
 
507
529
  expected.length.times do |i|
508
530
  assert_in_delta(coords[i], cs.get_ordinate(0, i), TOLERANCE)
509
- assert_in_delta(expected[i], cs2.get_ordinate(0, i), TOLERANCE)
531
+ assert_in_delta(expected[i], cs_2.get_ordinate(0, i), TOLERANCE)
510
532
  end
511
533
  end
512
534
 
513
535
  def test_rotate
514
- affine_tester(:rotate, [ 29.0, 11.0 ], [ 1, 1 ], Math::PI / 2, [ 10.0, 20.0 ])
515
- affine_tester(:rotate, [ -2.0, 0.0 ], [ 1, 1 ], -Math::PI / 2, [ -1.0, 2.0 ])
516
- affine_tester(:rotate, [ 19.0, 1.0 ], [ 1, 1 ], Math::PI / 2, read('POINT(10 10)'))
517
- affine_tester(:rotate, [ -0.5, 0.5 ], [ 1, 1 ], Math::PI / 2, read('LINESTRING(0 0, 1 0)'))
536
+ affine_tester(:rotate, [29.0, 11.0], [1, 1], Math::PI / 2, [10.0, 20.0])
537
+ affine_tester(:rotate, [-2.0, 0.0], [1, 1], -Math::PI / 2, [-1.0, 2.0])
538
+ affine_tester(:rotate, [19.0, 1.0], [1, 1], Math::PI / 2, read('POINT(10 10)'))
539
+ affine_tester(:rotate, [-0.5, 0.5], [1, 1], Math::PI / 2, read('LINESTRING(0 0, 1 0)'))
518
540
  end
519
541
 
520
542
  def test_rotate_x
521
- affine_tester(:rotate_x, [ 1, -1, -1 ], [ 1, 1, 1 ], Math::PI)
522
- affine_tester(:rotate_x, [ 1, -1, 1 ], [ 1, 1, 1 ], Math::PI / 2)
523
- affine_tester(:rotate_x, [ 1, 1, -1 ], [ 1, 1, 1 ], Math::PI + Math::PI / 2)
524
- affine_tester(:rotate_x, [ 1, 1, 1 ], [ 1, 1, 1 ], Math::PI * 2)
543
+ affine_tester(:rotate_x, [1, -1, -1], [1, 1, 1], Math::PI)
544
+ affine_tester(:rotate_x, [1, -1, 1], [1, 1, 1], Math::PI / 2)
545
+ affine_tester(:rotate_x, [1, 1, -1], [1, 1, 1], Math::PI + (Math::PI / 2))
546
+ affine_tester(:rotate_x, [1, 1, 1], [1, 1, 1], Math::PI * 2)
525
547
  end
526
548
 
527
549
  def test_rotate_y
528
- affine_tester(:rotate_y, [ -1, 1, -1 ], [ 1, 1, 1 ], Math::PI)
529
- affine_tester(:rotate_y, [ 1, 1, -1 ], [ 1, 1, 1 ], Math::PI / 2)
530
- affine_tester(:rotate_y, [ -1, 1, 1 ], [ 1, 1, 1 ], Math::PI + Math::PI / 2)
531
- affine_tester(:rotate_y, [ 1, 1, 1 ], [ 1, 1, 1 ], Math::PI * 2)
550
+ affine_tester(:rotate_y, [-1, 1, -1], [1, 1, 1], Math::PI)
551
+ affine_tester(:rotate_y, [1, 1, -1], [1, 1, 1], Math::PI / 2)
552
+ affine_tester(:rotate_y, [-1, 1, 1], [1, 1, 1], Math::PI + (Math::PI / 2))
553
+ affine_tester(:rotate_y, [1, 1, 1], [1, 1, 1], Math::PI * 2)
532
554
  end
533
555
 
534
556
  def test_rotate_z
535
- affine_tester(:rotate_z, [ -1, -1 ], [ 1, 1 ], Math::PI)
536
- affine_tester(:rotate_z, [ -1, 1 ], [ 1, 1 ], Math::PI / 2)
537
- affine_tester(:rotate_z, [ 1, -1 ], [ 1, 1 ], Math::PI + Math::PI / 2)
538
- affine_tester(:rotate_z, [ 1, 1 ], [ 1, 1 ], Math::PI * 2)
557
+ affine_tester(:rotate_z, [-1, -1], [1, 1], Math::PI)
558
+ affine_tester(:rotate_z, [-1, 1], [1, 1], Math::PI / 2)
559
+ affine_tester(:rotate_z, [1, -1], [1, 1], Math::PI + (Math::PI / 2))
560
+ affine_tester(:rotate_z, [1, 1], [1, 1], Math::PI * 2)
539
561
  end
540
562
 
541
563
  def test_scale
542
- affine_tester(:scale, [ 5, 5 ], [ 1, 1 ], 5, 5)
543
- affine_tester(:scale, [ 3, 2 ], [ 1, 1 ], 3, 2)
544
- affine_tester(:scale, [ 40, 40, 40 ], [ 10, 20, -5 ], 4, 2, -8)
564
+ affine_tester(:scale, [5, 5], [1, 1], 5, 5)
565
+ affine_tester(:scale, [3, 2], [1, 1], 3, 2)
566
+ affine_tester(:scale, [40, 40, 40], [10, 20, -5], 4, 2, -8)
545
567
  end
546
568
 
547
569
  def test_scale_hash
548
- affine_tester(:scale, [ 5, 5 ], [ 1, 1 ], :x => 5, :y => 5)
549
- affine_tester(:scale, [ 3, 2 ], [ 1, 1 ], :x => 3, :y => 2)
550
- affine_tester(:scale, [ 40, 40, 40 ], [ 10, 20, -5 ], :x => 4, :y => 2, :z => -8)
570
+ affine_tester(:scale, [5, 5], [1, 1], x: 5, y: 5)
571
+ affine_tester(:scale, [3, 2], [1, 1], x: 3, y: 2)
572
+ affine_tester(:scale, [40, 40, 40], [10, 20, -5], x: 4, y: 2, z: -8)
551
573
  end
552
574
 
553
575
  def test_trans_scale
554
- affine_tester(:trans_scale, [ 2, 2 ], [ 1, 1 ], 1, 1, 1, 1)
555
- affine_tester(:trans_scale, [ 3, 3 ], [ 2, 2 ], 1, 1, 1, 1)
556
- affine_tester(:trans_scale, [ 0, 0 ], [ 1, 1 ], -1, -1, -1, -1)
557
- affine_tester(:trans_scale, [ 1, 2 ], [ 1, 1 ], 0, 1, 1, 1)
558
- affine_tester(:trans_scale, [ 2, 1 ], [ 1, 1 ], 1, 0, 1, 1)
559
- affine_tester(:trans_scale, [ 0, 2 ], [ 1, 1 ], 1, 1, 0, 1)
560
- affine_tester(:trans_scale, [ 2, 0 ], [ 1, 1 ], 1, 1, 1, 0)
561
- affine_tester(:trans_scale, [ 3, 2 ], [ 1, 1 ], 2, 1, 1, 1)
562
- affine_tester(:trans_scale, [ 2, 3 ], [ 1, 1 ], 1, 2, 1, 1)
563
- affine_tester(:trans_scale, [ 4, 2 ], [ 1, 1 ], 1, 1, 2, 1)
564
- affine_tester(:trans_scale, [ 2, 4 ], [ 1, 1 ], 1, 1, 1, 2)
565
- affine_tester(:trans_scale, [ 15, 28 ], [ 1, 1 ], 2, 3, 5, 7)
566
- affine_tester(:trans_scale, [ 15, 28, 1 ], [ 1, 1, 1 ], 2, 3, 5, 7)
576
+ affine_tester(:trans_scale, [2, 2], [1, 1], 1, 1, 1, 1)
577
+ affine_tester(:trans_scale, [3, 3], [2, 2], 1, 1, 1, 1)
578
+ affine_tester(:trans_scale, [0, 0], [1, 1], -1, -1, -1, -1)
579
+ affine_tester(:trans_scale, [1, 2], [1, 1], 0, 1, 1, 1)
580
+ affine_tester(:trans_scale, [2, 1], [1, 1], 1, 0, 1, 1)
581
+ affine_tester(:trans_scale, [0, 2], [1, 1], 1, 1, 0, 1)
582
+ affine_tester(:trans_scale, [2, 0], [1, 1], 1, 1, 1, 0)
583
+ affine_tester(:trans_scale, [3, 2], [1, 1], 2, 1, 1, 1)
584
+ affine_tester(:trans_scale, [2, 3], [1, 1], 1, 2, 1, 1)
585
+ affine_tester(:trans_scale, [4, 2], [1, 1], 1, 1, 2, 1)
586
+ affine_tester(:trans_scale, [2, 4], [1, 1], 1, 1, 1, 2)
587
+ affine_tester(:trans_scale, [15, 28], [1, 1], 2, 3, 5, 7)
588
+ affine_tester(:trans_scale, [15, 28, 1], [1, 1, 1], 2, 3, 5, 7)
567
589
  end
568
590
 
569
591
  def test_trans_scale_hash
570
- affine_tester(:trans_scale, [ 2, 2 ], [ 1, 1 ], :delta_x => 1, :delta_y => 1, :x_factor => 1, :y_factor => 1)
571
- affine_tester(:trans_scale, [ 15, 28, 1 ], [ 1, 1, 1 ], :delta_x => 2, :delta_y => 3, :x_factor => 5, :y_factor => 7)
572
- affine_tester(:trans_scale, [ 3, 1, 1 ], [ 1, 1, 1 ], :delta_x => 2, :z_factor => 2)
592
+ affine_tester(:trans_scale, [2, 2], [1, 1], delta_x: 1, delta_y: 1, x_factor: 1, y_factor: 1)
593
+ affine_tester(:trans_scale, [15, 28, 1], [1, 1, 1], delta_x: 2, delta_y: 3, x_factor: 5, y_factor: 7)
594
+ affine_tester(:trans_scale, [3, 1, 1], [1, 1, 1], delta_x: 2, z_factor: 2)
573
595
  end
574
596
 
575
597
  def test_translate
576
- affine_tester(:translate, [ 5, 12 ], [ 0, 0 ], 5, 12)
577
- affine_tester(:translate, [ -3, -7, 3 ], [ 0, 0, 0 ], -3, -7, 3)
598
+ affine_tester(:translate, [5, 12], [0, 0], 5, 12)
599
+ affine_tester(:translate, [-3, -7, 3], [0, 0, 0], -3, -7, 3)
578
600
  end
579
601
 
580
602
  def test_translate_hash
581
- affine_tester(:translate, [ 5, 12 ], [ 0, 0 ], :x => 5, :y => 12)
582
- affine_tester(:translate, [ -3, -7, 3 ], [ 0, 0, 0 ], :x => -3, :y => -7, :z => 3)
603
+ affine_tester(:translate, [5, 12], [0, 0], x: 5, y: 12)
604
+ affine_tester(:translate, [-3, -7, 3], [0, 0, 0], x: -3, y: -7, z: 3)
583
605
  end
584
606
  end