/* call-seq: f.distance(x,y) -> a_number f.distance(x,y, xscale, yscale) -> a_number Returns the distance of the function to the given point. Optionnal xscale and yscale says by how much we should divide the x and y coordinates before computing the distance. Use it if the distance is not homogeneous. */ static VALUE function_distance(int argc, VALUE *argv, VALUE self) { switch(argc) { case 2: return rb_float_new(private_function_distance(self, NUM2DBL(argv[0]), NUM2DBL(argv[1]), 1.0,1.0,NULL)); case 4: return rb_float_new(private_function_distance(self, NUM2DBL(argv[0]), NUM2DBL(argv[1]), NUM2DBL(argv[2]), NUM2DBL(argv[3]), NULL)); default: rb_raise(rb_eArgError, "distance should have 2 or 4 parameters"); } return Qnil; }