/* Returns a Dvector with two elements: the X and Y values of the point at the given index. */ static VALUE function_point(VALUE self, VALUE index) { if(! NUMERIC(index)) rb_raise(rb_eArgError, "index has to be numeric"); else { long i = NUM2LONG(index); long size = function_sanity_check(self); if(size > 0 && i < size) { VALUE point = rb_funcall(cDvector, idNew, 1, INT2NUM(2)); double * dat = Dvector_Data_for_Write(point, NULL); double *x = Dvector_Data_for_Read(get_x_vector(self),NULL); double *y = Dvector_Data_for_Read(get_y_vector(self),NULL); dat[0] = x[i]; dat[1] = y[i]; return point; } else return Qnil; } return Qnil; }