* Copyright 2011 kubtek <kubtek@mail.com>
*
* This file is part of StarDict.
*
* StarDict is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* StarDict 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with StarDict. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PARTIC_H__
#define __PARTIC_H__
#include "vector_t.h"
#include "geom.h"
class partic_t {
private:
single _m;
vector_t _p;
vector_t _v;
vector_t _f;
tsize_t<single> _size;
bool _anchor;
public:
partic_t(single am = 1, single w = 10, single h = 10): _m(am), _size(w, h), _anchor(false) {}
single & getM() { return _m; }
vector_t & getP() { return _p; }
vector_t & getV() { return _v; }
vector_t & getF() { return _f; }
tsize_t<single> & get_size() { return _size; }
point_t<single> get_left_top() { return point_t<single>(_p.x-_size.w/2, _p.y-_size.h/2); }
vector_t getA() { vector_t v = _f; v.div(_m); return v; }
rect_t<single> get_box();
bool hit(const vector_t & b);
void set_anchor(bool b) { _anchor = b; }
bool get_anchor() { return _anchor; }
};
#endif