Class: CP::Shape::Circle

Inherits:
Object
  • Object
show all
Includes:
CP::Shape
Defined in:
ext/chipmunk/rb_cpShape.c

Direct Known Subclasses

CP::StaticShape::Circle

Instance Attribute Summary

Attributes included from CP::Shape

#obj

Instance Method Summary collapse

Methods included from CP::Shape

#add_to_space, #bb, #body, #body=, #cache_bb, #chipmunk_objects, #collision_type, #collision_type=, #data, #e, #e=, #group, #group=, #layers, #layers=, #nearest_point_query, #object, #object=, #point_query, #raw_bb, #remove_from_space, reset_id_counter, #segment_query, #sensor=, #sensor?, #surface_v, #surface_v=, #u, #u=

Methods included from Object

#chipmunk_objects

Constructor Details

#initialize(*args) ⇒ Object



228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'ext/chipmunk/rb_cpShape.c', line 228

static VALUE
rb_cpCircleInitialize(int argc, VALUE * argv, VALUE self) {
  VALUE body, radius, offset;
  cpCircleShape *circle = NULL;
  rb_scan_args(argc, argv, "21", &body, &radius, &offset);
  circle                       = (cpCircleShape *)SHAPE(self);

  cpCircleShapeInit(circle, BODY(body), NUM2DBL(radius), VGET_ZERO(offset));
  circle->shape.data           = (void *)self;
  circle->shape.collision_type = Qnil;
  rb_ivar_set(self, id_body, body);

  return self;
}

Instance Method Details

#offsetObject

some getters



344
345
346
347
# File 'ext/chipmunk/rb_cpShape.c', line 344

static VALUE
rb_cpCircleShapeGetOffset(VALUE self) {
  return VNEW(cpCircleShapeGetOffset(SHAPE(self)));
}

#rObject



349
350
351
352
# File 'ext/chipmunk/rb_cpShape.c', line 349

static VALUE
rb_cpCircleShapeGetRadius(VALUE self) {
  return rb_float_new(cpCircleShapeGetRadius(SHAPE(self)));
}

#radiusObject



349
350
351
352
# File 'ext/chipmunk/rb_cpShape.c', line 349

static VALUE
rb_cpCircleShapeGetRadius(VALUE self) {
  return rb_float_new(cpCircleShapeGetRadius(SHAPE(self)));
}

#set_offset!(offset) ⇒ Object



397
398
399
400
401
# File 'ext/chipmunk/rb_cpShape.c', line 397

static VALUE
rb_cpCircleShapeSetOffset(VALUE self, VALUE offset) {
  cpCircleShapeSetOffset(SHAPE(self), *VGET(offset));
  return self;
}

#set_radius!(radius) ⇒ Object

“unsafe” API.



391
392
393
394
395
# File 'ext/chipmunk/rb_cpShape.c', line 391

static VALUE
rb_cpCircleShapeSetRadius(VALUE self, VALUE radius) {
  cpCircleShapeSetRadius(SHAPE(self), NUM2DBL(radius));
  return self;
}