rmath3d_plain 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/rmath3d/rmath3d_plain.rb +36 -36
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '012448e35e21dcb667f5b8f5fc15be090c982743'
|
4
|
+
data.tar.gz: 0620adc32283fe56718594e9f8803c1ef72a1b69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 541096f10e839b1788a1491fce0ff82f2b8db511b770919ddcd2eeddec6da7c98fa8974749255e6d7f4f0af21a2c3a03ef8ebdb05e96490dd0168155eeb8c8d7
|
7
|
+
data.tar.gz: 2fe0ce58b9ae8c9295b0bcb111ccfe53e24eafe012035cec4fab4e8ba67d692b1592596de2d10c0f5b1a88eb88ddae1327f1a21d45561fee1aa35f69d7bdf25b
|
data/ChangeLog
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
2017-07-22 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
|
+
|
3
|
+
* Added 'Integer' type for argument type branching (constant ::Fixnum is deprecated since ruby 2.4).
|
4
|
+
|
1
5
|
2015-08-23 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
6
|
|
3
7
|
* rmath3d.c (def ==): Removed control path returning Qnil.
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
rmath3d : Ruby math module for 3D Applications
|
2
|
-
Copyright (c) 2008-
|
2
|
+
Copyright (c) 2008-2017 vaiorabbit <http://twitter.com/vaiorabbit>
|
3
3
|
|
4
4
|
This software is provided 'as-is', without any express or implied
|
5
5
|
warranty. In no event will the authors be held liable for any damages
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ module RMath3D
|
|
29
29
|
0.0, 0.0 ]
|
30
30
|
when 1
|
31
31
|
case a[0]
|
32
|
-
when Fixnum,
|
32
|
+
when Float, Integer, Fixnum, Bignum
|
33
33
|
@e = [ a[0], a[0],
|
34
34
|
a[0], a[0] ]
|
35
35
|
when RMtx2
|
@@ -46,7 +46,7 @@ module RMath3D
|
|
46
46
|
for col in 0...2 do
|
47
47
|
index = 2*row + col
|
48
48
|
case a[index]
|
49
|
-
when Fixnum,
|
49
|
+
when Float, Integer, Fixnum, Bignum
|
50
50
|
setElement( row, col, a[index] )
|
51
51
|
else
|
52
52
|
raise TypeError, "RMtx2#initialize : Unknown type #{a[0].class}."
|
@@ -88,7 +88,7 @@ module RMath3D
|
|
88
88
|
#
|
89
89
|
def coerce
|
90
90
|
case arg
|
91
|
-
when
|
91
|
+
when Float, Integer, Fixnum, Bignum
|
92
92
|
return [ self, arg ]
|
93
93
|
else
|
94
94
|
raise TypeError, "RMtx2#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -411,7 +411,7 @@ module RMath3D
|
|
411
411
|
#
|
412
412
|
def *( arg )
|
413
413
|
case arg
|
414
|
-
when
|
414
|
+
when Float, Integer, Fixnum, Bignum
|
415
415
|
return RMtx2.new( arg*self.e00, arg*self.e01,
|
416
416
|
arg*self.e10, arg*self.e11 )
|
417
417
|
|
@@ -503,7 +503,7 @@ module RMath3D
|
|
503
503
|
#
|
504
504
|
def mul!( other )
|
505
505
|
case other
|
506
|
-
when
|
506
|
+
when Float, Integer, Fixnum, Bignum
|
507
507
|
self.e00 = other*self.e00
|
508
508
|
self.e01 = other*self.e01
|
509
509
|
self.e10 = other*self.e10
|
@@ -560,7 +560,7 @@ module RMath3D
|
|
560
560
|
0.0, 0.0, 0.0 ]
|
561
561
|
when 1
|
562
562
|
case a[0]
|
563
|
-
when Fixnum,
|
563
|
+
when Float, Integer, Fixnum, Bignum
|
564
564
|
@e = [ a[0], a[0], a[0],
|
565
565
|
a[0], a[0], a[0],
|
566
566
|
a[0], a[0], a[0] ]
|
@@ -579,7 +579,7 @@ module RMath3D
|
|
579
579
|
for col in 0...3 do
|
580
580
|
index = 3*row + col
|
581
581
|
case a[index]
|
582
|
-
when Fixnum,
|
582
|
+
when Float, Integer, Fixnum, Bignum
|
583
583
|
setElement( row, col, a[index] )
|
584
584
|
else
|
585
585
|
raise TypeError, "RMtx3#initialize : Unknown type #{a[0].class}."
|
@@ -622,7 +622,7 @@ module RMath3D
|
|
622
622
|
#
|
623
623
|
def coerce
|
624
624
|
case arg
|
625
|
-
when
|
625
|
+
when Float, Integer, Fixnum, Bignum
|
626
626
|
return [ self, arg ]
|
627
627
|
else
|
628
628
|
raise TypeError, "RMtx3#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -1098,7 +1098,7 @@ module RMath3D
|
|
1098
1098
|
#
|
1099
1099
|
def *( arg )
|
1100
1100
|
case arg
|
1101
|
-
when
|
1101
|
+
when Float, Integer, Fixnum, Bignum
|
1102
1102
|
return RMtx3.new( arg*self.e00, arg*self.e01, arg*self.e02,
|
1103
1103
|
arg*self.e10, arg*self.e11, arg*self.e12,
|
1104
1104
|
arg*self.e20, arg*self.e21, arg*self.e22 )
|
@@ -1191,7 +1191,7 @@ module RMath3D
|
|
1191
1191
|
#
|
1192
1192
|
def mul!( other )
|
1193
1193
|
case other
|
1194
|
-
when
|
1194
|
+
when Float, Integer, Fixnum, Bignum
|
1195
1195
|
self.e00 = other*self.e00
|
1196
1196
|
self.e01 = other*self.e01
|
1197
1197
|
self.e02 = other*self.e02
|
@@ -1259,7 +1259,7 @@ module RMath3D
|
|
1259
1259
|
0.0, 0.0, 0.0, 0.0 ]
|
1260
1260
|
when 1
|
1261
1261
|
case a[0]
|
1262
|
-
when Fixnum,
|
1262
|
+
when Float, Integer, Fixnum, Bignum
|
1263
1263
|
@e = [ a[0], a[0], a[0], a[0],
|
1264
1264
|
a[0], a[0], a[0], a[0],
|
1265
1265
|
a[0], a[0], a[0], a[0],
|
@@ -1280,7 +1280,7 @@ module RMath3D
|
|
1280
1280
|
for col in 0...4 do
|
1281
1281
|
index = 4*row + col
|
1282
1282
|
case a[index]
|
1283
|
-
when Fixnum,
|
1283
|
+
when Float, Integer, Fixnum, Bignum
|
1284
1284
|
setElement( row, col, a[index] )
|
1285
1285
|
else
|
1286
1286
|
raise TypeError, "RMtx4#initialize : Unknown type #{a[0].class}."
|
@@ -1324,7 +1324,7 @@ module RMath3D
|
|
1324
1324
|
#
|
1325
1325
|
def coerce
|
1326
1326
|
case arg
|
1327
|
-
when
|
1327
|
+
when Float, Integer, Fixnum, Bignum
|
1328
1328
|
return [ self, arg ]
|
1329
1329
|
else
|
1330
1330
|
raise TypeError, "RMtx4#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -2048,7 +2048,7 @@ module RMath3D
|
|
2048
2048
|
#
|
2049
2049
|
def *( arg )
|
2050
2050
|
case arg
|
2051
|
-
when
|
2051
|
+
when Float, Integer, Fixnum, Bignum
|
2052
2052
|
return RMtx4.new( arg*self.e00, arg*self.e01, arg*self.e02, arg*self.e03,
|
2053
2053
|
arg*self.e10, arg*self.e11, arg*self.e12, arg*self.e13,
|
2054
2054
|
arg*self.e20, arg*self.e21, arg*self.e22, arg*self.e23,
|
@@ -2142,7 +2142,7 @@ module RMath3D
|
|
2142
2142
|
#
|
2143
2143
|
def mul!( other )
|
2144
2144
|
case other
|
2145
|
-
when
|
2145
|
+
when Float, Integer, Fixnum, Bignum
|
2146
2146
|
self.e00 = other*self.e00
|
2147
2147
|
self.e01 = other*self.e01
|
2148
2148
|
self.e02 = other*self.e02
|
@@ -2224,7 +2224,7 @@ module RMath3D
|
|
2224
2224
|
@e = [0.0, 0.0, 0.0, 0.0]
|
2225
2225
|
when 1
|
2226
2226
|
case a[0]
|
2227
|
-
when Fixnum,
|
2227
|
+
when Float, Integer, Fixnum, Bignum
|
2228
2228
|
@e = [ a[0], a[0], a[0], a[0] ]
|
2229
2229
|
when RQuat
|
2230
2230
|
@e = [ a[0].x, a[0].y, a[0].z, a[0].w ]
|
@@ -2235,7 +2235,7 @@ module RMath3D
|
|
2235
2235
|
when 4
|
2236
2236
|
a.each_with_index do |elem, index|
|
2237
2237
|
case elem
|
2238
|
-
when Fixnum,
|
2238
|
+
when Float, Integer, Fixnum, Bignum
|
2239
2239
|
@e[index] = elem
|
2240
2240
|
else
|
2241
2241
|
raise TypeError, "RQuat#initialize : Unknown type #{elem.class}."
|
@@ -2274,7 +2274,7 @@ module RMath3D
|
|
2274
2274
|
#
|
2275
2275
|
def coerce( arg )
|
2276
2276
|
case arg
|
2277
|
-
when
|
2277
|
+
when Float, Integer, Fixnum, Bignum
|
2278
2278
|
return [ self, arg ]
|
2279
2279
|
else
|
2280
2280
|
raise TypeError, "RQuat#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -2613,7 +2613,7 @@ module RMath3D
|
|
2613
2613
|
z = q1w*q2z + q1x*q2y - q1y*q2x + q1z*q2w
|
2614
2614
|
w = q1w*q2w - q1x*q2x - q1y*q2y - q1z*q2z
|
2615
2615
|
return RQuat.new( x, y, z, w )
|
2616
|
-
when Fixnum,
|
2616
|
+
when Float, Integer, Fixnum, Bignum
|
2617
2617
|
return RQuat.new( @e[0]*arg, @e[1]*arg, @e[2]*arg, @e[3]*arg )
|
2618
2618
|
else
|
2619
2619
|
raise TypeError, "RQuat#* : Unknown type #{arg}."
|
@@ -2708,7 +2708,7 @@ module RMath3D
|
|
2708
2708
|
|
2709
2709
|
return self
|
2710
2710
|
|
2711
|
-
when Fixnum,
|
2711
|
+
when Float, Integer, Fixnum, Bignum
|
2712
2712
|
self.x *= other
|
2713
2713
|
self.y *= other
|
2714
2714
|
self.z *= other
|
@@ -2824,7 +2824,7 @@ module RMath3D
|
|
2824
2824
|
@e = [0.0, 0.0]
|
2825
2825
|
when 1
|
2826
2826
|
case a[0]
|
2827
|
-
when Fixnum,
|
2827
|
+
when Float, Integer, Fixnum, Bignum
|
2828
2828
|
@e = [ a[0], a[0] ]
|
2829
2829
|
when RVec2
|
2830
2830
|
@e = [ a[0].x, a[0].y ]
|
@@ -2835,7 +2835,7 @@ module RMath3D
|
|
2835
2835
|
when 2
|
2836
2836
|
a.each_with_index do |elem, index|
|
2837
2837
|
case elem
|
2838
|
-
when Fixnum,
|
2838
|
+
when Float, Integer, Fixnum, Bignum
|
2839
2839
|
@e[index] = elem
|
2840
2840
|
else
|
2841
2841
|
raise TypeError, "RVec2#initialize : Unknown type #{elem.class}."
|
@@ -2874,7 +2874,7 @@ module RMath3D
|
|
2874
2874
|
#
|
2875
2875
|
def coerce( arg )
|
2876
2876
|
case arg
|
2877
|
-
when
|
2877
|
+
when Float, Integer, Fixnum, Bignum
|
2878
2878
|
return [ self, arg ]
|
2879
2879
|
else
|
2880
2880
|
raise TypeError, "RVec2#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -3063,7 +3063,7 @@ module RMath3D
|
|
3063
3063
|
#
|
3064
3064
|
def *( arg )
|
3065
3065
|
case arg
|
3066
|
-
when Fixnum,
|
3066
|
+
when Float, Integer, Fixnum, Bignum
|
3067
3067
|
return RVec2.new( @e[0]*arg, @e[1]*arg )
|
3068
3068
|
else
|
3069
3069
|
raise TypeError, "RVec2#* : Unknown type #{arg}."
|
@@ -3129,7 +3129,7 @@ module RMath3D
|
|
3129
3129
|
# vec1 *= vec2
|
3130
3130
|
#
|
3131
3131
|
def mul!( arg )
|
3132
|
-
if arg.class
|
3132
|
+
if !(arg.class == Float || arg.class == Integer || arg.class == Fixnum || arg.class == Bignum)
|
3133
3133
|
raise TypeError, "RVec2#mul! : Unknown type #{arg.class}."
|
3134
3134
|
return nil
|
3135
3135
|
end
|
@@ -3163,7 +3163,7 @@ module RMath3D
|
|
3163
3163
|
@e = [0.0, 0.0, 0.0]
|
3164
3164
|
when 1
|
3165
3165
|
case a[0]
|
3166
|
-
when Fixnum,
|
3166
|
+
when Float, Integer, Fixnum, Bignum
|
3167
3167
|
@e = [ a[0], a[0], a[0] ]
|
3168
3168
|
when RVec3
|
3169
3169
|
@e = [ a[0].x, a[0].y, a[0].z ]
|
@@ -3174,7 +3174,7 @@ module RMath3D
|
|
3174
3174
|
when 3
|
3175
3175
|
a.each_with_index do |elem, index|
|
3176
3176
|
case elem
|
3177
|
-
when Fixnum,
|
3177
|
+
when Float, Integer, Fixnum, Bignum
|
3178
3178
|
@e[index] = elem
|
3179
3179
|
else
|
3180
3180
|
raise TypeError, "RVec3#initialize : Unknown type #{elem.class}."
|
@@ -3213,7 +3213,7 @@ module RMath3D
|
|
3213
3213
|
#
|
3214
3214
|
def coerce( arg )
|
3215
3215
|
case arg
|
3216
|
-
when
|
3216
|
+
when Float, Integer, Fixnum, Bignum
|
3217
3217
|
return [ self, arg ]
|
3218
3218
|
else
|
3219
3219
|
raise TypeError, "RVec3#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -3616,7 +3616,7 @@ module RMath3D
|
|
3616
3616
|
#
|
3617
3617
|
def *( arg )
|
3618
3618
|
case arg
|
3619
|
-
when Fixnum,
|
3619
|
+
when Float, Integer, Fixnum, Bignum
|
3620
3620
|
return RVec3.new( @e[0]*arg, @e[1]*arg, @e[2]*arg )
|
3621
3621
|
else
|
3622
3622
|
raise TypeError, "RVec3#* : Unknown type #{arg}."
|
@@ -3685,7 +3685,7 @@ module RMath3D
|
|
3685
3685
|
# vec1 *= vec2
|
3686
3686
|
#
|
3687
3687
|
def mul!( arg )
|
3688
|
-
if arg.class
|
3688
|
+
if !(arg.class == Float || arg.class == Integer || arg.class == Fixnum || arg.class == Bignum)
|
3689
3689
|
raise TypeError, "RVec3#mul! : Unknown type #{arg.class}."
|
3690
3690
|
return nil
|
3691
3691
|
end
|
@@ -3720,7 +3720,7 @@ module RMath3D
|
|
3720
3720
|
@e = [0.0, 0.0, 0.0, 0.0]
|
3721
3721
|
when 1
|
3722
3722
|
case a[0]
|
3723
|
-
when Fixnum,
|
3723
|
+
when Float, Integer, Fixnum, Bignum
|
3724
3724
|
@e = [ a[0], a[0], a[0], a[0] ]
|
3725
3725
|
when RVec3
|
3726
3726
|
@e = [ a[0].x, a[0].y, a[0].z, 0.0 ]
|
@@ -3733,7 +3733,7 @@ module RMath3D
|
|
3733
3733
|
when 4
|
3734
3734
|
a.each_with_index do |elem, index|
|
3735
3735
|
case elem
|
3736
|
-
when Fixnum,
|
3736
|
+
when Float, Integer, Fixnum, Bignum
|
3737
3737
|
@e[index] = elem
|
3738
3738
|
else
|
3739
3739
|
raise TypeError, "RVec4#initialize : Unknown type #{elem.class}."
|
@@ -3772,7 +3772,7 @@ module RMath3D
|
|
3772
3772
|
#
|
3773
3773
|
def coerce( arg )
|
3774
3774
|
case arg
|
3775
|
-
when
|
3775
|
+
when Float, Integer, Fixnum, Bignum
|
3776
3776
|
return [ self, arg ]
|
3777
3777
|
else
|
3778
3778
|
raise TypeError, "RVec4#coerce : #{arg.self} can't be coerced into #{self.class}."
|
@@ -4062,7 +4062,7 @@ module RMath3D
|
|
4062
4062
|
#
|
4063
4063
|
def *( arg )
|
4064
4064
|
case arg
|
4065
|
-
when Fixnum,
|
4065
|
+
when Float, Integer, Fixnum, Bignum
|
4066
4066
|
return RVec4.new( @e[0]*arg, @e[1]*arg, @e[2]*arg, @e[3]*arg )
|
4067
4067
|
else
|
4068
4068
|
raise TypeError, "RVec4#* : Unknown type #{arg}."
|
@@ -4134,7 +4134,7 @@ module RMath3D
|
|
4134
4134
|
# vec1 *= vec2
|
4135
4135
|
#
|
4136
4136
|
def mul!( other )
|
4137
|
-
if other.class
|
4137
|
+
if !(other.class == Float || other.class == Integer || other.class == Fixnum || other.class == Bignum)
|
4138
4138
|
raise TypeError, "RVec4#mul! : Unknown type #{other.class}."
|
4139
4139
|
return nil
|
4140
4140
|
end
|
@@ -4152,7 +4152,7 @@ end
|
|
4152
4152
|
|
4153
4153
|
=begin
|
4154
4154
|
RMath : Ruby math module for 3D Applications
|
4155
|
-
Copyright (c) 2008- vaiorabbit <http://twitter.com/vaiorabbit>
|
4155
|
+
Copyright (c) 2008-2017 vaiorabbit <http://twitter.com/vaiorabbit>
|
4156
4156
|
|
4157
4157
|
This software is provided 'as-is', without any express or implied
|
4158
4158
|
warranty. In no event will the authors be held liable for any damages
|
metadata
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmath3d_plain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaiorabbit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
13
|
+
description: 'Provides vector2/3/4, matrix2x2/3x3/4x4 and quaternion in plain Ruby
|
14
|
+
form.
|
15
|
+
|
16
|
+
'
|
15
17
|
email:
|
16
18
|
- vaiorabbit@gmail.com
|
17
19
|
executables: []
|
@@ -35,7 +37,7 @@ files:
|
|
35
37
|
- test/test_RVec4.rb
|
36
38
|
homepage: https://github.com/vaiorabbit/rmath3d
|
37
39
|
licenses:
|
38
|
-
-
|
40
|
+
- Zlib
|
39
41
|
metadata: {}
|
40
42
|
post_install_message:
|
41
43
|
rdoc_options: []
|
@@ -53,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
55
|
version: '0'
|
54
56
|
requirements: []
|
55
57
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.6.12
|
57
59
|
signing_key:
|
58
60
|
specification_version: 4
|
59
61
|
summary: Ruby Math Module for 3D Applications
|