コード例 #1
0
ファイル: Unit.cpp プロジェクト: Arafatk/trick
UCFn *Unit::Conversion_to (const Unit *other) {
    UnitsConvFn_t conv_fn;

    if (conv_fn_u(this->units, other->units, &conv_fn) != CONV_OK) {
        throw CONVERSION_ERROR();
    }
    return ( new UCFn(other->units_name.c_str(), this->units_name.c_str(), conv_fn.C[1], conv_fn.C[0]) );
}
コード例 #2
0
ファイル: Unit.cpp プロジェクト: Arafatk/trick
UCFn *Unit::Conversion_to (const char *in_units_name) {
    UCFn *ucf;
    Unit * other;
    if ((other = new Unit(in_units_name))==NULL) {
        throw CONVERSION_ERROR();
    }
     
    ucf = this->Conversion_to(other);
     
    delete other;
    return ucf;
}
コード例 #3
0
static PyObject *
Affine_almost_equals(polypaths_planar_overrideAffineObject *self, polypaths_planar_overrideAffineObject *other)
{
    PyObject *r;

    assert(polypaths_planar_overrideAffine_Check(self));
    if (polypaths_planar_overrideAffine_Check(other)) {
        if (almost_eq(self->a, other->a) 
         && almost_eq(self->b, other->b)
         && almost_eq(self->c, other->c)
         && almost_eq(self->d, other->d)
         && almost_eq(self->e, other->e)
         && almost_eq(self->f, other->f)) {
            r = Py_True;
        } else {
            r = Py_False;
        }
        Py_INCREF(r);
        return r;
    } else {
        CONVERSION_ERROR();
    }
}