34 std::vector<CVec> points;
35 const double len = 20.0;
36 points.push_back(
CVec(0.0, 0.0, 0.0));
37 points.push_back(
CVec(len, 0.0, 0.0));
38 points.push_back(
CVec(0.0, 0.0, 0.0));
39 points.push_back(
CVec(0.0, len, 0.0));
40 points.push_back(
CVec(0.0, 0.0, 0.0));
41 points.push_back(
CVec(0.0, 0.0, len));
43 std::vector<int> linestyle;
44 linestyle.push_back(1);
45 linestyle.push_back(1);
46 linestyle.push_back(2);
47 linestyle.push_back(2);
48 linestyle.push_back(3);
49 linestyle.push_back(3);
55 for (
unsigned int j=0; j<points.size(); j++)
56 plotdata += (pose * points[j]).
toString() +
"\n";
59 std::ofstream textstream2(filenameData.c_str());
60 if (textstream2.fail())
63 textstream2 << plotdata;
66 std::vector<double> mins(3, 1.0e30);
67 std::vector<double> maxs(3, -1.0e30);
71 for (
unsigned int k=0; k<3; k++)
72 if (pose.
a[12 + k] < mins[k])
73 mins[k] = pose.
a[12 + k];
74 else if (pose.
a[12 + k] > maxs[k])
75 maxs[k] = pose.
a[12 + k];
77 for (
unsigned int j=0; j<points.size(); j+=2)
80 t1 = pose * points[j];
81 t2 = pose * points[j+1];
82 text +=
printToString(
"set arrow from %f,%f,%f to %f,%f,%f linestyle %d\n",
90 text +=
"splot 'plot_data' with points ps 0\n";
94 std::ofstream textstream(filenameScript.c_str());
95 if (textstream.fail())
106 std::string plotdata;
108 std::vector<CVec> t1start(
functions.size());
109 for (
unsigned int i=0; i<
examples.size(); i++)
113 for (
unsigned int j=0; j<
functions.size(); j++)
120 text +=
printToString(
"set arrow from %f,%f,%f to %f,%f,%f linestyle %d\n",
129 text +=
printToString(
"set arrow from %f,%f,%f to %f,%f,%f linestyle %d\n",
130 t1start[j].x, t1start[j].y, t1start[j].z,
131 t1start[j].x + t2.
x, t1start[j].y + t2.
y, t1start[j].z + t2.
z,
136 text +=
"splot 'plot_data' with points ps 0\n";
137 text +=
"pause -1\n";
139 std::ofstream textstream(filenameScript.c_str());
140 if (textstream.fail())
146 std::ofstream textstream2(filenameData.c_str());
147 if (textstream2.fail())
150 textstream2 << plotdata;
std::vector< std::vector< double > > examples
std::string printToString(const char *format,...)
bool generateGnuPlot(double *st, std::string filenameScript, std::string filenameData)
virtual CMatrix getRelativeToBase()
Returns pose in the base (frame with no predecessor) frame.
std::vector< CFrame * > getFrames()
void setData(std::vector< double > &values)
std::string toString(bool round=false)
bool generateGnuPlotCoords(double *st, std::string filenameScript, std::string filenameData)
CFrame * getFrame(unsigned int id)
std::vector< OptimizerGoal * > functions