rmath3d 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49898e4a80e600f039ecd7ec04511872b3ae42d2
4
- data.tar.gz: fcc1b6d2a979747fc86519d30560e824dbf1b88c
3
+ metadata.gz: 480f9d7cfa725618252ced196bead41f187d86c2
4
+ data.tar.gz: cfb9c4dfd3027b08020bb25be79debf32c329efb
5
5
  SHA512:
6
- metadata.gz: 5ddcc540d1be103a66966c51d839ad3c2af5775b5d0ad2dbe9f1c729964ec60a5cd411fd692fb76e6731a482f778f09e9f77dc9a6913ce7f20e4663c32422067
7
- data.tar.gz: ad561643d3081d05ae0821ecafb762be751d07b5675330f7df913a37bac12c827964217dff897b4524be833a68c2545852ba138dd34414d4b4523d8d0f802835
6
+ metadata.gz: 585ec81811bbb4baa2835fca142a78d92674be01ef232bed8f3d021148c22586deb8fa0858e89d6a5dd19019cfa814c7b365857b488c358cdeb28c65d3539e88
7
+ data.tar.gz: 28ba4c0c9c30fee57d682ed96da605bf76a59c7d00d62609f4cf795c57808d94ac992af53625deaa8b08a1e091a01f7e38de4694a56b8aa6c3a74e1ea6c1b9ee
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2015-08-23 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * rmath3d.c (def ==): Removed control path returning Qnil.
4
+ * rmath3d_plain.rb (def ==): Removed control path returning Qnil.
5
+
1
6
  2015-05-02 vaiorabbit <http://twitter.com/vaiorabbit>
2
7
 
3
8
  * Ruby 1.9.3 and prior versions are no longer supported. Ref.: https://www.ruby-lang.org/en/news/2015/02/23/support-for-ruby-1-9-3-has-ended/
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  rmath3d is a math module for 3D game programming and computer graphics.
6
6
 
7
- * Last Update: Mar 02, 2015
7
+ * Last Update: Aug 23, 2015
8
8
  * Since: Jul 20, 2008
9
9
 
10
10
  ## Features ##
@@ -935,27 +935,24 @@ RMtx2_op_binary_mult( VALUE self, VALUE other )
935
935
  static VALUE
936
936
  RMtx2_op_binary_eq( VALUE self, VALUE other )
937
937
  {
938
- RMtx2* m1 = NULL;
939
- RMtx2* m2 = NULL;
940
-
941
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
942
- if ( !IsRMtx2(other) )
938
+ if ( IsRMtx2(other) )
943
939
  {
944
- rb_raise( rb_eTypeError,
945
- "RMtx2#== : Unknown type %s.",
946
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
947
- );
948
- return Qnil;
949
- }
950
- #endif
940
+ RMtx2* m1 = NULL;
941
+ RMtx2* m2 = NULL;
951
942
 
952
- TypedData_Get_Struct( self, RMtx2, &RMtx2_type, m1 );
953
- TypedData_Get_Struct( other, RMtx2, &RMtx2_type, m2 );
943
+ TypedData_Get_Struct( self, RMtx2, &RMtx2_type, m1 );
944
+ TypedData_Get_Struct( other, RMtx2, &RMtx2_type, m2 );
954
945
 
955
- if ( !RMtx2Equal(m1,m2) )
956
- return Qfalse;
946
+ if ( !RMtx2Equal(m1,m2) )
947
+ return Qfalse;
948
+ else
949
+ return Qtrue;
950
+
951
+ }
957
952
  else
958
- return Qtrue;
953
+ {
954
+ return Qfalse;
955
+ }
959
956
  }
960
957
 
