Source

KODE / src / joints / LinearMotor.cpp

Full commit
/*
  This file is part of the KODE.

    KODE Physics Library
    Copyright (C) 2013-2014  Daniel Kohler Osmari

    KODE is free software: you can redistribute it and/or modify it
    under the terms of EITHER:

        * the GNU Lesser General Public License as published by the
          Free Software Foundation, either version 3 of the License,
          or (at your option) any later version.

        * the Apache License, Version 2.0.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Lesser General Public License and the Apache License for more
    details.

    You should have received a copy of the GNU Lesser General Public
    License along with this program.  If not, see
    <http://www.gnu.org/licenses/>.

    You may obtain a copy of the Apache License at
       http://www.apache.org/licenses/LICENSE-2.0
*/

#include <stdexcept>

#include <kode/joints/LinearMotor.hpp>

namespace kode {

    void
    LinearMotor::setLimits(Real low, Real high)
    {
        if (low <= high) {
            loStop = low;
            hiStop = high;
        } else
            throw std::invalid_argument{"lower limit must be less or equal to upper limit"};
    }


    std::pair<Real,Real>
    LinearMotor::getLimits() const noexcept
    {
        return {loStop, hiStop};
    }

}