rbpip 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rbpip/rbpip.c +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88ab9185e5ec0f25ac3dbb1f65ce4dfc072001bd
|
4
|
+
data.tar.gz: 196bc62b74759010e5c9ac98c70206c36546c090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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 (
|
53
|
+
switch (argc) {
|
53
54
|
case 1: {
|
54
|
-
VALUE arg =
|
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 =
|
69
|
-
p_y =
|
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), -
|
125
|
+
rb_define_method(rb_cObject, "contains_point?", RUBY_METHOD_FUNC(c_contains_point), -1);
|
125
126
|
}
|