|
本帖最后由 Berly 于 2012-9-12 13:58 编辑
读取汽车路径的path文件的函数,使用向量读取文件,然后要把文件的后三位代表旋转角度的数值存放到osg::Vec3d *point中,异常部分就是point->set(Rotate[0],Rotate[1],Rotate[2]);
typedef vector<vector<double>>Mat;
osg::Vec3dArray* getRotate()
{
ifstream fin("car.path");
Mat a;
vector<double>Rotate;
osg::Vec3d *point;
osg::Vec3dArray *pointList1;
for (string s;getline(fin,s);)
{
vector<double>b;
istringstream sin(s);
for(double ia;sin>>ia;)
b.push_back(ia);
vector<double>Rotate(b.begin()+5,b.begin()+8);
point->set(Rotate[0],Rotate[1],Rotate[2]);
pointList1->push_back(*point);
}
return pointList1;
}
|
|