Ejemplo n.º 1
0
int main(void)
{
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    printf("Obim je:\t%d\n", obim(a, b));
    printf("Povrsina je :\t%d\n", povrsina(a, b));

    return 0;
}
Ejemplo n.º 2
0
bool Telo::kolizija(const Telo &t, const Tacka& pomeraj)
{
    double eps = 1;
    if (&t == this)
    return false;

    Tacka prviNW = provera::position(_northWest, _center + pomeraj, _ugao);
    Tacka prviNE = provera::position(_northEast, _center + pomeraj, _ugao);
    Tacka prviSW = provera::position(_southWest, _center + pomeraj, _ugao);
    Tacka prviSE = provera::position(_southEast, _center + pomeraj, _ugao);

    Tacka drugiNW = provera::position(t.getNW(), t.getPos(), t.getUgao());
    Tacka drugiNE = provera::position(t.getNE(), t.getPos(), t.getUgao());
    Tacka drugiSW = provera::position(t.getSW(), t.getPos(), t.getUgao());
    Tacka drugiSE = provera::position(t.getSE(), t.getPos(), t.getUgao());

    if (fabs(povrsina(prviNW, prviNE, prviSW, prviSE, drugiNW) - this->getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(prviNW, prviNE, prviSW, prviSE, drugiNE) - this->getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(prviNW, prviNE, prviSW, prviSE, drugiSW) - this->getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(prviNW, prviNE, prviSW, prviSE, drugiSE) - this->getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(drugiNW, drugiNE, drugiSW, drugiSE, prviNW) - t.getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(drugiNW, drugiNE, drugiSW, drugiSE, prviNE) - t.getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(drugiNW, drugiNE, drugiSW, drugiSE, prviSW) - t.getPovrsina()) < eps)
        return true;
    if (fabs(povrsina(drugiNW, drugiNE, drugiSW, drugiSE, prviSE) - t.getPovrsina()) < eps)
        return true;

    return false;

}