Skip to content
Snippets Groups Projects
Commit 41160ecc authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better selection of abscissa

parent 3ec0992b
No related branches found
No related tags found
No related merge requests found
...@@ -80,6 +80,19 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin, ...@@ -80,6 +80,19 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin,
bool space = (opt->type == PViewOptions::Plot2D || bool space = (opt->type == PViewOptions::Plot2D ||
opt->type == PViewOptions::Plot2DSpace); opt->type == PViewOptions::Plot2DSpace);
int which2d = 0;
if(opt->type == PViewOptions::Plot2D){
SBoundingBox3d bbox = p->getData()->getBoundingBox();
SPoint3 min = bbox.min();
SPoint3 max = bbox.max();
if(fabs(max.y() - min.y()) > fabs(max.x() - min.x()) &&
fabs(max.y() - min.y()) > fabs(max.z() - min.z()))
which2d = 1;
else if(fabs(max.z() - min.z()) > fabs(max.x() - min.x()) &&
fabs(max.z() - min.z()) > fabs(max.y() - min.y()))
which2d = 2;
}
SPoint3 p0(0., 0., 0.); SPoint3 p0(0., 0., 0.);
numy = 0; numy = 0;
...@@ -113,7 +126,7 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin, ...@@ -113,7 +126,7 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin,
double vy = ComputeScalarRep(numComp, val); double vy = ComputeScalarRep(numComp, val);
if(opt->type == PViewOptions::Plot2D){ if(opt->type == PViewOptions::Plot2D){
x.push_back(xyz[0]); x.push_back(xyz[which2d]);
y[0].push_back(vy); y[0].push_back(vy);
} }
else if(opt->type == PViewOptions::Plot2DSpace){ else if(opt->type == PViewOptions::Plot2DSpace){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment