コード例 #1
0
ファイル: Square.cpp プロジェクト: vbeffara/Simulations
    pt geodesique(pt p, std::ostream *os = nullptr) const {
        std::set<pt> S;
        while (true) {
            if (!fits(vb::coo{p.xi(), p.yi()})) { break; }
            if (os != nullptr) { (*os) << p; }
            p.step(*this);
            if (S.count(p) != 0) { break; }
            S.insert(p);
        }
        if (os != nullptr) { (*os) << std::endl; }

        if (!fits(vb::coo{p.xi(), p.yi()})) { return pt(); }

        pt p_min = p;
        p.step(*this);
        while (p != p_min) {
            if (p < p_min) { p_min = p; }
            p.step(*this);
        }

        return p_min;
    }