// VISU OBJECT : interactive object for VISU entities implementation
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
#include "VISU_CutPlanesPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
#include <vtkAppendPolyData.h>
#include <vtkCutter.h>
VISU_CutPlanesPL::VISU_CutPlanesPL(){
myAppendPolyData = vtkAppendPolyData::New();
+ myIsShrinkable = false;
}
VISU_CutPlanesPL::~VISU_CutPlanesPL(){
float aDir[3];
GetDir(aDir,myAng[0],myBasePlane[0]);
float aBounds[6];
- myInput->GetBounds(aBounds);
+ GetInput2()->GetBounds(aBounds);
vtkDataSet* aDataSet = myFieldTransform->GetUnstructuredGridOutput();
CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds,
myPartPosition,myPartCondition,myDisplacement[0]);
float* VISU_CutPlanesPL::GetRy(float theRy[3][3], float thaAng){
theRy[0][0] = cos(thaAng); theRy[0][1] = 0.0; theRy[0][2] = sin(thaAng);
- theRy[1][0] = 0.0; theRy[1][1] = 1.0; theRy[1][2] = 0.0;
- theRy[2][0] = -sin(thaAng); theRy[2][1] = 0.0; theRy[2][2] = cos(thaAng);
+ theRy[1][0] = 0.0; theRy[1][1] = 1.0; theRy[1][2] = 0.0;
+ theRy[2][0] = -sin(thaAng); theRy[2][1] = 0.0; theRy[2][2] = cos(thaAng);
return theRy[0];
}
float* VISU_CutPlanesPL::GetRz(float theRz[3][3], float thaAng){
theRz[0][0] = cos(thaAng); theRz[0][1] = -sin(thaAng); theRz[0][2] = 0.0;
- theRz[1][0] = sin(thaAng); theRz[1][1] = cos(thaAng); theRz[1][2] = 0.0;
- theRz[2][0] = 0.0; theRz[2][1] = 0.0; theRz[2][2] = 1.0;
+ theRz[1][0] = sin(thaAng); theRz[1][1] = cos(thaAng); theRz[1][2] = 0.0;
+ theRz[2][0] = 0.0; theRz[2][1] = 0.0; theRz[2][2] = 1.0;
return theRz[0];
}
{BoundBox[0],BoundBox[3],BoundBox[4]},
{BoundBox[1],BoundBox[3],BoundBox[4]},
{BoundBox[0],BoundBox[2],BoundBox[5]},
- {BoundBox[1],BoundBox[2],BoundBox[5]},
- {BoundBox[0],BoundBox[3],BoundBox[5]},
+ {BoundBox[1],BoundBox[2],BoundBox[5]},
+ {BoundBox[0],BoundBox[3],BoundBox[5]},
{BoundBox[1],BoundBox[3],BoundBox[5]}};
BoundPrj[0] = vtkMath::Dot(Dir,BoundPoints[0]), BoundPrj[1] = BoundPrj[0];
for(int i = 1; i < 8; i++){
}
-void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
+void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
float theXAng, float theYAng, int theNum)
-{
+{
myBasePlane[theNum] = theOrient;
switch(myBasePlane[theNum]){
case XY: myAng[theNum][0] = theXAng; break;
}
-const VISU_CutPlanesPL::PlaneOrientation& VISU_CutPlanesPL::GetPlaneOrientation(int theNum){
+const VISU_CutPlanesPL::PlaneOrientation& VISU_CutPlanesPL::GetPlaneOrientation(int theNum){
return myBasePlane[theNum];
}
}
-void VISU_CutPlanesPL::SetNbParts(int theNb) {
+void VISU_CutPlanesPL::SetNbParts(int theNb) {
myNbParts = theNb;
myPartPosition.resize(myNbParts);
myPartCondition.resize(myNbParts,1);
float aPosition = myPartPosition[thePartNumber];
if(myPartCondition[thePartNumber]){
float aDir[3], aBounds[6], aBoundPrj[3];
- myInput->GetBounds(aBounds);
+ GetInput2()->GetBounds(aBounds);
GetDir(aDir,myAng[theNum],myBasePlane[theNum]);
GetBoundProject(aBoundPrj,aBounds,aDir);
if (myNbParts > 1){
float aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
aPosition = aStartPosition + thePartNumber*aDBoundPrj;
}else
- aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
+ aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
}
return aPosition;
}
}
-void VISU_CutPlanesPL::GetDir(float theDir[3], float theAng[3], const PlaneOrientation& theBasePlane){
+void VISU_CutPlanesPL::GetDir(float theDir[3],
+ const float theAng[3],
+ const PlaneOrientation& theBasePlane)
+{
int iPlane = 0;
float aRx[3][3], aRy[3][3], aRz[3][3], aRotation[3][3];
switch(theBasePlane){
- case XY:
+ case XY:
if(fabs(theAng[0]) > EPS) GetRx(aRx,theAng[0]); else vtkMath::Identity3x3(aRx);
if(fabs(theAng[1]) > EPS) GetRy(aRy,theAng[1]); else vtkMath::Identity3x3(aRy);
vtkMath::Multiply3x3(aRx,aRy,aRotation);
iPlane = 2;
break;
- case YZ:
+ case YZ:
if(fabs(theAng[1]) > EPS) GetRy(aRy,theAng[1]); else vtkMath::Identity3x3(aRy);
if(fabs(theAng[2]) > EPS) GetRz(aRz,theAng[2]); else vtkMath::Identity3x3(aRz);
vtkMath::Multiply3x3(aRy,aRz,aRotation);
iPlane = 0;
break;
- case ZX:
+ case ZX:
if(fabs(theAng[2]) > EPS) GetRz(aRz,theAng[2]); else vtkMath::Identity3x3(aRz);
if(fabs(theAng[0]) > EPS) GetRx(aRx,theAng[0]); else vtkMath::Identity3x3(aRx);
vtkMath::Multiply3x3(aRz,aRx,aRotation);
iPlane = 1;
break;
}
- for(int i = 0; i < 3; i++)
+ for(int i = 0; i < 3; i++)
theDir[i] = aRotation[i][iPlane];
}
-void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
+void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
vtkDataSet* theDataSet,
float theDir[3], float theOrig[3])
{
aCutPlane->SetInput(theDataSet);
vtkPlane *aPlane = vtkPlane::New();
aPlane->SetOrigin(theOrig);
-
+
aPlane->SetNormal(theDir);
aCutPlane->SetCutFunction(aPlane);
aPlane->Delete();
void VISU_CutPlanesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
- int theNbPlanes, float theDir[3], float theBounds[6],
- const vector<float>& thePlanePosition,
+ int theNbPlanes, float theDir[3], float theBounds[6],
+ const vector<float>& thePlanePosition,
const vector<int>& thePlaneCondition,
float theDisplacement)
{
float aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
for (int i = 0; i < theNbPlanes; i++){
aPosition = aStartPosition + i*aDBoundPrj;
- float aDelta = (aBoundPrj[0] - aPosition) / aBoundPrj[2];
if(thePlaneCondition[i]){
aPosition = aStartPosition + i*aDBoundPrj;
}else