Ejemplo n.º 1
0
void
g (int a)
{
  f0();
  x.f0();
  f0(a); /* { dg-error "too many arguments to function 'f0'" } */
  x.f0(a); /* { dg-error "too many arguments to function 'x.f0'" } */
  f0(a, a); /* { dg-error "too many arguments to function 'f0'" } */
  x.f0(a, a); /* { dg-error "too many arguments to function 'x.f0'" } */
  f1(); /* { dg-error "too few arguments to function 'f1'" } */
  x.f1(); /* { dg-error "too few arguments to function 'x.f1'" } */
  f1(a);
  x.f1(a);
  f1(a, a); /* { dg-error "too many arguments to function 'f1'" } */
  x.f1(a, a); /* { dg-error "too many arguments to function 'x.f1'" } */
  f1v(); /* { dg-error "too few arguments to function 'f1v'" } */
  x.f1v(); /* { dg-error "too few arguments to function 'x.f1v'" } */
  f1v(a);
  x.f1v(a);
  f1v(a, a);
  x.f1v(a, a);
  f2(a); /* { dg-error "too few arguments to function 'f2'" } */
  x.f2(a); /* { dg-error "too few arguments to function 'x.f2'" } */
  f2(a, a);
  x.f2(a, a);
  f2(a, a, a); /* { dg-error "too many arguments to function 'f2'" } */
  x.f2(a, a, a); /* { dg-error "too many arguments to function 'x.f2'" } */
  f2v(a); /* { dg-error "too few arguments to function 'f2v'" } */
  x.f2v(a); /* { dg-error "too few arguments to function 'x.f2v'" } */
  f2v(a, a);
  x.f2v(a, a);
  f2v(a, a, a);
  x.f2v(a, a, a);
}
Ejemplo n.º 2
0
DeriVector2 Ellipse::CalculateNormal(Point &p, double* derivparam)
{
    //fill some vectors in
    DeriVector2 cv (center, derivparam);
    DeriVector2 f1v (focus1, derivparam);
    DeriVector2 pv (p, derivparam);

    //calculation.
    //focus2:
    DeriVector2 f2v = cv.linCombi(2.0, f1v, -1.0); // 2*cv - f1v

    //pf1, pf2 = vectors from p to focus1,focus2
    DeriVector2 pf1 = f1v.subtr(pv);
    DeriVector2 pf2 = f2v.subtr(pv);
    //return sum of normalized pf2, pf2
    DeriVector2 ret = pf1.getNormalized().sum(pf2.getNormalized());

    //numeric derivatives for testing
    #if 0 //make sure to enable DEBUG_DERIVS when enabling
        if(derivparam) {
            double const eps = 0.00001;
            double oldparam = *derivparam;
            DeriVector2 v0 = this->CalculateNormal(p);
            *derivparam += eps;
            DeriVector2 vr = this->CalculateNormal(p);
            *derivparam = oldparam - eps;
            DeriVector2 vl = this->CalculateNormal(p);
            *derivparam = oldparam;
            //If not nasty, real derivative should be between left one and right one
            DeriVector2 numretl ((v0.x-vl.x)/eps, (v0.y-vl.y)/eps);
            DeriVector2 numretr ((vr.x-v0.x)/eps, (vr.y-v0.y)/eps);
            assert(ret.dx <= std::max(numretl.x,numretr.x) );
            assert(ret.dx >= std::min(numretl.x,numretr.x) );
            assert(ret.dy <= std::max(numretl.y,numretr.y) );
            assert(ret.dy >= std::min(numretl.y,numretr.y) );
        }
    #endif

    return ret;
}