43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'ext/chipmunk/rb_cpBB.c', line 43
static VALUE
rb_cpBBInitialize(int argc, VALUE *argv, VALUE self) {
VALUE l, b, r, t;
cpBB *bb = BBGET(self);
rb_scan_args(argc, argv, "04", &l, &b, &r, &t);
// initialize as a circle bounds box if ony 2 params
if (NIL_P(r)) {
if(NIL_P(l)) {
(*bb) = cpBBNew(0, 0, 1, 1); // unit box.
} else {
cpVect * p = VGET(l);
(*bb) = cpBBNewForCircle(*p, NUM2DBL(b));
}
} else {
(*bb) = cpBBNew(NUM2DBL(l), NUM2DBL(b), NUM2DBL(r), NUM2DBL(t));
}
return self;
}
|