rbpip 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rbpip/rbpip.c +7 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5bd34943439cd36bd33032bdddf348e7f65fa9f
4
- data.tar.gz: ea9b875eea013c1bfb2482daa54acbd50d4c11b5
3
+ metadata.gz: 88ab9185e5ec0f25ac3dbb1f65ce4dfc072001bd
4
+ data.tar.gz: 196bc62b74759010e5c9ac98c70206c36546c090
5
5
  SHA512:
6
- metadata.gz: 593d81c1ae7a50e7d07c7e07238655016a27257ed5bc4f9fef2c6e3dc4b02e4641e5cbae0a13c27e3e5ae982fa0debfb9e0acdd80698a7ac20a05f6b407bd1dc
7
- data.tar.gz: 9605f5f9399676cd9a4523b56dc387bee8ee91c4903a4aa95f926f7fdde767e3f260e00d3f44f28bdcd7969ad0b04a55367c8646b4d84bab57d24ed9a2fa9215
6
+ metadata.gz: acd10fd6a452405c1b1f4002b77fcea20a09c8345827486f15aee928f1b69cf752d4ecb6f48a307e586df4db2425aa401522f27f5d66fe4e060e6a59217f3a92
7
+ data.tar.gz: 8450b56b39f8a7272f38cf171f59b10c9f65d23d717928e2a86fc9e33cbf1bbaef61f00846f199618e1782aaeb89b52caa33f9fc85b56ab3a8b8bd0965057cf5
data/ext/rbpip/rbpip.c CHANGED
@@ -43,15 +43,16 @@ int pip(double poly[][2], int npoints, double xt, double yt) {
43
43
  return inside;
44
44
  }
45
45
 
46
- static VALUE c_contains_point(VALUE self, VALUE args) {
46
+ static VALUE c_contains_point(int argc, VALUE* argv, VALUE self) {
47
+
47
48
  VALUE respond_to = rb_intern("respond_to?");
48
49
 
49
50
  VALUE p_x;
50
51
  VALUE p_y;
51
52
 
52
- switch (RARRAY_LEN(args)) {
53
+ switch (argc) {
53
54
  case 1: {
54
- VALUE arg = rb_ary_entry(args, 0);
55
+ VALUE arg = argv[0];
55
56
  VALUE responds_x = rb_funcall(arg, respond_to, 1, ID2SYM(rb_intern("x")));
56
57
  VALUE responds_y = rb_funcall(arg, respond_to, 1, ID2SYM(rb_intern("y")));
57
58
 
@@ -65,8 +66,8 @@ static VALUE c_contains_point(VALUE self, VALUE args) {
65
66
  break;
66
67
  }
67
68
  case 2: {
68
- p_x = rb_ary_entry(args, 0);
69
- p_y = rb_ary_entry(args, 1);
69
+ p_x = argv[0];
70
+ p_y = argv[1];
70
71
  break;
71
72
  }
72
73
  default:
@@ -121,5 +122,5 @@ static VALUE c_contains_point(VALUE self, VALUE args) {
121
122
  }
122
123
 
123
124
  void Init_rbpip() {
124
- rb_define_method(rb_cObject, "contains_point?", RUBY_METHOD_FUNC(c_contains_point), -2);
125
+ rb_define_method(rb_cObject, "contains_point?", RUBY_METHOD_FUNC(c_contains_point), -1);
125
126
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbpip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Symer