sixarm_ruby_geometry 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Rakefile +18 -0
  5. data/lib/sixarm_ruby_geometry.rb +41 -0
  6. data/lib/sixarm_ruby_geometry/indexable.rb +7 -0
  7. data/lib/sixarm_ruby_geometry/indexable/d1.rb +12 -0
  8. data/lib/sixarm_ruby_geometry/indexable/d2.rb +12 -0
  9. data/lib/sixarm_ruby_geometry/indexable/d3.rb +12 -0
  10. data/lib/sixarm_ruby_geometry/indexable/pitch.rb +15 -0
  11. data/lib/sixarm_ruby_geometry/indexable/rad.rb +15 -0
  12. data/lib/sixarm_ruby_geometry/indexable/width.rb +20 -0
  13. data/lib/sixarm_ruby_geometry/indexable/width_height.rb +30 -0
  14. data/lib/sixarm_ruby_geometry/indexable/width_height_depth.rb +40 -0
  15. data/lib/sixarm_ruby_geometry/indexable/x.rb +18 -0
  16. data/lib/sixarm_ruby_geometry/indexable/xy.rb +26 -0
  17. data/lib/sixarm_ruby_geometry/indexable/xyz.rb +40 -0
  18. data/lib/sixarm_ruby_geometry/indexable/yaw.rb +15 -0
  19. data/lib/sixarm_ruby_geometry/point.rb +7 -0
  20. data/lib/sixarm_ruby_geometry/point/array.rb +12 -0
  21. data/lib/sixarm_ruby_geometry/point/array/d1.rb +14 -0
  22. data/lib/sixarm_ruby_geometry/point/array/d2.rb +14 -0
  23. data/lib/sixarm_ruby_geometry/point/array/d3.rb +14 -0
  24. data/lib/sixarm_ruby_geometry/point/vector.rb +12 -0
  25. data/lib/sixarm_ruby_geometry/point/vector/d1.rb +14 -0
  26. data/lib/sixarm_ruby_geometry/point/vector/d2.rb +14 -0
  27. data/lib/sixarm_ruby_geometry/point/vector/d3.rb +14 -0
  28. data/lib/sixarm_ruby_geometry/space.rb +7 -0
  29. data/lib/sixarm_ruby_geometry/space/array.rb +12 -0
  30. data/lib/sixarm_ruby_geometry/space/array/d1.rb +14 -0
  31. data/lib/sixarm_ruby_geometry/space/array/d2.rb +14 -0
  32. data/lib/sixarm_ruby_geometry/space/array/d3.rb +14 -0
  33. data/lib/sixarm_ruby_geometry/space/vector.rb +12 -0
  34. data/lib/sixarm_ruby_geometry/space/vector/d1.rb +14 -0
  35. data/lib/sixarm_ruby_geometry/space/vector/d2.rb +14 -0
  36. data/lib/sixarm_ruby_geometry/space/vector/d3.rb +14 -0
  37. data/test/sixarm_ruby_geometry_test.rb +1 -0
  38. data/test/sixarm_ruby_geometry_test/indexable/d1_test.rb +34 -0
  39. data/test/sixarm_ruby_geometry_test/indexable/d2_test.rb +36 -0
  40. data/test/sixarm_ruby_geometry_test/indexable/d3_test.rb +38 -0
  41. data/test/sixarm_ruby_geometry_test/indexable/pitch_test.rb +36 -0
  42. data/test/sixarm_ruby_geometry_test/indexable/rad_test.rb +31 -0
  43. data/test/sixarm_ruby_geometry_test/indexable/width_height_depth_test.rb +70 -0
  44. data/test/sixarm_ruby_geometry_test/indexable/width_height_test.rb +56 -0
  45. data/test/sixarm_ruby_geometry_test/indexable/width_test.rb +42 -0
  46. data/test/sixarm_ruby_geometry_test/indexable/x_test.rb +42 -0
  47. data/test/sixarm_ruby_geometry_test/indexable/xy_test.rb +56 -0
  48. data/test/sixarm_ruby_geometry_test/indexable/xyz_test.rb +72 -0
  49. data/test/sixarm_ruby_geometry_test/indexable/yaw_test.rb +31 -0
  50. data/test/sixarm_ruby_geometry_test/indexable_test.rb +31 -0
  51. data/test/sixarm_ruby_geometry_test/point/array/d1_test.rb +35 -0
  52. data/test/sixarm_ruby_geometry_test/point/array/d2_test.rb +37 -0
  53. data/test/sixarm_ruby_geometry_test/point/array/d3_test.rb +39 -0
  54. data/test/sixarm_ruby_geometry_test/point/array_test.rb +33 -0
  55. data/test/sixarm_ruby_geometry_test/point/vector/d1_test.rb +36 -0
  56. data/test/sixarm_ruby_geometry_test/point/vector/d2_test.rb +38 -0
  57. data/test/sixarm_ruby_geometry_test/point/vector/d3_test.rb +40 -0
  58. data/test/sixarm_ruby_geometry_test/point/vector_test.rb +34 -0
  59. data/test/sixarm_ruby_geometry_test/point_test.rb +25 -0
  60. data/test/sixarm_ruby_geometry_test/space/array/d1_test.rb +35 -0
  61. data/test/sixarm_ruby_geometry_test/space/array/d2_test.rb +37 -0
  62. data/test/sixarm_ruby_geometry_test/space/array/d3_test.rb +39 -0
  63. data/test/sixarm_ruby_geometry_test/space/array_test.rb +33 -0
  64. data/test/sixarm_ruby_geometry_test/space/vector/d1_test.rb +36 -0
  65. data/test/sixarm_ruby_geometry_test/space/vector/d2_test.rb +38 -0
  66. data/test/sixarm_ruby_geometry_test/space/vector/d3_test.rb +40 -0
  67. data/test/sixarm_ruby_geometry_test/space/vector_test.rb +34 -0
  68. data/test/sixarm_ruby_geometry_test/space_test.rb +25 -0
  69. metadata +262 -0
  70. metadata.gz.sig +0 -0
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/indexable/width"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Indexable
10
+ class WidthTest < Minitest::Test
11
+
12
+ def test_0
13
+ assert(::Indexable::Width)
14
+ end
15
+
16
+ require "matrix"
17
+ class C < Vector
18
+ include ::Indexable::Width
19
+ end
20
+
21
+ def test_width
22
+ width = fake_n
23
+ o = C[width,0]
24
+ assert_equal(width, o.width)
25
+ end
26
+
27
+ def test_width_equal
28
+ width = fake_n
29
+ o = fake_indexable
30
+ refute_equal(width, o.width)
31
+ o.width = width
32
+ assert_equal(width, o.width)
33
+ end
34
+
35
+ protected
36
+
37
+ def fake_indexable
38
+ C[0]
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/indexable/x"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Indexable
10
+ class XTest < Minitest::Test
11
+
12
+ def test_0
13
+ assert(::Indexable::X)
14
+ end
15
+
16
+ require "matrix"
17
+ class C < Vector
18
+ include ::Indexable::X
19
+ end
20
+
21
+ def test_x
22
+ x = fake_n
23
+ o = C[x]
24
+ assert_equal(x, o.x)
25
+ end
26
+
27
+ def test_x_equal
28
+ x = fake_n
29
+ o = fake_indexable
30
+ refute_equal(x, o.x)
31
+ o.x = x
32
+ assert_equal(x, o.x)
33
+ end
34
+
35
+ protected
36
+
37
+ def fake_indexable
38
+ C[0]
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/indexable/xy"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Indexable
10
+ class XYTest < Minitest::Test
11
+
12
+ def test_0
13
+ assert(::Indexable::XY)
14
+ end
15
+
16
+ require "matrix"
17
+ class C < Vector
18
+ include ::Indexable::XY
19
+ end
20
+
21
+ def test_x
22
+ x = fake_n
23
+ o = C[x,0]
24
+ assert_equal(x, o.x)
25
+ end
26
+
27
+ def test_x_equal
28
+ x = fake_n
29
+ o = fake_indexable
30
+ refute_equal(x, o.x)
31
+ o.x = x
32
+ assert_equal(x, o.x)
33
+ end
34
+
35
+ def test_y
36
+ y = fake_n
37
+ o = C[0,y]
38
+ assert_equal(y, o.y)
39
+ end
40
+
41
+ def test_y_equal
42
+ y = fake_n
43
+ o = fake_indexable
44
+ refute_equal(y, o.y)
45
+ o.y = y
46
+ assert_equal(y, o.y)
47
+ end
48
+
49
+ protected
50
+
51
+ def fake_indexable
52
+ C[0,0]
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,72 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/indexable/xyz"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Indexable
10
+ class XYZTest < Minitest::Test
11
+
12
+ def test_0
13
+ assert(::Indexable::XYZ)
14
+ end
15
+
16
+ require "matrix"
17
+ class C < Vector
18
+ include ::Indexable::XYZ
19
+ end
20
+
21
+ def test_new
22
+ assert(C[0,0,0])
23
+ end
24
+
25
+ def test_x
26
+ x = fake_n
27
+ o = C[x, 0, 0]
28
+ assert_equal(x, o.x)
29
+ end
30
+
31
+ def test_x_equal
32
+ x = fake_n
33
+ o = fake_indexable
34
+ refute_equal(x, o.x)
35
+ o.x = x
36
+ assert_equal(x, o.x)
37
+ end
38
+
39
+ def test_y
40
+ y = fake_n
41
+ o = C[0, y, 0]
42
+ assert_equal(y, o.y)
43
+ end
44
+
45
+ def test_y_equal
46
+ y = fake_n
47
+ o = fake_indexable
48
+ refute_equal(y, o.y)
49
+ o.y = y
50
+ assert_equal(y, o.y)
51
+ end
52
+
53
+ def test_z
54
+ z = fake_n
55
+ o = C[0, 0, z]
56
+ assert_equal(z, o.z)
57
+ end
58
+
59
+ def test_z_equal
60
+ z = fake_n
61
+ o = fake_indexable
62
+ refute_equal(z, o.z)
63
+ o.z = z
64
+ assert_equal(z, o.z)
65
+ end
66
+
67
+ def fake_indexable
68
+ C[0, 0, 0]
69
+ end
70
+
71
+ end
72
+ end
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/indexable/yaw"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Indexable
10
+ class YawTest < Minitest::Test
11
+
12
+ def test_0
13
+ assert(::Indexable::Yaw)
14
+ end
15
+
16
+ require "matrix"
17
+ class C < Vector
18
+ include ::Indexable::Yaw
19
+ end
20
+
21
+ DELTA = 0.00001
22
+
23
+ def test_yaw
24
+ assert_in_delta(Math::PI * 0.0, C[ 1, 0, fake_f].yaw, DELTA)
25
+ assert_in_delta(Math::PI * -0.5, C[ 0, 1, fake_f].yaw, DELTA)
26
+ assert_in_delta(Math::PI * 1.0, C[-1, 0, fake_f].yaw, DELTA)
27
+ assert_in_delta(Math::PI * 0.5, C[ 0, -1, fake_f].yaw, DELTA)
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/indexable"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Indexable
10
+ class Test < Minitest::Test
11
+
12
+ def test_0
13
+ assert(::Indexable)
14
+ end
15
+
16
+ class C
17
+ include ::Indexable
18
+ def []
19
+ end
20
+ end
21
+
22
+ def test_include
23
+ assert_includes(C.ancestors, ::Indexable)
24
+ end
25
+
26
+ def test_braces
27
+ assert(C.new.respond_to?:[])
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/point/array/d1"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Point
10
+ module Array
11
+ module D1
12
+ class Test < Minitest::Test
13
+
14
+ def test_0
15
+ assert(::Point::Array::D1)
16
+ end
17
+
18
+ class C < ::Array
19
+ include ::Point::Array::D1
20
+ end
21
+
22
+ def test_new
23
+ assert(C[0])
24
+ end
25
+
26
+ def test_index
27
+ e0 = fake_n
28
+ c = C[e0]
29
+ assert_equal(e0, c[0])
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/point/array/d2"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Point
10
+ module Array
11
+ module D2
12
+ class Test < Minitest::Test
13
+
14
+ def test_0
15
+ assert(::Point::Array::D2)
16
+ end
17
+
18
+ class C < ::Array
19
+ include ::Point::Array::D2
20
+ end
21
+
22
+ def test_new
23
+ assert(C[0, 0])
24
+ end
25
+
26
+ def test_index
27
+ e0 = fake_n
28
+ e1 = fake_n
29
+ c = C[e0, e1]
30
+ assert_equal(e0, c[0])
31
+ assert_equal(e1, c[1])
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/point/array/d3"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Point
10
+ module Array
11
+ module D3
12
+ class Test < Minitest::Test
13
+
14
+ def test_0
15
+ assert(::Point::Array::D3)
16
+ end
17
+
18
+ class C < ::Array
19
+ include ::Point::Array::D3
20
+ end
21
+
22
+ def test_new
23
+ assert(C[0, 0, 0])
24
+ end
25
+
26
+ def test_index
27
+ e0 = fake_n
28
+ e1 = fake_n
29
+ e2 = fake_n
30
+ c = C[e0, e1, e2]
31
+ assert_equal(e0, c[0])
32
+ assert_equal(e1, c[1])
33
+ assert_equal(e2, c[2])
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/point/array"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Point
10
+ module Array
11
+ class Test < Minitest::Test
12
+
13
+ def test_0
14
+ assert(::Point::Array)
15
+ end
16
+
17
+ class C < ::Array
18
+ include ::Point::Array
19
+ end
20
+
21
+ def test_new
22
+ assert(C[0])
23
+ end
24
+
25
+ def test_index
26
+ e0 = fake_n
27
+ c = C[e0]
28
+ assert_equal(e0, c[0])
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+
6
+ require "sixarm_ruby_geometry/point/vector/d1"
7
+ require "sixarm_ruby_geometry_test/fake"
8
+
9
+ module Point
10
+ module Vector
11
+ module D1
12
+ class Test < Minitest::Test
13
+
14
+ def test_0
15
+ assert(::Point::Vector::D1)
16
+ end
17
+
18
+ require "matrix"
19
+ class C < ::Vector
20
+ include ::Point::Vector::D1
21
+ end
22
+
23
+ def test_new
24
+ assert(C[0])
25
+ end
26
+
27
+ def test_index
28
+ e0 = fake_n
29
+ c = C[e0]
30
+ assert_equal(e0, c[0])
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end