961
958
  /*
@@ -2060,27 +2057,23 @@ RMtx3_op_binary_mult( VALUE self, VALUE other )
2060
2057
  static VALUE
2061
2058
  RMtx3_op_binary_eq( VALUE self, VALUE other )
2062
2059
  {
2063
- RMtx3* m1 = NULL;
2064
- RMtx3* m2 = NULL;
2065
-
2066
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
2067
- if ( !IsRMtx3(other) )
2060
+ if ( IsRMtx3(other) )
2068
2061
  {
2069
- rb_raise( rb_eTypeError,
2070
- "RMtx3#== : Unknown type %s.",
2071
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
2072
- );
2073
- return Qnil;
2074
- }
2075
- #endif
2062
+ RMtx3* m1 = NULL;
2063
+ RMtx3* m2 = NULL;
2076
2064
 
2077
- TypedData_Get_Struct( self, RMtx3, &RMtx3_type, m1 );
2078
- TypedData_Get_Struct( other, RMtx3, &RMtx3_type, m2 );
2065
+ TypedData_Get_Struct( self, RMtx3, &RMtx3_type, m1 );
2066
+ TypedData_Get_Struct( other, RMtx3, &RMtx3_type, m2 );
2079
2067
 
2080
- if ( !RMtx3Equal(m1,m2) )
2081
- return Qfalse;
2068
+ if ( !RMtx3Equal(m1,m2) )
2069
+ return Qfalse;
2070
+ else
2071
+ return Qtrue;
2072
+ }
2082
2073
  else
2083
- return Qtrue;
2074
+ {
2075
+ return Qfalse;
2076
+ }
2084
2077
  }
2085
2078
 
2086
2079
  /*
@@ -3616,27 +3609,23 @@ RMtx4_op_binary_mult( VALUE self, VALUE other )
3616
3609
  static VALUE
3617
3610
  RMtx4_op_binary_eq( VALUE self, VALUE other )
3618
3611
  {
3619
- RMtx4* m1 = NULL;
3620
- RMtx4* m2 = NULL;
3621
-
3622
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
3623
- if ( !IsRMtx4(other) )
3612
+ if ( IsRMtx4(other) )
3624
3613
  {
3625
- rb_raise( rb_eTypeError,
3626
- "RMtx4#== : Unknown type %s.",
3627
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
3628
- );
3629
- return Qnil;
3630
- }
3631
- #endif
3614
+ RMtx4* m1 = NULL;
3615
+ RMtx4* m2 = NULL;
3632
3616
 
3633
- TypedData_Get_Struct( self, RMtx4, &RMtx4_type, m1 );
3634
- TypedData_Get_Struct( other, RMtx4, &RMtx4_type, m2 );
3617
+ TypedData_Get_Struct( self, RMtx4, &RMtx4_type, m1 );
3618
+ TypedData_Get_Struct( other, RMtx4, &RMtx4_type, m2 );
3635
3619
 
3636
- if ( !RMtx4Equal(m1,m2) )
3637
- return Qfalse;
3620
+ if ( !RMtx4Equal(m1,m2) )
3621
+ return Qfalse;
3622
+ else
3623
+ return Qtrue;
3624
+ }
3638
3625
  else
3639
- return Qtrue;
3626
+ {
3627
+ return Qfalse;
3628
+ }
3640
3629
  }
3641
3630
 
3642
3631
  /*
@@ -4549,27 +4538,23 @@ RQuat_op_binary_mult( VALUE self, VALUE other )
4549
4538
  static VALUE
4550
4539
  RQuat_op_binary_eq( VALUE self, VALUE other )
4551
4540
  {
4552
- RQuat* v1 = NULL;
4553
- RQuat* v2 = NULL;
4554
-
4555
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
4556
- if ( !IsRQuat(other) )
4541
+ if ( IsRQuat(other) )
4557
4542
  {
4558
- rb_raise( rb_eTypeError,
4559
- "RQuat#== : Unknown type %s.",
4560
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
4561
- );
4562
- return Qnil;
4563
- }
4564
- #endif
4543
+ RQuat* v1 = NULL;
4544
+ RQuat* v2 = NULL;
4565
4545
 
4566
- TypedData_Get_Struct( self, RQuat, &RQuat_type, v1 );
4567
- TypedData_Get_Struct( other, RQuat, &RQuat_type, v2 );
4546
+ TypedData_Get_Struct( self, RQuat, &RQuat_type, v1 );
4547
+ TypedData_Get_Struct( other, RQuat, &RQuat_type, v2 );
4568
4548
 
4569
- if ( !RQuatEqual(v1,v2) )
4570
- return Qfalse;
4549
+ if ( !RQuatEqual(v1,v2) )
4550
+ return Qfalse;
4551
+ else
4552
+ return Qtrue;
4553
+ }
4571
4554
  else
4572
- return Qtrue;
4555
+ {
4556
+ return Qfalse;
4557
+ }
4573
4558
  }
4574
4559
 
4575
4560
  /*
@@ -5365,27 +5350,23 @@ RVec2_op_binary_mult( VALUE self, VALUE other )
5365
5350
  static VALUE
5366
5351
  RVec2_op_binary_eq( VALUE self, VALUE other )
5367
5352
  {
5368
- RVec2* v1 = NULL;
5369
- RVec2* v2 = NULL;
5370
-
5371
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
5372
- if ( !IsRVec2(other) )
5353
+ if ( IsRVec2(other) )
5373
5354
  {
5374
- rb_raise( rb_eTypeError,
5375
- "RVec2#== : Unknown type %s.",
5376
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
5377
- );
5378
- return Qnil;
5379
- }
5380
- #endif
5355
+ RVec2* v1 = NULL;
5356
+ RVec2* v2 = NULL;
5381
5357
 
5382
- TypedData_Get_Struct( self, RVec2, &RVec2_type, v1 );
5383
- TypedData_Get_Struct( other, RVec2, &RVec2_type, v2 );
5358
+ TypedData_Get_Struct( self, RVec2, &RVec2_type, v1 );
5359
+ TypedData_Get_Struct( other, RVec2, &RVec2_type, v2 );
5384
5360
 
5385
- if ( !RVec2Equal(v1,v2) )
5386
- return Qfalse;
5361
+ if ( !RVec2Equal(v1,v2) )
5362
+ return Qfalse;
5363
+ else
5364
+ return Qtrue;
5365
+ }
5387
5366
  else
5388
- return Qtrue;
5367
+ {
5368
+ return Qfalse;
5369
+ }
5389
5370
  }
5390
5371
 
5391
5372
  /*
@@ -6367,27 +6348,23 @@ RVec3_op_binary_mult( VALUE self, VALUE other )
6367
6348
  static VALUE
6368
6349
  RVec3_op_binary_eq( VALUE self, VALUE other )
6369
6350
  {
6370
- RVec3* v1 = NULL;
6371
- RVec3* v2 = NULL;
6372
-
6373
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
6374
- if ( !IsRVec3(other) )
6351
+ if ( IsRVec3(other) )
6375
6352
  {
6376
- rb_raise( rb_eTypeError,
6377
- "RVec3#== : Unknown type %s.",
6378
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
6379
- );
6380
- return Qnil;
6381
- }
6382
- #endif
6353
+ RVec3* v1 = NULL;
6354
+ RVec3* v2 = NULL;
6383
6355
 
6384
- TypedData_Get_Struct( self, RVec3, &RVec3_type, v1 );
6385
- TypedData_Get_Struct( other, RVec3, &RVec3_type, v2 );
6356
+ TypedData_Get_Struct( self, RVec3, &RVec3_type, v1 );
6357
+ TypedData_Get_Struct( other, RVec3, &RVec3_type, v2 );
6386
6358
 
6387
- if ( !RVec3Equal(v1,v2) )
6388
- return Qfalse;
6359
+ if ( !RVec3Equal(v1,v2) )
6360
+ return Qfalse;
6361
+ else
6362
+ return Qtrue;
6363
+ }
6389
6364
  else
6390
- return Qtrue;
6365
+ {
6366
+ return Qfalse;
6367
+ }
6391
6368
  }
6392
6369
 
6393
6370
  /*
@@ -7270,27 +7247,23 @@ RVec4_op_binary_mult( VALUE self, VALUE other )
7270
7247
  static VALUE
7271
7248
  RVec4_op_binary_eq( VALUE self, VALUE other )
7272
7249
  {
7273
- RVec4* v1 = NULL;
7274
- RVec4* v2 = NULL;
7275
-
7276
- #ifdef RMATH_ENABLE_ARGUMENT_CHECK
7277
- if ( !IsRVec4(other) )
7250
+ if ( IsRVec4(other) )
7278
7251
  {
7279
- rb_raise( rb_eTypeError,
7280
- "RVec4#== : Unknown type %s.",
7281
- rb_special_const_p( other ) ? RSTRING_PTR( rb_inspect( other ) ) : rb_obj_classname( other )
7282
- );
7283
- return Qnil;
7284
- }
7285
- #endif
7252
+ RVec4* v1 = NULL;
7253
+ RVec4* v2 = NULL;
7286
7254
 
7287
- TypedData_Get_Struct( self, RVec4, &RVec4_type, v1 );
7288
- TypedData_Get_Struct( other, RVec4, &RVec4_type, v2 );
7255
+ TypedData_Get_Struct( self, RVec4, &RVec4_type, v1 );
7256
+ TypedData_Get_Struct( other, RVec4, &RVec4_type, v2 );
7289
7257
 
7290
- if ( !RVec4Equal(v1,v2) )
7291
- return Qfalse;
7258
+ if ( !RVec4Equal(v1,v2) )
7259
+ return Qfalse;
7260
+ else
7261
+ return Qtrue;
7262
+ }
7292
7263
  else
7293
- return Qtrue;
7264
+ {
7265
+ return Qfalse;
7266
+ }
7294
7267
  }
7295
7268
 
7296
7269
  /*
@@ -440,19 +440,18 @@ module RMath3D
440
440
  # mtx1 == mtx2 : evaluates equality.
441
441
  #
442
442
  def ==( other )
443
- if ( other.class != RMtx2 )
444
- raise TypeError, "RMtx2#==(other) : Unknown type #{other.class} given as RMtx2."
445
- return nil
446
- end
447
-
448
- for row in 0...2 do
449
- for col in 0...2 do
450
- if ( (getElement(row,col) - other.getElement(row,col)).abs > TOLERANCE )
451
- return false
443
+ if other.class == RMtx2
444
+ for row in 0...2 do
445
+ for col in 0...2 do
446
+ if ( (getElement(row,col) - other.getElement(row,col)).abs > TOLERANCE )
447
+ return false
448
+ end
452
449
  end
453
450
  end
451
+ return true
452
+ else
453
+ return false
454
454
  end
455
- return true
456
455
  end
457
456
 
458
457
  #
@@ -1129,19 +1128,18 @@ module RMath3D
1129
1128
  # mtx1 == mtx2 : evaluates equality.
1130
1129
  #
1131
1130
  def ==( other )
1132
- if ( other.class != RMtx3 )
1133
- raise TypeError, "RMtx3#==(other) : Unknown type #{other.class} given as RMtx3."
1134
- return nil
1135
- end
1136
-
1137
- for row in 0...3 do
1138
- for col in 0...3 do
1139
- if ( (getElement(row,col) - other.getElement(row,col)).abs > TOLERANCE )
1140
- return false
1131
+ if other.class == RMtx3
1132
+ for row in 0...3 do
1133
+ for col in 0...3 do
1134
+ if ( (getElement(row,col) - other.getElement(row,col)).abs > TOLERANCE )
1135
+ return false
1136
+ end
1141
1137
  end
1142
1138
  end
1139
+ return true
1140
+ else
1141
+ return false
1143
1142
  end
1144
- return true
1145
1143
  end
1146
1144
 
1147
1145
  #
@@ -2081,19 +2079,18 @@ module RMath3D
2081
2079
  # mtx1 == mtx2 : evaluates equality.
2082
2080
  #
2083
2081
  def ==( other )
2084
- if ( other.class != RMtx4 )
2085
- raise TypeError, "RMtx4#==(other) : Unknown type #{other.class} given as RMtx4."
2086
- return nil
2087
- end
2088
-
2089
- for row in 0...4 do
2090
- for col in 0...4 do
2091
- if ( (getElement(row,col) - other.getElement(row,col)).abs > TOLERANCE )
2092
- return false
2082
+ if other.class == RMtx4
2083
+ for row in 0...4 do
2084
+ for col in 0...4 do
2085
+ if ( (getElement(row,col) - other.getElement(row,col)).abs > TOLERANCE )
2086
+ return false
2087
+ end
2093
2088
  end
2094
2089
  end
2090
+ return true
2091
+ else
2092
+ return false
2095
2093
  end
2096
- return true
2097
2094
  end
2098
2095
 
2099
2096
  #
@@ -2258,7 +2255,7 @@ module RMath3D
2258
2255
  # Returns human-readable string.
2259
2256
  #
2260
2257
  def to_s
2261
- return "( #{@e[0]}, #{@e[1]}, #{@e[2]}, #{@e[3]} )\n"
2258
+ return "( #{@e[0]}, #{@e[1]}, #{@e[2]}, #{@e[3]} )"
2262
2259
  end
2263
2260
 
2264
2261
  #
@@ -2630,16 +2627,15 @@ module RMath3D
2630
2627
  # quat1 == quat2 : evaluates equality.
2631
2628
  #
2632
2629
  def ==( other )
2633
- if other.class != RQuat
2634
- raise TypeError, "RQuat#== : Unknown type #{other.class}."
2635
- return nil
2636
- end
2637
-
2638
- if (x-other.x).abs<=Float::EPSILON &&
2639
- (y-other.y).abs<=Float::EPSILON &&
2640
- (z-other.z).abs<=Float::EPSILON &&
2641
- (w-other.w).abs<=Float::EPSILON
2642
- return true
2630
+ if other.class == RQuat
2631
+ if (x-other.x).abs<=Float::EPSILON &&
2632
+ (y-other.y).abs<=Float::EPSILON &&
2633
+ (z-other.z).abs<=Float::EPSILON &&
2634
+ (w-other.w).abs<=Float::EPSILON
2635
+ return true
2636
+ else
2637
+ return false
2638
+ end
2643
2639
  else
2644
2640
  return false
2645
2641
  end
@@ -2859,7 +2855,7 @@ module RMath3D
2859
2855
  # Returns human-readable string.
2860
2856
  #
2861
2857
  def to_s
2862
- return "( #{@e[0]}, #{@e[1]} )\n"
2858
+ return "( #{@e[0]}, #{@e[1]} )"
2863
2859
  end
2864
2860
 
2865
2861
  #
@@ -3081,14 +3077,13 @@ module RMath3D
3081
3077
  # vec1 == vec2 : evaluates equality.
3082
3078
  #
3083
3079
  def ==( other )
3084
- if other.class != RVec2
3085
- raise TypeError, "RVec2#== : Unknown type #{other.class}."
3086
- return nil
3087
- end
3088
-
3089
- if (x-other.x).abs<=Float::EPSILON &&
3090
- (y-other.y).abs<=Float::EPSILON
3091
- return true
3080
+ if other.class == RVec2
3081
+ if (x-other.x).abs<=Float::EPSILON &&
3082
+ (y-other.y).abs<=Float::EPSILON
3083
+ return true
3084
+ else
3085
+ return false
3086
+ end
3092
3087
  else
3093
3088
  return false
3094
3089
  end
@@ -3199,7 +3194,7 @@ module RMath3D
3199
3194
  # Returns human-readable string.
3200
3195
  #
3201
3196
  def to_s
3202
- return "( #{@e[0]}, #{@e[1]}, #{@e[2]} )\n"
3197
+ return "( #{@e[0]}, #{@e[1]}, #{@e[2]} )"
3203
3198
  end
3204
3199
 
3205
3200
  #
@@ -3635,15 +3630,14 @@ module RMath3D
3635
3630
  # vec1 == vec2 : evaluates equality.
3636
3631
  #
3637
3632
  def ==( other )
3638
- if other.class != RVec3
3639
- raise TypeError, "RVec3#== : Unknown type #{other.class}."
3640
- return nil
3641
- end
3642
-
3643
- if (x-other.x).abs<=Float::EPSILON &&
3644
- (y-other.y).abs<=Float::EPSILON &&
3645
- (z-other.z).abs<=Float::EPSILON
3646
- return true
3633
+ if other.class == RVec3
3634
+ if (x-other.x).abs<=Float::EPSILON &&
3635
+ (y-other.y).abs<=Float::EPSILON &&
3636
+ (z-other.z).abs<=Float::EPSILON
3637
+ return true
3638
+ else
3639
+ return false
3640
+ end
3647
3641
  else
3648
3642
  return false
3649
3643
  end
@@ -3759,7 +3753,7 @@ module RMath3D
3759
3753
  # Returns human-readable string.
3760
3754
  #
3761
3755
  def to_s
3762
- return "( #{@e[0]}, #{@e[1]}, #{@e[2]}, #{@e[3]} )\n"
3756
+ return "( #{@e[0]}, #{@e[1]}, #{@e[2]}, #{@e[3]} )"
3763
3757
  end
3764
3758
 
3765
3759
  #
@@ -4082,16 +4076,15 @@ module RMath3D
4082
4076
  # vec1 == vec2 : evaluates equality.
4083
4077
  #
4084
4078
  def ==( other )
4085
- if other.class != RVec4
4086
- raise TypeError, "RVec4#== : Unknown type #{other.class}."
4087
- return nil
4088
- end
4089
-
4090
- if (x-other.x).abs<=Float::EPSILON &&
4091
- (y-other.y).abs<=Float::EPSILON &&
4092
- (z-other.z).abs<=Float::EPSILON &&
4093
- (w-other.w).abs<=Float::EPSILON
4094
- return true
4079
+ if other.class == RVec4
4080
+ if (x-other.x).abs<=Float::EPSILON &&
4081
+ (y-other.y).abs<=Float::EPSILON &&
4082
+ (z-other.z).abs<=Float::EPSILON &&
4083
+ (w-other.w).abs<=Float::EPSILON
4084
+ return true
4085
+ else
4086
+ return false
4087
+ end
4095
4088
  else
4096
4089
  return false
4097
4090
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmath3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaiorabbit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-02 00:00:00.000000000 Z
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Provides vector2/3/4, matrix2x2/3x3/4x4 and quaternion in C extension library form (and plain Ruby form with the same interface for debugging use).
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.4.6
77
+ rubygems_version: 2.4.5.1
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Ruby Math Module for 3D Applications