Method: Ray::Polygon#set_color_of

Defined in:
ext/polygon.c

#set_color_of(id, val) ⇒ Object

Parameters:

  • id (Integer)

    Id of the point

  • val (Ray::Color)

    Color of the point



362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'ext/polygon.c', line 362

static
VALUE ray_polygon_set_color_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_color_for(poly, id, ray_rb2col(val));

  return val;
}