Exemple #1
0
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());
}
Exemple #2
0
void Curve::readIn(GridData& gdata, Triple** data, unsigned int columns, unsigned int rows)
{
	gdata.setSize(columns,rows);
	
	ParallelEpiped range(Triple(DBL_MAX,DBL_MAX,DBL_MAX),Triple(-DBL_MAX,-DBL_MAX,-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] = data[i][j].x; 
			gdata.vertices[i][j][1] = data[i][j].y;
			gdata.vertices[i][j][2] = data[i][j].z;

			if (data[i][j].x > range.maxVertex.x)
				range.maxVertex.x = data[i][j].x;
			if (data[i][j].y > range.maxVertex.y)
				range.maxVertex.y = data[i][j].y;
			if (data[i][j].z > range.maxVertex.z)
				range.maxVertex.z = data[i][j].z;
			if (data[i][j].x < range.minVertex.x)
				range.minVertex.x = data[i][j].x;
			if (data[i][j].y < range.minVertex.y)
				range.minVertex.y = data[i][j].y;
			if (data[i][j].z < range.minVertex.z)
				range.minVertex.z = data[i][j].z;
 		}
	}
	gdata.setHull(range);
	emit readInFinished(title()->string());
}
Exemple #3
0
void GridPlot::readIn(GridData& gdata, Triple** data, unsigned int columns, unsigned int rows)
{
    gdata.setSize(columns,rows);

    ParallelEpiped range(Triple(DBL_MAX,DBL_MAX,DBL_MAX),Triple(-DBL_MAX,-DBL_MAX,-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& val = data[i][j];

            gdata.vertices[i][j] = val;

            if (val.x > range.maxVertex.x)
                range.maxVertex.x = val.x;
            if (val.y > range.maxVertex.y)
                range.maxVertex.y = val.y;
            if (val.z > range.maxVertex.z)
                range.maxVertex.z = val.z;
            if (val.x < range.minVertex.x)
                range.minVertex.x = val.x;
            if (val.y < range.minVertex.y)
                range.minVertex.y = val.y;
            if (val.z < range.minVertex.z)
                range.minVertex.z = val.z;
        }
    }
    gdata.setHull(range);
}
Exemple #4
0
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);
}