Method: Ray::Polygon#set_pos_of

Defined in:
ext/polygon.c

#set_pos_of(id, val) ⇒ Object

Parameters:

  • id (Integer)

    Id of the point

  • val (Ray::Vector2)

    Position of the point



342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'ext/polygon.c', line 342

static
VALUE ray_polygon_set_pos_of(VALUE self, VALUE rb_id, VALUE val) {
  say_polygon *poly = ray_rb2polygon(self);
  size_t id = NUM2ULONG(rb_id);

  if (id >= say_polygon_get_size(poly)) {
    rb_raise(rb_eArgError, "trying to change point %ld, when there are %ld points",
             id, say_polygon_get_size(poly));
  }

  say_polygon_set_pos_for(poly, id, ray_convert_to_vector2(val));

  return val;
}