gmath3D 0.2.2 → 0.2.3
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/VERSION +1 -1
- data/gmath3D.gemspec +4 -2
- data/lib/box.rb +13 -0
- data/lib/ellipse.rb +11 -0
- data/lib/finite_line.rb +19 -1
- data/lib/gmath3D.rb +2 -0
- data/lib/polyline.rb +2 -0
- data/lib/rectangle.rb +2 -0
- data/lib/tri_mesh.rb +3 -1
- data/lib/triangle.rb +3 -1
- data/lib/util.rb +10 -1
- data/lib/vector3.rb +24 -0
- data/test/test_box.rb +24 -0
- data/test/test_ellipse.rb +55 -0
- data/test/test_finite_line.rb +21 -0
- data/test/test_polyline.rb +7 -0
- data/test/test_rectangle.rb +9 -0
- data/test/test_tri_mesh.rb +9 -0
- data/test/test_triangle.rb +9 -0
- data/test/test_vector3.rb +39 -1
- metadata +9 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/gmath3D.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gmath3D}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Toshiyasu Shimizu"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-11-03}
|
13
13
|
s.description = %q{This library defines 3D geometric elements(point, line, plane etc..). It can get two(or more) elements relation, like distance between two elements.}
|
14
14
|
s.email = %q{toshi0328@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION",
|
27
27
|
"gmath3D.gemspec",
|
28
28
|
"lib/box.rb",
|
29
|
+
"lib/ellipse.rb",
|
29
30
|
"lib/finite_line.rb",
|
30
31
|
"lib/geom.rb",
|
31
32
|
"lib/gmath3D.rb",
|
@@ -41,6 +42,7 @@ Gem::Specification.new do |s|
|
|
41
42
|
"lib/vector3.rb",
|
42
43
|
"test/helper.rb",
|
43
44
|
"test/test_box.rb",
|
45
|
+
"test/test_ellipse.rb",
|
44
46
|
"test/test_finite_line.rb",
|
45
47
|
"test/test_geom.rb",
|
46
48
|
"test/test_line.rb",
|
data/lib/box.rb
CHANGED
@@ -28,6 +28,18 @@ public
|
|
28
28
|
@max_point.z = [ point1.z, point2.z ].max
|
29
29
|
end
|
30
30
|
|
31
|
+
# [Input]
|
32
|
+
# _points_ should be Array of Vector3.
|
33
|
+
# Each points are opposing corners.
|
34
|
+
# [Output]
|
35
|
+
# return new instance of Box.
|
36
|
+
def self.from_points( points )
|
37
|
+
return nil if (points == nil || points.size <=0)
|
38
|
+
box = Box.new(points[0], points[0])
|
39
|
+
box += points
|
40
|
+
return box
|
41
|
+
end
|
42
|
+
|
31
43
|
def to_s
|
32
44
|
"Box[min#{min_point.to_element_s}, max#{max_point.to_element_s}]"
|
33
45
|
end
|
@@ -71,6 +83,7 @@ private
|
|
71
83
|
true
|
72
84
|
end
|
73
85
|
def add(rhs)
|
86
|
+
return self if (rhs == nil)
|
74
87
|
if( rhs.kind_of?(Vector3))
|
75
88
|
added_box = Box.new()
|
76
89
|
added_box.min_point.x = [ self.min_point.x, rhs.x ].min
|
data/lib/ellipse.rb
ADDED
data/lib/finite_line.rb
CHANGED
@@ -9,11 +9,13 @@ public
|
|
9
9
|
attr_accessor :start_point
|
10
10
|
attr_accessor :end_point
|
11
11
|
|
12
|
+
include BoxAvailable
|
13
|
+
|
12
14
|
# [Input]
|
13
15
|
# _start_point_ and _end_point_ should be Vector3.
|
14
16
|
# [Output]
|
15
17
|
# return new instance as FiniteLine
|
16
|
-
def initialize(start_point = Vector3.new(0
|
18
|
+
def initialize(start_point = Vector3.new(0,0,0), end_point = Vector3.new(1,0,0))
|
17
19
|
Util.check_arg_type(Vector3, start_point)
|
18
20
|
Util.check_arg_type(Vector3, end_point)
|
19
21
|
super()
|
@@ -30,6 +32,16 @@ public
|
|
30
32
|
"FiniteLine[from#{start_point.to_element_s}, to#{end_point.to_element_s}]"
|
31
33
|
end
|
32
34
|
|
35
|
+
# [Input]
|
36
|
+
# _mat_ should be Matrix which row and col size are 3.
|
37
|
+
# [Output]
|
38
|
+
# return rotated FiniteLine.
|
39
|
+
def rotate(mat)
|
40
|
+
rot_start_point = mat*start_point
|
41
|
+
rot_end_point = mat*end_point
|
42
|
+
return FiniteLine.new(rot_start_point, rot_end_point)
|
43
|
+
end
|
44
|
+
|
33
45
|
# [Input]
|
34
46
|
# _rhs_ should be FiniteLine.
|
35
47
|
# [Output]
|
@@ -42,6 +54,12 @@ public
|
|
42
54
|
return true
|
43
55
|
end
|
44
56
|
|
57
|
+
# [Output]
|
58
|
+
# return Array of start_point and end_point.
|
59
|
+
def vertices
|
60
|
+
return [start_point, end_point]
|
61
|
+
end
|
62
|
+
|
45
63
|
# [Output]
|
46
64
|
# return direction as vector from start_point to end_point as Vector3
|
47
65
|
def direction
|
data/lib/gmath3D.rb
CHANGED
data/lib/polyline.rb
CHANGED
data/lib/rectangle.rb
CHANGED
data/lib/tri_mesh.rb
CHANGED
@@ -8,6 +8,8 @@ module GMath3D
|
|
8
8
|
attr_reader :vertices
|
9
9
|
attr_reader :tri_indices
|
10
10
|
|
11
|
+
include BoxAvailable
|
12
|
+
|
11
13
|
# [Input]
|
12
14
|
# vertices is Array of Vector3.
|
13
15
|
# tri_indices is Array of triangle whick is consist of 3 vertices index.
|
@@ -204,7 +206,7 @@ module GMath3D
|
|
204
206
|
"TriMesh[triangle_count:#{tri_indices.size}, vertex_count:#{vertices.size}]"
|
205
207
|
end
|
206
208
|
|
207
|
-
|
209
|
+
# [Input]
|
208
210
|
# _index_ is index of triangle.
|
209
211
|
# [Output]
|
210
212
|
# return new instance of Triangle.
|
data/lib/triangle.rb
CHANGED
data/lib/util.rb
CHANGED
@@ -5,11 +5,20 @@ module GMath3D
|
|
5
5
|
raise(ArgumentError::new("type mismatch: #{instance.class} for #{type}"))
|
6
6
|
end
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def self.raise_argurment_error(instance)
|
10
10
|
raise(ArgumentError::new("type mismatch: #{instance.class}"))
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
# Including 'vertices' methodshould be implimented that gets geometry vertices as Array of Vector3.
|
15
|
+
module BoxAvailable
|
16
|
+
# [Output]
|
17
|
+
# return axially aligned bounding box as Box.
|
18
|
+
def box
|
19
|
+
return Box.from_points( vertices )
|
20
|
+
end
|
21
|
+
end
|
13
22
|
end
|
14
23
|
|
15
24
|
class Array
|
data/lib/vector3.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: cp932 -*-
|
1
2
|
require 'gmath3D'
|
2
3
|
|
3
4
|
module GMath3D
|
@@ -49,6 +50,12 @@ public
|
|
49
50
|
equals_inner(rhs)
|
50
51
|
end
|
51
52
|
|
53
|
+
# [Output]
|
54
|
+
# return axially aligned bounding box as Box.
|
55
|
+
def box
|
56
|
+
return Box.new(self, self)
|
57
|
+
end
|
58
|
+
|
52
59
|
# [Input]
|
53
60
|
# _rhs_ should be Vector3.
|
54
61
|
# [Output]
|
@@ -102,6 +109,23 @@ public
|
|
102
109
|
self.x*rhs.y - self.y*rhs.x)
|
103
110
|
end
|
104
111
|
|
112
|
+
# [Output]
|
113
|
+
# return orthogonal vector as Vector3.
|
114
|
+
def arbitrary_orthogonal
|
115
|
+
return Vector3.new() if(self.length < self.tolerance)
|
116
|
+
|
117
|
+
if(!self.parallel?( Vector3.new(0.0, 1.0, 0.0) ))
|
118
|
+
un_parallel_vec = Vector3.new(0.0,1.0,0.0)
|
119
|
+
elsif(!self.parallel?( Vector3.new(0.0,0.0,1.0) ))
|
120
|
+
un_parallel_vec = Vector3.new(0.0,0.0,1.0)
|
121
|
+
else
|
122
|
+
un_parallel_vec = Vector3.new(1.0,0.0,0.0)
|
123
|
+
end
|
124
|
+
|
125
|
+
orthogonal = self.cross(un_parallel_vec)
|
126
|
+
return orthogonal.normalize
|
127
|
+
end
|
128
|
+
|
105
129
|
# [Output]
|
106
130
|
# return vector length as Numeric
|
107
131
|
def length
|
data/test/test_box.rb
CHANGED
@@ -40,6 +40,30 @@ class BoxTestCase < MiniTest::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_from_points
|
44
|
+
points = Array.new(6)
|
45
|
+
points[0] = Vector3.new( 3, 0, 1)
|
46
|
+
points[1] = Vector3.new( 2,-2, 10)
|
47
|
+
points[2] = Vector3.new(-6, 2, -4)
|
48
|
+
points[3] = Vector3.new( 3, 5, -1)
|
49
|
+
points[4] = Vector3.new(-2, 2, 2)
|
50
|
+
points[5] = Vector3.new(11, 1, 0)
|
51
|
+
box = Box.from_points(points)
|
52
|
+
assert_equal(Vector3.new(-6, -2, -4), box.min_point)
|
53
|
+
assert_equal(Vector3.new(11, 5, 10), box.max_point)
|
54
|
+
|
55
|
+
points = Array.new(2)
|
56
|
+
points[0] = Vector3.new( -3, -2, -1)
|
57
|
+
points[1] = Vector3.new( -4, -8, -10)
|
58
|
+
box = Box.from_points(points)
|
59
|
+
assert_equal(Vector3.new(-4, -8, -10), box.min_point)
|
60
|
+
assert_equal(Vector3.new(-3, -2, -1), box.max_point)
|
61
|
+
|
62
|
+
points = Array.new(0)
|
63
|
+
box = Box.from_points(points)
|
64
|
+
assert_equal(nil, box)
|
65
|
+
end
|
66
|
+
|
43
67
|
def test_equal
|
44
68
|
shallow_copied = @box
|
45
69
|
assert( shallow_copied == @box )
|
@@ -0,0 +1,55 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
include GMath3D
|
5
|
+
|
6
|
+
MiniTest::Unit.autorun
|
7
|
+
|
8
|
+
class EllipseTestCase < MiniTest::Unit::TestCase
|
9
|
+
def test_initialize
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_equals
|
16
|
+
=begin
|
17
|
+
line = FiniteLine.new()
|
18
|
+
shallow_copied = line
|
19
|
+
assert(line == shallow_copied)
|
20
|
+
assert(line.equal?(shallow_copied))
|
21
|
+
assert(line != nil)
|
22
|
+
assert(line != "string")
|
23
|
+
|
24
|
+
assert_equal(FiniteLine.new(Vector3.new(1,2,3), Vector3.new(2,3,4)),
|
25
|
+
FiniteLine.new(Vector3.new(1.0,2.0,3.0), Vector3.new(2.0,3.0,4.0)))
|
26
|
+
|
27
|
+
assert(FiniteLine.new(Vector3.new(1,2,3), Vector3.new(2,3,4)) == FiniteLine.new(Vector3.new(1.0,2.0,3.0), Vector3.new(2.0,3.0,4.0)))
|
28
|
+
assert(FiniteLine.new(Vector3.new(1,2,3), Vector3.new(2,3,3)) != FiniteLine.new(Vector3.new(1.0,2.0,3.0), Vector3.new(2.0,3.0,4.0)))
|
29
|
+
assert(FiniteLine.new(Vector3.new(1,2,3), Vector3.new(2,3,4)) != FiniteLine.new(Vector3.new(2,3,4), Vector3.new(1,2,3)))
|
30
|
+
line = FiniteLine.new(Vector3.new(1,0,2), Vector3.new(1,-3.5,2))
|
31
|
+
assert_equal("FiniteLine[from[1, 0, 2], to[1, -3.5, 2]]", line.to_s)
|
32
|
+
=end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_clone
|
36
|
+
=begin
|
37
|
+
line = FiniteLine.new()
|
38
|
+
shallow_copied = line
|
39
|
+
shallow_copied.start_point.x = -1
|
40
|
+
assert(line == shallow_copied)
|
41
|
+
assert(line.equal?(shallow_copied))
|
42
|
+
assert_equal(-1, shallow_copied.start_point.x)
|
43
|
+
|
44
|
+
cloned = line.clone
|
45
|
+
assert(line == cloned)
|
46
|
+
assert(!line.equal?(cloned))
|
47
|
+
cloned.start_point.x = -2
|
48
|
+
assert_equal(-2, cloned.start_point.x)
|
49
|
+
|
50
|
+
assert_equal(-1, line.start_point.x) # original never changed in editing cloned one.
|
51
|
+
=end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
data/test/test_finite_line.rb
CHANGED
@@ -24,6 +24,15 @@ class FiniteLineTestCase < MiniTest::Unit::TestCase
|
|
24
24
|
assert_equal("FiniteLine[from[1, 0, 2], to[1, -3.5, 2]]", line.to_s)
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_rotation
|
28
|
+
line = FiniteLine.new(Vector3.new(1,0,0), Vector3.new(2,0,0))
|
29
|
+
angle = -45.0 * Math::PI / 180.0
|
30
|
+
mat = Matrix.from_axis( Vector3.new(0,0,1), angle )
|
31
|
+
rotated_line = line.rotate(mat)
|
32
|
+
assert_equal(Vector3.new(Math.sqrt(2)/2.0,Math.sqrt(2)/2.0,0), rotated_line.start_point)
|
33
|
+
assert_equal(Vector3.new(Math.sqrt(2),Math.sqrt(2),0), rotated_line.end_point)
|
34
|
+
end
|
35
|
+
|
27
36
|
def test_equals
|
28
37
|
line = FiniteLine.new()
|
29
38
|
shallow_copied = line
|
@@ -57,6 +66,18 @@ class FiniteLineTestCase < MiniTest::Unit::TestCase
|
|
57
66
|
assert_equal(-1, line.start_point.x) # original never changed in editing cloned one.
|
58
67
|
end
|
59
68
|
|
69
|
+
def test_box
|
70
|
+
start_point_tmp = Vector3.new(1.0, 0.0, 2.0)
|
71
|
+
end_point_tmp = Vector3.new(1.0, -3.5, 5.0)
|
72
|
+
line = FiniteLine.new(start_point_tmp, end_point_tmp)
|
73
|
+
assert_equal(Vector3.new(1, -3.5, 2), line.box.min_point)
|
74
|
+
assert_equal(Vector3.new(1, 0, 5), line.box.max_point)
|
75
|
+
|
76
|
+
line = FiniteLine.new()
|
77
|
+
assert_equal(Vector3.new(), line.box.min_point)
|
78
|
+
assert_equal(Vector3.new(1,0,0), line.box.max_point)
|
79
|
+
end
|
80
|
+
|
60
81
|
def test_direction
|
61
82
|
start_point_tmp = Vector3.new(1.0, 0.0, 2.0)
|
62
83
|
end_point_tmp = Vector3.new(1.0, -3.5, 1.0)
|
data/test/test_polyline.rb
CHANGED
@@ -79,6 +79,13 @@ class PolylineTestCase < MiniTest::Unit::TestCase
|
|
79
79
|
@polyline_closed.to_s);
|
80
80
|
end
|
81
81
|
|
82
|
+
def test_box
|
83
|
+
assert_equal(Vector3.new(0,0,0), @polyline_open.box.min_point)
|
84
|
+
assert_equal(Vector3.new(3,2,1), @polyline_open.box.max_point)
|
85
|
+
assert_equal(Vector3.new(0,0,0), @polyline_closed.box.min_point)
|
86
|
+
assert_equal(Vector3.new(3,2,1), @polyline_closed.box.max_point)
|
87
|
+
end
|
88
|
+
|
82
89
|
def test_center
|
83
90
|
assert_equal(Vector3.new(1.5, 1.0, 1.0/6.0), @polyline_open.center)
|
84
91
|
assert_equal(Vector3.new(1.5, 1.0, 1.0/6.0), @polyline_closed.center)
|
data/test/test_rectangle.rb
CHANGED
@@ -61,6 +61,15 @@ class RectangleTestCase < MiniTest::Unit::TestCase
|
|
61
61
|
assert_equal("Rectangle[base[1, 2, 3], u[0, -0.5, 0], v[0, 0, 2]", @rectangle.to_s)
|
62
62
|
end
|
63
63
|
|
64
|
+
def test_box
|
65
|
+
box1 = @rectangle.box
|
66
|
+
box2 = @rectangle_default.box
|
67
|
+
assert_equal(Vector3.new(1, 1.5, 3), box1.min_point)
|
68
|
+
assert_equal(Vector3.new(1, 2, 5), box1.max_point)
|
69
|
+
assert_equal(Vector3.new(0, 0, 0), box2.min_point)
|
70
|
+
assert_equal(Vector3.new(1, 1, 0), box2.max_point)
|
71
|
+
end
|
72
|
+
|
64
73
|
def test_point
|
65
74
|
point = @rectangle.point(0.2, 1.0)
|
66
75
|
assert_equal(Vector3.new(1, 1.9, 5), point)
|
data/test/test_tri_mesh.rb
CHANGED
@@ -88,6 +88,15 @@ class TriMeshTestCase < MiniTest::Unit::TestCase
|
|
88
88
|
assert_equal( "TriMesh[triangle_count:12, vertex_count:8]", get_box_mesh().to_s)
|
89
89
|
end
|
90
90
|
|
91
|
+
def test_box
|
92
|
+
box_mesh = get_box_mesh
|
93
|
+
plane_mesh = get_plane_mesh
|
94
|
+
assert_equal( Vector3.new(-1,-1,-1), box_mesh.box.min_point )
|
95
|
+
assert_equal( Vector3.new( 2, 3, 4), box_mesh.box.max_point )
|
96
|
+
assert_equal( Vector3.new(-1,-1,-1), plane_mesh.box.min_point )
|
97
|
+
assert_equal( Vector3.new( 1, 3,-1), plane_mesh.box.max_point )
|
98
|
+
end
|
99
|
+
|
91
100
|
def test_triangles
|
92
101
|
vertices = [Vector3.new(0,0,0),Vector3.new(2,0,0),Vector3.new(2,2,0),Vector3.new(0,2,0)]
|
93
102
|
tri_indices = [[0,1,3],[1,2,3]]
|
data/test/test_triangle.rb
CHANGED
@@ -55,6 +55,15 @@ class TriangleTestCase < MiniTest::Unit::TestCase
|
|
55
55
|
assert_equal("Triangle[[1, 2, 2], [1, 4, 2], [-1, 3, 0]]", @triangle.to_s)
|
56
56
|
end
|
57
57
|
|
58
|
+
def test_box
|
59
|
+
box1 = @triangle.box
|
60
|
+
box2 = @triangle_default.box
|
61
|
+
assert_equal(Vector3.new(-1,2,0), box1.min_point)
|
62
|
+
assert_equal(Vector3.new(1,4,2), box1.max_point)
|
63
|
+
assert_equal(Vector3.new(0,0,0) , box2.min_point)
|
64
|
+
assert_equal(Vector3.new(1,1,0) , box2.max_point)
|
65
|
+
end
|
66
|
+
|
58
67
|
def test_point
|
59
68
|
assert_equal(@triangle.vertices[0], @triangle.point( Array.new([1,0,0])))
|
60
69
|
assert_equal(@triangle.vertices[1], @triangle.point( Array.new([0,1,0])))
|
data/test/test_vector3.rb
CHANGED
@@ -144,6 +144,15 @@ class Vector3TestCase < MiniTest::Unit::TestCase
|
|
144
144
|
assert_equal(3, hash[vec])
|
145
145
|
end
|
146
146
|
|
147
|
+
def test_box
|
148
|
+
box1 = @vector.box
|
149
|
+
box2 = Vector3.new().box
|
150
|
+
assert_equal(Vector3.new(1,2,3), box1.min_point)
|
151
|
+
assert_equal(Vector3.new(1,2,3), box1.max_point)
|
152
|
+
assert_equal(Vector3.new(), box2.min_point)
|
153
|
+
assert_equal(Vector3.new(), box2.max_point)
|
154
|
+
end
|
155
|
+
|
147
156
|
def test_add
|
148
157
|
vector = Vector3.new(4,5,6)
|
149
158
|
addedVector = vector + @vector
|
@@ -397,5 +406,34 @@ class Vector3TestCase < MiniTest::Unit::TestCase
|
|
397
406
|
assert_equal( 0, matrix[2,0])
|
398
407
|
end
|
399
408
|
|
400
|
-
|
409
|
+
def test_arbitrary_orthogonal
|
410
|
+
vec1 = Vector3.new( 1.0, 2.0, 3.0 )
|
411
|
+
vec2 = Vector3.new( 1.0, 1.0, 4.0 )
|
412
|
+
vec3 = Vector3.new( 2.0, 4.0, 6.0 )
|
413
|
+
vec4 = Vector3.new( -1.0, -2.0, -3.0 )
|
414
|
+
vecx = Vector3.new( 1.0, 0.0, 0.0 )
|
415
|
+
vecy = Vector3.new( 0.0, -3.0, 0.0 )
|
416
|
+
vecz = Vector3.new( 0.0, 0.0, 5.0 )
|
417
|
+
veczero = Vector3.new( 0.0, 0.0, 0.0 )
|
418
|
+
|
419
|
+
vec1_orth = vec1.arbitrary_orthogonal
|
420
|
+
vec2_orth = vec2.arbitrary_orthogonal
|
421
|
+
vec3_orth = vec3.arbitrary_orthogonal
|
422
|
+
vec4_orth = vec4.arbitrary_orthogonal
|
423
|
+
vecx_orth = vecx.arbitrary_orthogonal
|
424
|
+
vecy_orth = vecy.arbitrary_orthogonal
|
425
|
+
vecz_orth = vecz.arbitrary_orthogonal
|
426
|
+
veczero_orth = veczero.arbitrary_orthogonal
|
427
|
+
|
428
|
+
assert_in_delta(0.5*Math::PI, vec1.angle(vec1_orth), vec1.tolerance)
|
429
|
+
assert_in_delta(0.5*Math::PI, vec2.angle(vec2_orth), vec2.tolerance)
|
430
|
+
assert_in_delta(0.5*Math::PI, vec3.angle(vec3_orth), vec3.tolerance)
|
431
|
+
assert_in_delta(0.5*Math::PI, vec4.angle(vec4_orth), vec4.tolerance)
|
432
|
+
assert_in_delta(0.5*Math::PI, vecx.angle(vecx_orth), vecx.tolerance)
|
433
|
+
assert_in_delta(0.5*Math::PI, vecy.angle(vecy_orth), vecy.tolerance)
|
434
|
+
assert_in_delta(0.5*Math::PI, vecz.angle(vecz_orth), vecz.tolerance)
|
435
|
+
assert_in_delta(0.0, veczero_orth.x, veczero.tolerance)
|
436
|
+
assert_in_delta(0.0, veczero_orth.y, veczero.tolerance)
|
437
|
+
assert_in_delta(0.0, veczero_orth.z, veczero.tolerance)
|
438
|
+
end
|
401
439
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmath3D
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-03 00:00:00.000000000 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
17
|
-
requirement: &
|
17
|
+
requirement: &2156037040 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.0.0
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2156037040
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: jeweler
|
28
|
-
requirement: &
|
28
|
+
requirement: &2156035880 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 1.6.4
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2156035880
|
37
37
|
description: This library defines 3D geometric elements(point, line, plane etc..).
|
38
38
|
It can get two(or more) elements relation, like distance between two elements.
|
39
39
|
email: toshi0328@gmail.com
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- VERSION
|
53
53
|
- gmath3D.gemspec
|
54
54
|
- lib/box.rb
|
55
|
+
- lib/ellipse.rb
|
55
56
|
- lib/finite_line.rb
|
56
57
|
- lib/geom.rb
|
57
58
|
- lib/gmath3D.rb
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- lib/vector3.rb
|
68
69
|
- test/helper.rb
|
69
70
|
- test/test_box.rb
|
71
|
+
- test/test_ellipse.rb
|
70
72
|
- test/test_finite_line.rb
|
71
73
|
- test/test_geom.rb
|
72
74
|
- test/test_line.rb
|
@@ -95,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
97
|
version: '0'
|
96
98
|
segments:
|
97
99
|
- 0
|
98
|
-
hash:
|
100
|
+
hash: 3556461112353261793
|
99
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
102
|
none: false
|
101
103
|
requirements:
|