1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include <nel/misc/vector.h>
25 #include <nel/misc/time_nl.h>
33 NLMISC::CVector _StartPosition
;
34 NLMISC::CVector _EndPosition
;
36 NLMISC::TTime _StartTime
;
37 NLMISC::TTime _StopTime
;
41 void init(const NLMISC::CVector
&position
, const NLMISC::CVector
&target
, float speed
, NLMISC::TTime startTime
)
43 _StartPosition
= position
;
44 _EndPosition
= target
;
46 _StartTime
= startTime
;
47 _Distance
= (_EndPosition
-_StartPosition
).norm();
48 _StopTime
= (NLMISC::TTime
)(_Distance
/_Speed
*1000.0+_StartTime
);
51 // void compute(const NLMISC::CVector &position, const NLMISC::CVector &target, float speed, NLMISC::TTime startTime);
53 NLMISC::CVector
eval(NLMISC::TTime t
) const;
54 NLMISC::CVector
evalSpeed(NLMISC::TTime t
) const;
56 NLMISC::TTime
getStartTime() const { return _StartTime
; }
57 NLMISC::CVector
getStartPosition() const { return _StartPosition
; }
58 NLMISC::TTime
getStopTime() const { return _StopTime
; }
63 /* End of physics.h */