void Curve::readIn(GridData& gdata, double** data, unsigned int columns, unsigned int rows, double minx, double maxx, double miny, double maxy) { gdata.setPeriodic(false,false); gdata.setSize(columns, rows); double dx = (maxx - minx) / (gdata.columns() - 1); double dy = (maxy - miny) / (gdata.rows() - 1); double tmin = DBL_MAX; double tmax = -DBL_MAX; /* fill out the vertex array for the mesh. */ for (unsigned i = 0; i != columns; ++i){ for (unsigned j = 0; j != rows; ++j){ gdata.vertices[i][j][0] = minx + i*dx; gdata.vertices[i][j][1] = miny + j*dy; gdata.vertices[i][j][2] = data[i][j]; double val = data[i][j]; if (val > tmax) tmax = val; if (val < tmin) tmin = val; } } ParallelEpiped hull = ParallelEpiped(Triple(gdata.vertices[0][0][0], gdata.vertices[0][0][1], tmin), Triple(gdata.vertices[gdata.columns() - 1][gdata.rows() - 1][0], gdata.vertices[gdata.columns() - 1][gdata.rows() - 1][1], tmax)); gdata.setHull(hull); emit readInFinished(title()->string()); }
void GridPlot::readIn(GridData& gdata, double** data, unsigned int columns, unsigned int rows , double minx, double maxx, double miny, double maxy) { gdata.setPeriodic(false,false); gdata.setSize(columns,rows); double dx = (maxx - minx) / (gdata.columns() - 1); double dy = (maxy - miny) / (gdata.rows() - 1); double tmin = DBL_MAX; double tmax = -DBL_MAX; /* fill out the vertex array for the mesh. */ for (unsigned i = 0; i != columns; ++i) { for (unsigned j = 0; j != rows; ++j) { Triple& gdata_ij = gdata.vertices[i][j]; double& val = data[i][j]; gdata_ij.x = minx + i*dx; gdata_ij.y = miny + j*dy; gdata_ij.z = val; if (val > tmax) tmax = val; if (val < tmin) tmin = val; } } ParallelEpiped hull = ParallelEpiped( Triple( gdata.vertices[0][0].x, gdata.vertices[0][0].y, tmin ), Triple( gdata.vertices[gdata.columns()-1][gdata.rows()-1].x, gdata.vertices[gdata.columns()-1][gdata.rows()-1].y, tmax ) ); gdata.setHull(hull); }