+// Copyright 2009 Michal Sojka <sojkam1@fel.cvut.cz>
+// Copyright 2009 Petr Beneš
+//
+// This file is part of Trgen library.
+//
+// Trgen 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.
+//
+// Trgen 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 Trgen. If not, see <http://www.gnu.org/licenses/>.
+
#include "trgen.h"
#include "trgendbg.h"
+#include <stdio.h>
namespace Segment {
return ns;
}
+ TrajectorySegment* Turn::splitAtByTime(double time, Point *newEnd) {
+ if (time <= t1 || time >= t2) {
+ dbgPrintf("splitAt: distance=%g turnBy=%g\n", time, turnBy);
+ return NULL;
+ }
+
+ Turn *ns = new Turn(*this);
+ double distance = 0.5 * acc * time * time + v1 * time;
+ if (turnBy < 0)
+ distance = -distance;
+ turnBy = distance;
+ ns->startHeading+=distance;
+ ns->turnBy -= distance;
+ return ns;
+ }
+
void Turn::getRefPos(double time, Pos &rp) {
double t = time-t1;
double fraction = t/(t2-t1);