sixarm_ruby_geometry 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +18 -0
- data/lib/sixarm_ruby_geometry.rb +41 -0
- data/lib/sixarm_ruby_geometry/indexable.rb +7 -0
- data/lib/sixarm_ruby_geometry/indexable/d1.rb +12 -0
- data/lib/sixarm_ruby_geometry/indexable/d2.rb +12 -0
- data/lib/sixarm_ruby_geometry/indexable/d3.rb +12 -0
- data/lib/sixarm_ruby_geometry/indexable/pitch.rb +15 -0
- data/lib/sixarm_ruby_geometry/indexable/rad.rb +15 -0
- data/lib/sixarm_ruby_geometry/indexable/width.rb +20 -0
- data/lib/sixarm_ruby_geometry/indexable/width_height.rb +30 -0
- data/lib/sixarm_ruby_geometry/indexable/width_height_depth.rb +40 -0
- data/lib/sixarm_ruby_geometry/indexable/x.rb +18 -0
- data/lib/sixarm_ruby_geometry/indexable/xy.rb +26 -0
- data/lib/sixarm_ruby_geometry/indexable/xyz.rb +40 -0
- data/lib/sixarm_ruby_geometry/indexable/yaw.rb +15 -0
- data/lib/sixarm_ruby_geometry/point.rb +7 -0
- data/lib/sixarm_ruby_geometry/point/array.rb +12 -0
- data/lib/sixarm_ruby_geometry/point/array/d1.rb +14 -0
- data/lib/sixarm_ruby_geometry/point/array/d2.rb +14 -0
- data/lib/sixarm_ruby_geometry/point/array/d3.rb +14 -0
- data/lib/sixarm_ruby_geometry/point/vector.rb +12 -0
- data/lib/sixarm_ruby_geometry/point/vector/d1.rb +14 -0
- data/lib/sixarm_ruby_geometry/point/vector/d2.rb +14 -0
- data/lib/sixarm_ruby_geometry/point/vector/d3.rb +14 -0
- data/lib/sixarm_ruby_geometry/space.rb +7 -0
- data/lib/sixarm_ruby_geometry/space/array.rb +12 -0
- data/lib/sixarm_ruby_geometry/space/array/d1.rb +14 -0
- data/lib/sixarm_ruby_geometry/space/array/d2.rb +14 -0
- data/lib/sixarm_ruby_geometry/space/array/d3.rb +14 -0
- data/lib/sixarm_ruby_geometry/space/vector.rb +12 -0
- data/lib/sixarm_ruby_geometry/space/vector/d1.rb +14 -0
- data/lib/sixarm_ruby_geometry/space/vector/d2.rb +14 -0
- data/lib/sixarm_ruby_geometry/space/vector/d3.rb +14 -0
- data/test/sixarm_ruby_geometry_test.rb +1 -0
- data/test/sixarm_ruby_geometry_test/indexable/d1_test.rb +34 -0
- data/test/sixarm_ruby_geometry_test/indexable/d2_test.rb +36 -0
- data/test/sixarm_ruby_geometry_test/indexable/d3_test.rb +38 -0
- data/test/sixarm_ruby_geometry_test/indexable/pitch_test.rb +36 -0
- data/test/sixarm_ruby_geometry_test/indexable/rad_test.rb +31 -0
- data/test/sixarm_ruby_geometry_test/indexable/width_height_depth_test.rb +70 -0
- data/test/sixarm_ruby_geometry_test/indexable/width_height_test.rb +56 -0
- data/test/sixarm_ruby_geometry_test/indexable/width_test.rb +42 -0
- data/test/sixarm_ruby_geometry_test/indexable/x_test.rb +42 -0
- data/test/sixarm_ruby_geometry_test/indexable/xy_test.rb +56 -0
- data/test/sixarm_ruby_geometry_test/indexable/xyz_test.rb +72 -0
- data/test/sixarm_ruby_geometry_test/indexable/yaw_test.rb +31 -0
- data/test/sixarm_ruby_geometry_test/indexable_test.rb +31 -0
- data/test/sixarm_ruby_geometry_test/point/array/d1_test.rb +35 -0
- data/test/sixarm_ruby_geometry_test/point/array/d2_test.rb +37 -0
- data/test/sixarm_ruby_geometry_test/point/array/d3_test.rb +39 -0
- data/test/sixarm_ruby_geometry_test/point/array_test.rb +33 -0
- data/test/sixarm_ruby_geometry_test/point/vector/d1_test.rb +36 -0
- data/test/sixarm_ruby_geometry_test/point/vector/d2_test.rb +38 -0
- data/test/sixarm_ruby_geometry_test/point/vector/d3_test.rb +40 -0
- data/test/sixarm_ruby_geometry_test/point/vector_test.rb +34 -0
- data/test/sixarm_ruby_geometry_test/point_test.rb +25 -0
- data/test/sixarm_ruby_geometry_test/space/array/d1_test.rb +35 -0
- data/test/sixarm_ruby_geometry_test/space/array/d2_test.rb +37 -0
- data/test/sixarm_ruby_geometry_test/space/array/d3_test.rb +39 -0
- data/test/sixarm_ruby_geometry_test/space/array_test.rb +33 -0
- data/test/sixarm_ruby_geometry_test/space/vector/d1_test.rb +36 -0
- data/test/sixarm_ruby_geometry_test/space/vector/d2_test.rb +38 -0
- data/test/sixarm_ruby_geometry_test/space/vector/d3_test.rb +40 -0
- data/test/sixarm_ruby_geometry_test/space/vector_test.rb +34 -0
- data/test/sixarm_ruby_geometry_test/space_test.rb +25 -0
- metadata +262 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eedd0bba34e7feed95380845cb2fef6a5209da2a
|
4
|
+
data.tar.gz: 8778ff4c945d83045655413b80cf48bd2ce10519
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c3df36dec2056d227ecd60314ac0afc140f530da2eae4bf5b5ade559ec218d749ff6a0edbdc54c410a255256ad964f9a294738dd141a389a206779f99a3c5b17
|
7
|
+
data.tar.gz: e0552060e12e25e88ee913d269f8c374c38a94f1e4de49b873c99e81c541675e1e1810ae5a892ccf61400b099f367542e8bd95aeba0b203bba3c7a2a5b5c9b40
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "rake"
|
3
|
+
require "rake/testtask"
|
4
|
+
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
$:<<'lib'
|
8
|
+
|
9
|
+
task :test do
|
10
|
+
require "simplecov"
|
11
|
+
SimpleCov.start do
|
12
|
+
add_filter "/test/"
|
13
|
+
end
|
14
|
+
$:<<'test'
|
15
|
+
Dir.glob('./test/**/*.rb').each{|file| require file }
|
16
|
+
end
|
17
|
+
|
18
|
+
task :default => [:test]
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require "matrix"
|
4
|
+
|
5
|
+
SOURCES = %w"5
|
6
|
+
point
|
7
|
+
point/array
|
8
|
+
point/array/d1
|
9
|
+
point/array/d2
|
10
|
+
point/array/d3
|
11
|
+
point/vector
|
12
|
+
point/vector/d1
|
13
|
+
point/vector/d2
|
14
|
+
point/vector/d3
|
15
|
+
indexable
|
16
|
+
indexable/d1
|
17
|
+
indexable/d2
|
18
|
+
indexable/d3
|
19
|
+
indexable/pitch
|
20
|
+
indexable/rad
|
21
|
+
indexable/width
|
22
|
+
indexable/width_height
|
23
|
+
indexable/width_height_depth
|
24
|
+
indexable/x
|
25
|
+
indexable/xy
|
26
|
+
indexable/xyz
|
27
|
+
indexable/yaw
|
28
|
+
space
|
29
|
+
space/array
|
30
|
+
space/array/d1
|
31
|
+
space/array/d2
|
32
|
+
space/array/d3
|
33
|
+
space/vector
|
34
|
+
space/vector/d1
|
35
|
+
space/vector/d2
|
36
|
+
space/vector/d3
|
37
|
+
"
|
38
|
+
|
39
|
+
SOURCES.map{|x|
|
40
|
+
require File.dirname(__FILE__) + "/sixarm_ruby_geometry/#{x}.rb"
|
41
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
##
|
4
|
+
# Indexable #pitch method.
|
5
|
+
#
|
6
|
+
module Indexable
|
7
|
+
module Pitch
|
8
|
+
|
9
|
+
# Calculate the xy-plane angle to the z-coordinate.
|
10
|
+
def pitch
|
11
|
+
Math::atan2(self[2], Math::sqrt(self[0]**2 + self[1]**2))
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
##
|
4
|
+
# Accessors for #width, #height.
|
5
|
+
#
|
6
|
+
module Indexable
|
7
|
+
module WidthHeight
|
8
|
+
|
9
|
+
# Get width.
|
10
|
+
def width
|
11
|
+
self[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
# Set width.
|
15
|
+
def width=(width)
|
16
|
+
self[0]=width
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get height.
|
20
|
+
def height
|
21
|
+
self[1]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set height.
|
25
|
+
def height=(height)
|
26
|
+
self[1]=height
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
##
|
4
|
+
# Accessors for #width, #height, #depth.
|
5
|
+
#
|
6
|
+
module Indexable
|
7
|
+
module WidthHeightDepth
|
8
|
+
|
9
|
+
# Get width.
|
10
|
+
def width
|
11
|
+
self[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
# Set width.
|
15
|
+
def width=(width)
|
16
|
+
self[0]=width
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get height.
|
20
|
+
def height
|
21
|
+
self[1]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set height.
|
25
|
+
def height=(height)
|
26
|
+
self[1]=height
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get depth.
|
30
|
+
def depth
|
31
|
+
self[2]
|
32
|
+
end
|
33
|
+
|
34
|
+
# Set depth.
|
35
|
+
def depth=(depth)
|
36
|
+
self[2]=depth
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
##
|
4
|
+
# Accessors for #x, #y.
|
5
|
+
#
|
6
|
+
module Indexable
|
7
|
+
module XY
|
8
|
+
|
9
|
+
def x
|
10
|
+
self[0]
|
11
|
+
end
|
12
|
+
|
13
|
+
def x=(x)
|
14
|
+
self[0]=x
|
15
|
+
end
|
16
|
+
|
17
|
+
def y
|
18
|
+
self[1]
|
19
|
+
end
|
20
|
+
|
21
|
+
def y=(y)
|
22
|
+
self[1]=y
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
##
|
4
|
+
# Accessors for #x, #y, #z.
|
5
|
+
#
|
6
|
+
module Indexable
|
7
|
+
module XYZ
|
8
|
+
|
9
|
+
# Get x.
|
10
|
+
def x
|
11
|
+
self[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
# Set x.
|
15
|
+
def x=(x)
|
16
|
+
self[0]=x
|
17
|
+
end
|
18
|
+
|
19
|
+
# Get y.
|
20
|
+
def y
|
21
|
+
self[1]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set y.
|
25
|
+
def y=(y)
|
26
|
+
self[1]=y
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get z.
|
30
|
+
def z
|
31
|
+
self[2]
|
32
|
+
end
|
33
|
+
|
34
|
+
# Set z.
|
35
|
+
def z=(z)
|
36
|
+
self[2]=z
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|