bool loadFromData(Qwt3D::TripleField const &data, Qwt3D::CellField const &poly)
The last variant eventually provides support for more free formed meshs, divided in a node- (the TripleField argument) and a polygon- (the CellField) part. This kind of data is common for FEM and CAD applications but not limited to them. It is the 'swiss knife' because it is of course able to represent all the other variants. The question here is performance (still not too bad).
http://qwtplot3d.sourceforge.net/web/navigation/manual_frame.htmlсоздал наследника от SurfacePlot и там переопределил функцию
C++ (Qt)
bool CPlotter3d::loadFromData( const Qwt3D::TripleField &vertex, const Qwt3D::CellField &field )
{
if(vertex.empty() || vertex.size()<3)
{
return false;
}
///точек должно быть не менеe трёх
Qwt3D::CellField poly;
if (field.empty())
{
for(int i=0; i< vertex.size()-2; i++)
{
poly.push_back(Qwt3D::Cell(3, i));
}
unsigned k1 = vertex.size() - 3, k2 = k1 + 1, k3 = k2 + 1;
for ( ;k1 < (unsigned int) -1; )
{
poly[k1][1] = k2--;
poly[k1][2] = k3--;
poly[k1][0] = k1--;
}
}
else poly=field;
/////// [0 1 2] [1 2 3] - последовательность соединения вершин
SurfacePlot::loadFromData(vertex,poly);
updateData();
updateGL();
return true;
}
использую так, рисует треугольниками, хотелось бы 4-угольниками
C++ (Qt)
Qwt3D::TripleField vertex(0);
vertex.push_back( Triple(0, 2, 1) );
vertex.push_back( Triple( 0, 2, 2) );
vertex.push_back( Triple( 1, 2, 1) );
CPlotter3d my;
my.loadFromData(vertex);
помогите переделать, спс