this->AdjustAxes(pts, bounds, idx, xIdx, yIdx, zIdx, zIdx2,
xAxes, yAxes, zAxes,
xCoords, yCoords, zCoords, xRange, yRange, zRange);
-
+
// Upate axes
this->Labels[0] = this->XLabel;
this->Labels[1] = this->YLabel;
this->planeYZ->SetInput(rgrid);
this->planeXZ->SetInput(rgrid);
+ rgrid->Delete();
+
+ float aCPosition[3];
+ float aCDirection[3];
+ this->Camera->GetPosition(aCPosition);
+ this->Camera->GetDirectionOfProjection(aCDirection);
+
+ // culculate placement of XY
+ bool replaceXY=false;
+ bool replaceYZ=false;
+ bool replaceXZ=false;
+ float p[6][3]; // centers of planes
+ float vecs[6][3]; // 6 vectors from camera position to centers
+
+ float aMiddleX = (XCoords->GetValue(0) + XCoords->GetValue(numOfLabelsX-1))/2;
+ float aMiddleY = (YCoords->GetValue(0) + YCoords->GetValue(numOfLabelsY-1))/2;
+ float aMiddleZ = (ZCoords->GetValue(0) + ZCoords->GetValue(numOfLabelsZ-1))/2;
+
+ // plane XY
+ p[0][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=0
+ p[0][1] = aMiddleY;
+ p[0][2] = ZCoords->GetValue(0);
+
+ p[1][0] = aMiddleX; // plane X=0.5 Y=0.5 Z=1
+ p[1][1] = aMiddleY;
+ p[1][2] = ZCoords->GetValue(numOfLabelsZ-1);
+
+ // plane YZ
+ p[2][0] = XCoords->GetValue(0); // plane X=0 Y=0.5 Z=0.5
+ p[2][1] = aMiddleY;
+ p[2][2] = aMiddleZ;
+
+ p[3][0] = XCoords->GetValue(numOfLabelsX-1);
+ p[3][1] = aMiddleY;
+ p[3][2] = aMiddleZ;
+
+ // plane XZ
+ p[4][0] = aMiddleX; // plane X=0.5 Y=0 Z=0.5
+ p[4][1] = YCoords->GetValue(0);
+ p[4][2] = aMiddleZ;
+
+ p[5][0] = aMiddleX; // plane X=0.5 Y=1 Z=0.5
+ p[5][1] = YCoords->GetValue(numOfLabelsY-1);
+ p[5][2] = aMiddleZ;
+
+ for(int i=0;i<3;i++)
+ for(int j=0;j<6;j++) vecs[j][i] = p[j][i] - aCPosition[i];
+
+ if ( vtkMath::Dot(vecs[0],aCDirection) < vtkMath::Dot(vecs[1],aCDirection))
+ replaceXY = true;
+ if ( vtkMath::Dot(vecs[2],aCDirection) < vtkMath::Dot(vecs[3],aCDirection))
+ replaceYZ = true;
+ if ( vtkMath::Dot(vecs[4],aCDirection) < vtkMath::Dot(vecs[5],aCDirection))
+ replaceXZ = true;
+
+ if(replaceXY) this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, numOfLabelsZ,numOfLabelsZ);
+ else this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, 0,0);
+
+ if(replaceYZ) this->planeYZ->SetExtent(numOfLabelsX,numOfLabelsX, 0,numOfLabelsY, 0,numOfLabelsZ);
+ else this->planeYZ->SetExtent(0,0, 0,numOfLabelsY, 0,numOfLabelsZ);
+
+ if(replaceXZ) this->planeXZ->SetExtent(0,numOfLabelsX, numOfLabelsY,numOfLabelsY, 0,numOfLabelsZ);
+ else this->planeXZ->SetExtent(0,numOfLabelsX, 0,0, 0,numOfLabelsZ);
+
XCoords->Delete();
YCoords->Delete();
ZCoords->Delete();
- rgrid->Delete();
-
- // ENK:: here must be setting of correct placement of planex
- this->planeXY->SetExtent(0,numOfLabelsX, 0,numOfLabelsY, 0,0);
- this->planeYZ->SetExtent(0,0, 0,numOfLabelsY, 0,numOfLabelsZ);
- this->planeXZ->SetExtent(0,numOfLabelsX, 0,0, 0,numOfLabelsZ);
float color[3];