From: apo Date: Wed, 5 Apr 2006 14:26:24 +0000 (+0000) Subject: Porting on Mandriva 64 (to use vtkFloatingPointType instead of bare "float") X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07039bcf4dc52aa5168a84981f18ff721fb820f5;p=modules%2Fvisu.git Porting on Mandriva 64 (to use vtkFloatingPointType instead of bare "float") --- diff --git a/src/PIPELINE/SALOME_ExtractGeometry.cxx b/src/PIPELINE/SALOME_ExtractGeometry.cxx index 5a1762e8..e4c986c3 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.cxx +++ b/src/PIPELINE/SALOME_ExtractGeometry.cxx @@ -198,8 +198,8 @@ SALOME_ExtractGeometry vtkIdList *cellPts; vtkCell *cell; int numCellPts; - float *x; - float multiplier; + vtkFloatingPointType *x; + vtkFloatingPointType multiplier; vtkPoints *newPts; vtkIdList *newCellPts; vtkDataSet *input = this->GetInput(); @@ -271,7 +271,7 @@ SALOME_ExtractGeometry // To extract boundary cells, we have to create supplemental information if ( this->ExtractBoundaryCells ) { - float val; + vtkFloatingPointType val; newScalars = vtkFloatArray::New(); newScalars->SetNumberOfValues(numPts); diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index e2cfe567..df37e622 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -34,12 +34,17 @@ using namespace std; vtkStandardNewMacro(VISU_CutLinesPL); -VISU_CutLinesPL::VISU_CutLinesPL(){ +VISU_CutLinesPL +::VISU_CutLinesPL() +{ myCondition = 1; myPosition = 0; } -void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ +void +VISU_CutLinesPL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ if(VISU_CutLinesPL *aPipeLine = dynamic_cast(thePipeLine)){ SetOrientation(aPipeLine->GetPlaneOrientation(1), aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1); @@ -50,7 +55,10 @@ void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ VISU_CutPlanesPL::ShallowCopy(thePipeLine); } -void VISU_CutLinesPL::Init(){ +void +VISU_CutLinesPL +::Init() +{ VISU_CutPlanesPL::Init(); myBasePlane[0] = XY; @@ -64,15 +72,21 @@ void VISU_CutLinesPL::Init(){ } -void VISU_CutLinesPL::SetPosition(float thePosition){ +void +VISU_CutLinesPL +::SetPosition(vtkFloatingPointType thePosition) +{ myPosition = thePosition; myCondition = 0; Modified(); } -float VISU_CutLinesPL::GetPosition(){ - float aPosition = myPosition; +vtkFloatingPointType +VISU_CutLinesPL +::GetPosition() +{ + vtkFloatingPointType aPosition = myPosition; if(myCondition){ - float aDir[3], aBounds[6], aBoundPrj[3]; + vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3]; GetInput2()->GetBounds(aBounds); GetDir(aDir,myAng[0],myBasePlane[0]); GetBoundProject(aBoundPrj,aBounds,aDir); @@ -81,21 +95,30 @@ float VISU_CutLinesPL::GetPosition(){ return aPosition; } -void VISU_CutLinesPL::SetDefault(){ +void +VISU_CutLinesPL +::SetDefault() +{ myCondition = 1; Modified(); } -int VISU_CutLinesPL::IsDefault(){ +int +VISU_CutLinesPL +::IsDefault() +{ return myCondition; } -void VISU_CutLinesPL::Update(){ +void +VISU_CutLinesPL +::Update() +{ ClearAppendPolyData(myAppendPolyData); SetPartPosition(1); vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New(); //Build base plane - float aDir[2][3], aBaseBounds[6]; + vtkFloatingPointType aDir[2][3], aBaseBounds[6]; GetInput2()->GetBounds(aBaseBounds); GetDir(aDir[0],myAng[0],myBasePlane[0]); vtkUnstructuredGrid* anUnstructuredGrid = @@ -103,7 +126,7 @@ void VISU_CutLinesPL::Update(){ CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds, myPosition,myCondition,myDisplacement[0]); //Build lines - float aBounds[6]; + vtkFloatingPointType aBounds[6]; vtkDataSet *aDataSet = anAppendPolyData->GetOutput(); aDataSet->Update(); if(aDataSet->GetNumberOfCells() == 0) @@ -125,12 +148,18 @@ void VISU_CutLinesPL::Update(){ } -void VISU_CutLinesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet, - int theNbPlanes, float theDir[3], float theBounds[6], - float thePartPosition, int thePartCondition, - float theDisplacement) +void +VISU_CutLinesPL +::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, + vtkDataSet* theDataSet, + int theNbPlanes, + vtkFloatingPointType theDir[3], + vtkFloatingPointType theBounds[6], + vtkFloatingPointType thePartPosition, + int thePartCondition, + vtkFloatingPointType theDisplacement) { - vector aPartPosition(1,thePartPosition); + vector aPartPosition(1,thePartPosition); vector aPartCondition(1,thePartCondition); VISU_CutPlanesPL::CutWithPlanes(theAppendPolyData,theDataSet,theNbPlanes,theDir,theBounds, aPartPosition,aPartCondition,theDisplacement); diff --git a/src/PIPELINE/VISU_CutLinesPL.hxx b/src/PIPELINE/VISU_CutLinesPL.hxx index cc316781..e41cdc65 100644 --- a/src/PIPELINE/VISU_CutLinesPL.hxx +++ b/src/PIPELINE/VISU_CutLinesPL.hxx @@ -37,31 +37,74 @@ protected: VISU_CutLinesPL(const VISU_CutLinesPL&); public: vtkTypeMacro(VISU_CutLinesPL,VISU_CutPlanesPL); - static VISU_CutLinesPL* New(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetPosition(float thePosition); - virtual float GetPosition(); + static + VISU_CutLinesPL* + New(); - virtual void SetDefault(); - virtual int IsDefault(); + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + void + SetPosition(vtkFloatingPointType thePosition); + + virtual + vtkFloatingPointType + GetPosition(); + + virtual + void + SetDefault(); + + virtual + int + IsDefault(); public: - virtual void Init(); - virtual void Update(); + virtual + void + Init(); + + virtual + void + Update(); + + static + void + CutWithPlanes(vtkAppendPolyData* theAppendPolyData, + vtkDataSet* theDataSet, + int theNbPlanes, + vtkFloatingPointType theDir[3], + vtkFloatingPointType theBounds[6], + vtkFloatingPointType thePlanePosition, + int thePlaneCondition, + vtkFloatingPointType theDisplacement); + + const vtkFloatingPointType* + GetDirLn() + { + return myDirLn; + } - static void CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet, - int theNbPlanes, float theDir[3], float theBounds[6], - float thePlanePosition, int thePlaneCondition, - float theDisplacement); + const vtkFloatingPointType* + GetBoundPrjLn() + { + return myBoundPrjLn; + } - const float* GetDirLn(){ return myDirLn;} - const float* GetBoundPrjLn(){ return myBoundPrjLn;} - const float* GetBasePnt(){ return myBasePnt;} + const vtkFloatingPointType* + GetBasePnt() + { + return myBasePnt; + } protected: - float myDirLn[3], myBoundPrjLn[3], myBasePnt[3]; - float myPosition; + vtkFloatingPointType myDirLn[3]; + vtkFloatingPointType myBoundPrjLn[3]; + vtkFloatingPointType myBasePnt[3]; + vtkFloatingPointType myPosition; int myCondition; }; diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index 2a547971..8bd5837f 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -35,11 +35,13 @@ using namespace std; -static float EPS = 1.0E-3; +static vtkFloatingPointType EPS = 1.0E-3; vtkStandardNewMacro(VISU_CutPlanesPL); -VISU_CutPlanesPL::VISU_CutPlanesPL(){ +VISU_CutPlanesPL +::VISU_CutPlanesPL() +{ myAppendPolyData = vtkAppendPolyData::New(); myIsShrinkable = false; @@ -54,11 +56,16 @@ VISU_CutPlanesPL::VISU_CutPlanesPL(){ myAng[1][0] = myAng[1][1] = myAng[1][2] = 0.0; } -VISU_CutPlanesPL::~VISU_CutPlanesPL(){ +VISU_CutPlanesPL +::~VISU_CutPlanesPL() +{ myAppendPolyData->Delete(); } -void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ +void +VISU_CutPlanesPL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ if(VISU_CutPlanesPL *aPipeLine = dynamic_cast(thePipeLine)){ SetOrientation(aPipeLine->GetPlaneOrientation(), aPipeLine->GetRotateX(),aPipeLine->GetRotateY()); @@ -70,7 +77,10 @@ void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ VISU_ScalarMapPL::ShallowCopy(thePipeLine); } -void VISU_CutPlanesPL::Init(){ +void +VISU_CutPlanesPL +::Init() +{ VISU_ScalarMapPL::Init(); SetNbParts(10); @@ -79,16 +89,22 @@ void VISU_CutPlanesPL::Init(){ myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0; } -VISU_ScalarMapPL::THook* VISU_CutPlanesPL::DoHook(){ +VISU_ScalarMapPL::THook* +VISU_CutPlanesPL +::DoHook() +{ return myAppendPolyData->GetOutput(); } -void VISU_CutPlanesPL::Update(){ +void +VISU_CutPlanesPL +::Update() +{ ClearAppendPolyData(myAppendPolyData); SetPartPosition(); - float aDir[3]; + vtkFloatingPointType aDir[3]; GetDir(aDir,myAng[0],myBasePlane[0]); - float aBounds[6]; + vtkFloatingPointType aBounds[6]; GetInput2()->GetBounds(aBounds); vtkDataSet* aDataSet = myFieldTransform->GetUnstructuredGridOutput(); CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds, @@ -97,18 +113,28 @@ void VISU_CutPlanesPL::Update(){ VISU_ScalarMapPL::Update(); } -void VISU_CutPlanesPL::SetPartPosition(int theNum){ +void +VISU_CutPlanesPL +::SetPartPosition(int theNum) +{ for(int i = 0; i < myNbParts; i++) myPartPosition[i] = GetPartPosition(i,theNum); } -void VISU_CutPlanesPL::ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData){ +void +VISU_CutPlanesPL +::ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData) +{ int iEnd = theAppendPolyData->GetNumberOfInputs(); for(int i = iEnd-1; i >= 0; i--) theAppendPolyData->RemoveInput(theAppendPolyData->GetInput(i)); } -float* VISU_CutPlanesPL::GetRx(float theRx[3][3], float thaAng){ +vtkFloatingPointType* +VISU_CutPlanesPL:: +GetRx(vtkFloatingPointType theRx[3][3], + vtkFloatingPointType thaAng) +{ theRx[0][0] = 1.0; theRx[0][1] = 0.0; theRx[0][2] = 0.0; theRx[1][0] = 0.0; theRx[1][1] = cos(thaAng); theRx[1][2] = -sin(thaAng); theRx[2][0] = 0.0; theRx[2][1] = sin(thaAng); theRx[2][2] = cos(thaAng); @@ -116,7 +142,11 @@ float* VISU_CutPlanesPL::GetRx(float theRx[3][3], float thaAng){ } -float* VISU_CutPlanesPL::GetRy(float theRy[3][3], float thaAng){ +vtkFloatingPointType* +VISU_CutPlanesPL +::GetRy(vtkFloatingPointType theRy[3][3], + vtkFloatingPointType 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); @@ -124,7 +154,11 @@ float* VISU_CutPlanesPL::GetRy(float theRy[3][3], float thaAng){ } -float* VISU_CutPlanesPL::GetRz(float theRz[3][3], float thaAng){ +vtkFloatingPointType* +VISU_CutPlanesPL +::GetRz(vtkFloatingPointType theRz[3][3], + vtkFloatingPointType 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; @@ -132,25 +166,34 @@ float* VISU_CutPlanesPL::GetRz(float theRz[3][3], float thaAng){ } -void VISU_CutPlanesPL::CorrectPnt(float thePnt[3], const float BoundPrj[6]){ +void +VISU_CutPlanesPL +::CorrectPnt(vtkFloatingPointType thePnt[3], + const vtkFloatingPointType BoundPrj[6]) +{ for(int i = 0, j = 0; i < 3; ++i, j=2*i){ if(thePnt[i] < BoundPrj[j]) thePnt[i] = BoundPrj[j]; if(thePnt[i] > BoundPrj[j+1]) thePnt[i] = BoundPrj[j+1]; } } -void VISU_CutPlanesPL::GetBoundProject(float BoundPrj[3], const float BoundBox[6], const float Dir[3]){ - float BoundPoints[8][3] = { {BoundBox[0],BoundBox[2],BoundBox[4]}, - {BoundBox[1],BoundBox[2],BoundBox[4]}, - {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[3],BoundBox[5]}}; +void +VISU_CutPlanesPL +::GetBoundProject(vtkFloatingPointType BoundPrj[3], + const vtkFloatingPointType BoundBox[6], + const vtkFloatingPointType Dir[3]) +{ + vtkFloatingPointType BoundPoints[8][3] = { {BoundBox[0],BoundBox[2],BoundBox[4]}, + {BoundBox[1],BoundBox[2],BoundBox[4]}, + {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[3],BoundBox[5]}}; BoundPrj[0] = vtkMath::Dot(Dir,BoundPoints[0]), BoundPrj[1] = BoundPrj[0]; for(int i = 1; i < 8; i++){ - float tmp = vtkMath::Dot(Dir,BoundPoints[i]); + vtkFloatingPointType tmp = vtkMath::Dot(Dir,BoundPoints[i]); if(BoundPrj[1] < tmp) BoundPrj[1] = tmp; if(BoundPrj[0] > tmp) BoundPrj[0] = tmp; } @@ -161,8 +204,12 @@ void VISU_CutPlanesPL::GetBoundProject(float BoundPrj[3], const float BoundBox[6 } -void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient, - float theXAng, float theYAng, int theNum) +void +VISU_CutPlanesPL +::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient, + vtkFloatingPointType theXAng, + vtkFloatingPointType theYAng, + int theNum) { myBasePlane[theNum] = theOrient; switch(myBasePlane[theNum]){ @@ -178,11 +225,17 @@ void VISU_CutPlanesPL::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& } -const VISU_CutPlanesPL::PlaneOrientation& VISU_CutPlanesPL::GetPlaneOrientation(int theNum){ +const VISU_CutPlanesPL::PlaneOrientation& +VISU_CutPlanesPL +::GetPlaneOrientation(int theNum) +{ return myBasePlane[theNum]; } -float VISU_CutPlanesPL::GetRotateX(int theNum){ +vtkFloatingPointType +VISU_CutPlanesPL +::GetRotateX(int theNum) +{ switch(myBasePlane[theNum]){ case XY: return myAng[theNum][0]; case YZ: return myAng[theNum][1]; @@ -191,7 +244,10 @@ float VISU_CutPlanesPL::GetRotateX(int theNum){ return 0; } -float VISU_CutPlanesPL::GetRotateY(int theNum){ +vtkFloatingPointType +VISU_CutPlanesPL +::GetRotateY(int theNum) +{ switch(myBasePlane[theNum]){ case XY: return myAng[theNum][1]; case YZ: return myAng[theNum][2]; @@ -201,7 +257,10 @@ float VISU_CutPlanesPL::GetRotateY(int theNum){ } -void VISU_CutPlanesPL::SetNbParts(int theNb) { +void +VISU_CutPlanesPL +::SetNbParts(int theNb) +{ myNbParts = theNb; myPartPosition.resize(myNbParts); myPartCondition.resize(myNbParts,1); @@ -209,24 +268,33 @@ void VISU_CutPlanesPL::SetNbParts(int theNb) { } -void VISU_CutPlanesPL::SetPartPosition(int thePartNumber, float thePartPosition){ +void +VISU_CutPlanesPL +::SetPartPosition(int thePartNumber, + vtkFloatingPointType thePartPosition) +{ if(thePartNumber >= myNbParts) return; myPartPosition[thePartNumber] = thePartPosition; myPartCondition[thePartNumber] = 0; Modified(); } -float VISU_CutPlanesPL::GetPartPosition(int thePartNumber, int theNum){ + +vtkFloatingPointType +VISU_CutPlanesPL +::GetPartPosition(int thePartNumber, + int theNum) +{ if(thePartNumber >= myNbParts) return 0; - float aPosition = myPartPosition[thePartNumber]; + vtkFloatingPointType aPosition = myPartPosition[thePartNumber]; if(myPartCondition[thePartNumber]){ - float aDir[3], aBounds[6], aBoundPrj[3]; + vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3]; GetInput2()->GetBounds(aBounds); GetDir(aDir,myAng[theNum],myBasePlane[theNum]); GetBoundProject(aBoundPrj,aBounds,aDir); if (myNbParts > 1){ - float aDBoundPrj = aBoundPrj[2]/(myNbParts - 1); - float aDisplacement = aDBoundPrj * myDisplacement[theNum]; - float aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement; + vtkFloatingPointType aDBoundPrj = aBoundPrj[2]/(myNbParts - 1); + vtkFloatingPointType aDisplacement = aDBoundPrj * myDisplacement[theNum]; + vtkFloatingPointType aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement; aPosition = aStartPosition + thePartNumber*aDBoundPrj; }else aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum]; @@ -235,24 +303,32 @@ float VISU_CutPlanesPL::GetPartPosition(int thePartNumber, int theNum){ } -void VISU_CutPlanesPL::SetPartDefault(int thePartNumber){ +void +VISU_CutPlanesPL +::SetPartDefault(int thePartNumber) +{ if(thePartNumber >= myNbParts) return; myPartPosition[thePartNumber] = GetPartPosition(thePartNumber); myPartCondition[thePartNumber] = 1; Modified(); } -int VISU_CutPlanesPL::IsPartDefault(int thePartNumber){ +int +VISU_CutPlanesPL +::IsPartDefault(int thePartNumber) +{ if(thePartNumber >= myNbParts) return 1; return myPartCondition[thePartNumber]; } -void VISU_CutPlanesPL::GetDir(float theDir[3], - const float theAng[3], - const PlaneOrientation& theBasePlane) +void +VISU_CutPlanesPL +::GetDir(vtkFloatingPointType theDir[3], + const vtkFloatingPointType theAng[3], + const PlaneOrientation& theBasePlane) { int iPlane = 0; - float aRx[3][3], aRy[3][3], aRz[3][3], aRotation[3][3]; + vtkFloatingPointType aRx[3][3], aRy[3][3], aRz[3][3], aRotation[3][3]; switch(theBasePlane){ case XY: if(fabs(theAng[0]) > EPS) GetRx(aRx,theAng[0]); else vtkMath::Identity3x3(aRx); @@ -278,9 +354,12 @@ void VISU_CutPlanesPL::GetDir(float theDir[3], } -void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData, - vtkDataSet* theDataSet, - float theDir[3], float theOrig[3]) +void +VISU_CutPlanesPL +::CutWithPlane(vtkAppendPolyData* theAppendPolyData, + vtkDataSet* theDataSet, + vtkFloatingPointType theDir[3], + vtkFloatingPointType theOrig[3]) { vtkCutter *aCutPlane = vtkCutter::New(); aCutPlane->SetInput(theDataSet); @@ -296,18 +375,23 @@ void VISU_CutPlanesPL::CutWithPlane(vtkAppendPolyData* theAppendPolyData, } -void VISU_CutPlanesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet, - int theNbPlanes, float theDir[3], float theBounds[6], - const vector& thePlanePosition, - const vector& thePlaneCondition, - float theDisplacement) +void +VISU_CutPlanesPL +::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, + vtkDataSet* theDataSet, + int theNbPlanes, + vtkFloatingPointType theDir[3], + vtkFloatingPointType theBounds[6], + const vector& thePlanePosition, + const vector& thePlaneCondition, + vtkFloatingPointType theDisplacement) { - float aBoundPrj[3], aOrig[3], aPosition; + vtkFloatingPointType aBoundPrj[3], aOrig[3], aPosition; GetBoundProject(aBoundPrj, theBounds, theDir); if(theNbPlanes > 1){ - float aDBoundPrj = aBoundPrj[2]/(theNbPlanes - 1); - float aDisplacement = aDBoundPrj*theDisplacement; - float aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement; + vtkFloatingPointType aDBoundPrj = aBoundPrj[2]/(theNbPlanes - 1); + vtkFloatingPointType aDisplacement = aDBoundPrj*theDisplacement; + vtkFloatingPointType aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement; for (int i = 0; i < theNbPlanes; i++){ aPosition = aStartPosition + i*aDBoundPrj; if(thePlaneCondition[i]){ diff --git a/src/PIPELINE/VISU_CutPlanesPL.hxx b/src/PIPELINE/VISU_CutPlanesPL.hxx index b561f512..bd2c977a 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.hxx +++ b/src/PIPELINE/VISU_CutPlanesPL.hxx @@ -40,64 +40,162 @@ protected: public: vtkTypeMacro(VISU_CutPlanesPL,VISU_ScalarMapPL); static VISU_CutPlanesPL* New(); - virtual ~VISU_CutPlanesPL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - enum PlaneOrientation {XY, YZ, ZX}; - virtual void SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient, - float theXAng, float theYAng, int theNum = 0); + virtual + ~VISU_CutPlanesPL(); - virtual const PlaneOrientation& GetPlaneOrientation(int theNum = 0); - virtual float GetRotateX(int theNum = 0); - virtual float GetRotateY(int theNum = 0); + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); - virtual float GetDisplacement(int theNum = 0) { return myDisplacement[theNum];} - virtual void SetDisplacement(float theDisp, int theNum = 0) { myDisplacement[theNum] = theDisp;} + enum PlaneOrientation {XY, YZ, ZX}; - virtual void SetPartPosition(int thePartNumber, float thePartPosition); - virtual float GetPartPosition(int thePartNumber, int theNum = 0); + virtual + void + SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient, + vtkFloatingPointType theXAng, + vtkFloatingPointType theYAng, + int theNum = 0); + + virtual + const PlaneOrientation& + GetPlaneOrientation(int theNum = 0); + + virtual + vtkFloatingPointType + GetRotateX(int theNum = 0); + + virtual + vtkFloatingPointType + GetRotateY(int theNum = 0); + + virtual + vtkFloatingPointType + GetDisplacement(int theNum = 0) + { + return myDisplacement[theNum]; + } + + virtual + void + SetDisplacement(vtkFloatingPointType theDisp, + int theNum = 0) + { + myDisplacement[theNum] = theDisp; + } + + virtual + void + SetPartPosition(int thePartNumber, + vtkFloatingPointType thePartPosition); + + virtual + vtkFloatingPointType + GetPartPosition(int thePartNumber, + int theNum = 0); + + virtual + void + SetPartDefault(int thePartNumber); + + virtual + int + IsPartDefault(int thePartNumber); + + virtual + void + SetNbParts(int theNb); + + virtual + int + GetNbParts() + { + return myNbParts; + } - virtual void SetPartDefault(int thePartNumber); - virtual int IsPartDefault(int thePartNumber); +public: + virtual + void + Init(); - virtual void SetNbParts(int theNb); - virtual int GetNbParts(){ return myNbParts;} + virtual + void + Update(); -public: - virtual void Init(); - virtual void Update(); - virtual vtkAppendPolyData* GetAppendPolyData() { return myAppendPolyData; } + virtual + vtkAppendPolyData* + GetAppendPolyData() + { + return myAppendPolyData; + } public: - static float* GetRx(float theRx[3][3], float thaAng); - static float* GetRy(float theRy[3][3], float thaAng); - static float* GetRz(float theRz[3][3], float thaAng); - - static void CorrectPnt(float thePnt[3], const float BoundPrj[6]); - static void GetBoundProject(float BoundPrj[3], const float BoundBox[6], const float Dir[3]); - - static void GetDir(float theDir[3], - const float theAng[3], - const PlaneOrientation& theBasePlane); - - static void ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData); - - static void CutWithPlane(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet, - float theDir[3], float theOrig[3]); - static void CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet, - int theNbPlanes, float theDir[3], float theBounds[6], - const std::vector& thePlanePosition, - const std::vector& thePlaneCondition, - float theDisplacement); + static + vtkFloatingPointType* + GetRx(vtkFloatingPointType theRx[3][3], + vtkFloatingPointType thaAng); + + static + vtkFloatingPointType* + GetRy(vtkFloatingPointType theRy[3][3], + vtkFloatingPointType thaAng); + + static + vtkFloatingPointType* + GetRz(vtkFloatingPointType theRz[3][3], + vtkFloatingPointType thaAng); + + static + void + CorrectPnt(vtkFloatingPointType thePnt[3], + const vtkFloatingPointType BoundPrj[6]); + + static + void + GetBoundProject(vtkFloatingPointType BoundPrj[3], + const vtkFloatingPointType BoundBox[6], + const vtkFloatingPointType Dir[3]); + + static + void + GetDir(vtkFloatingPointType theDir[3], + const vtkFloatingPointType theAng[3], + const PlaneOrientation& theBasePlane); + + static + void + ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData); + + static + void + CutWithPlane(vtkAppendPolyData* theAppendPolyData, + vtkDataSet* theDataSet, + vtkFloatingPointType theDir[3], + vtkFloatingPointType theOrig[3]); + + static + void + CutWithPlanes(vtkAppendPolyData* theAppendPolyData, + vtkDataSet* theDataSet, + int theNbPlanes, + vtkFloatingPointType theDir[3], + vtkFloatingPointType theBounds[6], + const std::vector& thePlanePosition, + const std::vector& thePlaneCondition, + vtkFloatingPointType theDisplacement); protected: - virtual THook* DoHook(); - void SetPartPosition(int theNum = 0); + virtual + THook* + DoHook(); + + void + SetPartPosition(int theNum = 0); int myNbParts; PlaneOrientation myBasePlane[2]; - float myAng[2][3], myDisplacement[2]; + vtkFloatingPointType myAng[2][3], myDisplacement[2]; vtkAppendPolyData *myAppendPolyData; - std::vector myPartPosition; + std::vector myPartPosition; std::vector myPartCondition; }; diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 0b8e3462..c8b2133e 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -33,12 +33,16 @@ vtkStandardNewMacro(VISU_DeformedShapePL); -VISU_DeformedShapePL::VISU_DeformedShapePL(){ +VISU_DeformedShapePL +::VISU_DeformedShapePL() +{ myWarpVector = vtkWarpVector::New(); myCellDataToPointData = vtkCellDataToPointData::New(); } -VISU_DeformedShapePL::~VISU_DeformedShapePL(){ +VISU_DeformedShapePL +::~VISU_DeformedShapePL() +{ myWarpVector->UnRegisterAllOutputs(); myWarpVector->Delete(); @@ -46,21 +50,27 @@ VISU_DeformedShapePL::~VISU_DeformedShapePL(){ myCellDataToPointData->Delete(); } -void VISU_DeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){ +void +VISU_DeformedShapePL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ if(VISU_DeformedShapePL *aPipeLine = dynamic_cast(thePipeLine)){ SetScale(aPipeLine->GetScale()); } VISU_ScalarMapPL::ShallowCopy(thePipeLine); } -float VISU_DeformedShapePL::GetScaleFactor(vtkDataSet* theDataSet){ +vtkFloatingPointType +VISU_DeformedShapePL +::GetScaleFactor(vtkDataSet* theDataSet) +{ if(!theDataSet) return 0.0; theDataSet->Update(); int aNbCells = theDataSet->GetNumberOfCells(); int aNbPoints = theDataSet->GetNumberOfPoints(); int aNbElem = aNbCells? aNbCells: aNbPoints; - float* aBounds = theDataSet->GetBounds(); - float aVolume = 1, aVol, idim = 0; + vtkFloatingPointType* aBounds = theDataSet->GetBounds(); + vtkFloatingPointType aVolume = 1, aVol, idim = 0; for(int i = 0; i < 6; i += 2){ aVol = fabs(aBounds[i+1] - aBounds[i]); if(aVol > 0) { @@ -69,26 +79,36 @@ float VISU_DeformedShapePL::GetScaleFactor(vtkDataSet* theDataSet){ } } aVolume /= aNbElem; - return pow(aVolume,float(1.0/idim)); + return pow(aVolume,vtkFloatingPointType(1.0/idim)); } -void VISU_DeformedShapePL::SetScale(float theScale) { +void +VISU_DeformedShapePL +::SetScale(vtkFloatingPointType theScale) +{ myWarpVector->SetScaleFactor(theScale); myScaleFactor = theScale; Modified(); } -float VISU_DeformedShapePL::GetScale() { + +vtkFloatingPointType +VISU_DeformedShapePL +::GetScale() +{ return myScaleFactor; } -void VISU_DeformedShapePL::Init(){ +void +VISU_DeformedShapePL +::Init() +{ VISU_ScalarMapPL::Init(); - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); vtkDataSet* aDataSet = GetInput2(); - float aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); + vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); static double EPS = 1.0 / VTK_LARGE_FLOAT; if(fabs(aScalarRange[1]) > EPS) @@ -97,16 +117,25 @@ void VISU_DeformedShapePL::Init(){ SetScale(0.0); } -VISU_ScalarMapPL::THook* VISU_DeformedShapePL::DoHook(){ +VISU_ScalarMapPL::THook* +VISU_DeformedShapePL +::DoHook() +{ VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,GetInput2(),myFieldTransform); return myWarpVector->GetOutput(); } -void VISU_DeformedShapePL::Update(){ +void +VISU_DeformedShapePL +::Update() +{ VISU_ScalarMapPL::Update(); } -void VISU_DeformedShapePL::SetMapScale(float theMapScale){ +void +VISU_DeformedShapePL +::SetMapScale(vtkFloatingPointType theMapScale) +{ VISU_ScalarMapPL::SetMapScale(theMapScale); myWarpVector->SetScaleFactor(myScaleFactor*theMapScale); diff --git a/src/PIPELINE/VISU_DeformedShapePL.hxx b/src/PIPELINE/VISU_DeformedShapePL.hxx index 9c2f95a7..fb8d7145 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.hxx +++ b/src/PIPELINE/VISU_DeformedShapePL.hxx @@ -33,30 +33,57 @@ class vtkCellDataToPointData; class SALOME_Transform; class vtkWarpVector; -class VISU_DeformedShapePL : public VISU_ScalarMapPL{ +class VISU_DeformedShapePL : public VISU_ScalarMapPL +{ protected: VISU_DeformedShapePL(); VISU_DeformedShapePL(const VISU_DeformedShapePL&); + + virtual + ~VISU_DeformedShapePL(); + public: vtkTypeMacro(VISU_DeformedShapePL,VISU_ScalarMapPL); - static VISU_DeformedShapePL* New(); - virtual ~VISU_DeformedShapePL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetScale(float theScale); - virtual float GetScale(); + static + VISU_DeformedShapePL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + void + SetScale(vtkFloatingPointType theScale); + + virtual + vtkFloatingPointType + GetScale(); public: - virtual void Init(); - virtual void Update(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual + void + Init(); + + virtual + void + Update(); + + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); - static float GetScaleFactor(vtkDataSet* theDataSet); + static + vtkFloatingPointType + GetScaleFactor(vtkDataSet* theDataSet); protected: - virtual THook* DoHook(); + virtual + THook* + DoHook(); - float myScaleFactor; + vtkFloatingPointType myScaleFactor; vtkWarpVector *myWarpVector; vtkCellDataToPointData* myCellDataToPointData; }; diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index b6423a39..ead86acd 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -67,7 +67,7 @@ execute(int theNbElems, vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD"); if(vtkFloatArray *aFloatArray = dynamic_cast(aFieldArray)){ int aNbComp = aFloatArray->GetNumberOfComponents(); - std::vector anArray(aNbComp < 3? 3: aNbComp); + std::vector anArray(aNbComp < 3? 3: aNbComp); // vtkFloatArray *aScalars = vtkFloatArray::New(); aScalars->SetNumberOfTuples(theNbElems); @@ -76,8 +76,8 @@ execute(int theNbElems, if(!theScalarMode){ for(int anId = 0; anId < theNbElems; anId++){ aFloatArray->GetTuple(anId,&anArray[0]); - float aVector[3] = {anArray[0], anArray[1], anArray[2]}; - float aScalar = sqrt(aVector[0]*aVector[0] + aVector[1]*aVector[1] + aVector[2]*aVector[2]); + vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]}; + vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] + aVector[1]*aVector[1] + aVector[2]*aVector[2]); aScalars->SetTuple1(anId,aScalar); } }else{ diff --git a/src/PIPELINE/VISU_FieldTransform.cxx b/src/PIPELINE/VISU_FieldTransform.cxx index 82081859..b29adb0b 100644 --- a/src/PIPELINE/VISU_FieldTransform.cxx +++ b/src/PIPELINE/VISU_FieldTransform.cxx @@ -15,7 +15,7 @@ #include #include -static float Tolerance = 1.0 / VTK_LARGE_FLOAT; +static vtkFloatingPointType Tolerance = 1.0 / VTK_LARGE_FLOAT; using namespace std; @@ -107,9 +107,9 @@ void VISU_FieldTransform::SetSpaceTransform(VTKViewer_Transform* theTransform){ void VISU_FieldTransform -::SetScalarRange(float theScalarRange[2]) +::SetScalarRange(vtkFloatingPointType theScalarRange[2]) { - float aDelta = + vtkFloatingPointType aDelta = fabs(myScalarRange[0] - theScalarRange[0]) + fabs(myScalarRange[1] - theScalarRange[1]); if(aDelta < Tolerance) @@ -123,17 +123,17 @@ VISU_FieldTransform void VISU_FieldTransform -::SetScalarMin(float theValue) +::SetScalarMin(vtkFloatingPointType theValue) { - float aScalarRange[2] = {theValue, GetScalarRange()[1]}; + vtkFloatingPointType aScalarRange[2] = {theValue, GetScalarRange()[1]}; SetScalarRange(aScalarRange); } void VISU_FieldTransform -::SetScalarMax(float theValue) +::SetScalarMax(vtkFloatingPointType theValue) { - float aScalarRange[2] = {GetScalarRange()[0], theValue}; + vtkFloatingPointType aScalarRange[2] = {GetScalarRange()[0], theValue}; SetScalarRange(aScalarRange); } @@ -141,7 +141,7 @@ VISU_FieldTransform template void ExecVectors(VISU_FieldTransform::TTransformFun theFunction, VTKViewer_Transform* theTransform, - float theScalarRange[2], + vtkFloatingPointType theScalarRange[2], int theNbOfTuples, TypeData* theInputData, TypeData* theOutputData) @@ -152,10 +152,10 @@ ExecVectors(VISU_FieldTransform::TTransformFun theFunction, vtkFloatArray *aNewVectors = vtkFloatArray::New(); aNewVectors->SetNumberOfComponents(3); aNewVectors->SetNumberOfTuples(theNbOfTuples); - float aScalarRange[2] = {(*theFunction)(theScalarRange[0]),(*theFunction)(theScalarRange[1])}; - float aDelta = aScalarRange[1] - aScalarRange[0]; - float aScale[3] = {1.0, 1.0, 1.0}; - static float EPS = 1.0 / VTK_LARGE_FLOAT; + vtkFloatingPointType aScalarRange[2] = {(*theFunction)(theScalarRange[0]),(*theFunction)(theScalarRange[1])}; + vtkFloatingPointType aDelta = aScalarRange[1] - aScalarRange[0]; + vtkFloatingPointType aScale[3] = {1.0, 1.0, 1.0}; + static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT; if(theTransform){ aScale[0] = theTransform->GetScale()[0]; aScale[1] = theTransform->GetScale()[1]; @@ -163,9 +163,9 @@ ExecVectors(VISU_FieldTransform::TTransformFun theFunction, } if(theFunction == &(VISU_FieldTransform::Ident)){ for (int aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) { - float anInVec[3]; + vtkFloatingPointType anInVec[3]; anInVectors->GetTuple(aTupleId,anInVec); - float anNewVec[3]; + vtkFloatingPointType anNewVec[3]; anNewVec[0] = anInVec[0]*aScale[0]; anNewVec[1] = anInVec[1]*aScale[1]; anNewVec[2] = anInVec[2]*aScale[2]; @@ -173,14 +173,14 @@ ExecVectors(VISU_FieldTransform::TTransformFun theFunction, } }else{ for (int aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) { - float anInVec[3]; + vtkFloatingPointType anInVec[3]; anInVectors->GetTuple(aTupleId,anInVec); - float aMagn = vtkMath::Norm(anInVec); + vtkFloatingPointType aMagn = vtkMath::Norm(anInVec); if(aMagn > EPS) aMagn = ((*theFunction)(aMagn) - aScalarRange[0]) / aDelta * theScalarRange[1] / aMagn; if(aMagn < 0.0) aMagn = 0.0; - float anNewVec[3]; + vtkFloatingPointType anNewVec[3]; anNewVec[0] = anInVec[0]*aMagn*aScale[0]; anNewVec[1] = anInVec[1]*aMagn*aScale[1]; anNewVec[2] = anInVec[2]*aMagn*aScale[2]; @@ -193,7 +193,7 @@ ExecVectors(VISU_FieldTransform::TTransformFun theFunction, template void ExecScalars(VISU_FieldTransform::TTransformFun theFunction, - float theScalarRange[2], + vtkFloatingPointType theScalarRange[2], int theNbOfTuples, TypeData* theInputData, TypeData* theOutputData) @@ -204,9 +204,9 @@ ExecScalars(VISU_FieldTransform::TTransformFun theFunction, vtkFloatArray *aNewScalars = vtkFloatArray::New(); aNewScalars->SetNumberOfComponents(1); aNewScalars->SetNumberOfTuples(theNbOfTuples); - float aScalarRange[2] = {(*theFunction)(theScalarRange[0]),(*theFunction)(theScalarRange[1])}; + vtkFloatingPointType aScalarRange[2] = {(*theFunction)(theScalarRange[0]),(*theFunction)(theScalarRange[1])}; for (int aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) { - float aScalar = (*theFunction)(anInScalars->GetTuple1(aTupleId)); + vtkFloatingPointType aScalar = (*theFunction)(anInScalars->GetTuple1(aTupleId)); if(aScalar < aScalarRange[0]) aScalar = aScalarRange[0]; aNewScalars->SetTuple1(aTupleId,aScalar); diff --git a/src/PIPELINE/VISU_FieldTransform.hxx b/src/PIPELINE/VISU_FieldTransform.hxx index 1a22f59a..7050aed3 100644 --- a/src/PIPELINE/VISU_FieldTransform.hxx +++ b/src/PIPELINE/VISU_FieldTransform.hxx @@ -48,10 +48,10 @@ public: void SetSpaceTransform(VTKViewer_Transform* theTransform); VTKViewer_Transform* GetSpaceTransform() { return myTransform;} - float* GetScalarRange(){ return myScalarRange; } - void SetScalarRange(float theScalarRange[2]); - void SetScalarMin(float theValue); - void SetScalarMax(float theValue); + vtkFloatingPointType* GetScalarRange(){ return myScalarRange; } + void SetScalarRange(vtkFloatingPointType theScalarRange[2]); + void SetScalarMin(vtkFloatingPointType theValue); + void SetScalarMax(vtkFloatingPointType theValue); protected: VISU_FieldTransform(); @@ -62,7 +62,7 @@ protected: VTKViewer_Transform *myTransform; TTransformFun myFunction; - float myScalarRange[2]; + vtkFloatingPointType myScalarRange[2]; }; #endif diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 8d1d0dff..c8827e9f 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -196,9 +196,9 @@ VISU_GaussPointsPL Superclass::Init(); vtkDataSet* aDataSet = GetParentMesh(); - float aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); + vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); - float* aScalarRange = GetScalarRange(); + vtkFloatingPointType* aScalarRange = GetScalarRange(); static double EPS = 1.0 / VTK_LARGE_FLOAT; if(fabs(aScalarRange[1]) > EPS) SetScale( aScaleFactor / aScalarRange[1] ); @@ -229,7 +229,7 @@ VISU_GaussPointsPL ::Update() { //cout << "VISU_GaussPointsPL::Update()" << endl; - float* aScalarRange = GetScalarRange(); + vtkFloatingPointType* aScalarRange = GetScalarRange(); mySourceScalarRange[0] = aScalarRange[0]; mySourceScalarRange[1] = aScalarRange[1]; myDeltaScalarRange = aScalarRange[1] - aScalarRange[0]; @@ -256,7 +256,7 @@ VISU_GaussPointsPL { //cout << "VISU_GaussPointsPL::UpdateGlyph()" << endl; - float* aScalarRange = GetScalarRange(); + vtkFloatingPointType* aScalarRange = GetScalarRange(); if( myPSMapper->GetPointSpriteMode() == 0 ) // Results { @@ -265,13 +265,13 @@ VISU_GaussPointsPL myGlyph->SetScaleModeToScaleByScalar(); myGlyph->SetColorModeToColorByScalar(); - float aRange = 0; - float aMinSize = GetMinSize(); - float aMaxSize = GetMaxSize(); + vtkFloatingPointType aRange = 0; + vtkFloatingPointType aMinSize = GetMinSize(); + vtkFloatingPointType aMaxSize = GetMaxSize(); if( fabs( aMaxSize - aMinSize ) > 0.0001 ) aRange = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize ); - float aMinRange = aScalarRange[0] - aMinSize * aRange; - float aMaxRange = aMinRange + aRange; + vtkFloatingPointType aMinRange = aScalarRange[0] - aMinSize * aRange; + vtkFloatingPointType aMaxRange = aMinRange + aRange; myGlyph->SetRange( aMinRange, aMaxRange ); myGlyph->SetScaleFactor( 1.0 ); @@ -306,7 +306,7 @@ VISU_GaussPointsPL return myGaussPtsIDMapper->GetObjID(theID); } -float* +vtkFloatingPointType* VISU_GaussPointsPL ::GetNodeCoord(int theObjID) { @@ -422,7 +422,7 @@ VISU_GaussPointsPL } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetMaximumSupportedSize() { @@ -432,14 +432,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetClamp(float theClamp) +::SetClamp(vtkFloatingPointType theClamp) { myPSMapper->SetPointSpriteClamp( theClamp ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetClamp() { @@ -449,14 +449,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetSize(float theSize) +::SetSize(vtkFloatingPointType theSize) { myPSMapper->SetPointSpriteSize( theSize ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetSize() { @@ -466,14 +466,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetMinSize(float theMinSize) +::SetMinSize(vtkFloatingPointType theMinSize) { myPSMapper->SetPointSpriteMinSize( theMinSize ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetMinSize() { @@ -483,14 +483,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetMaxSize(float theMaxSize) +::SetMaxSize(vtkFloatingPointType theMaxSize) { myPSMapper->SetPointSpriteMaxSize( theMaxSize ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetMaxSize() { @@ -500,14 +500,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetMagnification(float theMagnification) +::SetMagnification(vtkFloatingPointType theMagnification) { myPSMapper->SetPointSpriteMagnification( theMagnification ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetMagnification() { @@ -517,7 +517,7 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetMagnificationIncrement(float theIncrement) +::SetMagnificationIncrement(vtkFloatingPointType theIncrement) { myMagnificationIncrement = theIncrement; } @@ -525,14 +525,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetAlphaThreshold(float theAlphaThreshold) +::SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold) { myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetAlphaThreshold() { @@ -554,25 +554,25 @@ void VISU_GaussPointsPL ::ChangeMagnification( bool up ) { - float anIncrement = up ? myMagnificationIncrement : 1.0 / myMagnificationIncrement; + vtkFloatingPointType anIncrement = up ? myMagnificationIncrement : 1.0 / myMagnificationIncrement; SetMagnification( GetMagnification() * anIncrement ); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray) { - float aMaxSize = GetAverageCellSize() * GetMaxSize(); - float aMinSize = GetAverageCellSize() * GetMinSize(); - float aDelta = aMaxSize - aMinSize; - float aVal = theScalarArray->GetTuple1(theID); + vtkFloatingPointType aMaxSize = GetAverageCellSize() * GetMaxSize(); + vtkFloatingPointType aMinSize = GetAverageCellSize() * GetMinSize(); + vtkFloatingPointType aDelta = aMaxSize - aMinSize; + vtkFloatingPointType aVal = theScalarArray->GetTuple1(theID); return aMinSize + aDelta*(aVal - mySourceScalarRange[0])/myDeltaScalarRange; } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetMaxPointSize() { @@ -580,7 +580,7 @@ VISU_GaussPointsPL } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetPointSize(vtkIdType theID) { @@ -594,14 +594,14 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::SetAverageCellSize(float theAverageCellSize) +::SetAverageCellSize(vtkFloatingPointType theAverageCellSize) { myPSMapper->SetAverageCellSize( theAverageCellSize ); Modified(); } //---------------------------------------------------------------------------- -float +vtkFloatingPointType VISU_GaussPointsPL ::GetAverageCellSize() { @@ -678,19 +678,19 @@ VISU_GaussPointsPL return aCompositeImageData; } -void VISU_GaussPointsPL::SetScale( float theScale ) +void VISU_GaussPointsPL::SetScale( vtkFloatingPointType theScale ) { myWarpVector->SetScaleFactor( theScale ); myScaleFactor = GetScale(); Modified(); } -float VISU_GaussPointsPL::GetScale() +vtkFloatingPointType VISU_GaussPointsPL::GetScale() { return myWarpVector->GetScaleFactor(); } -void VISU_GaussPointsPL::SetMapScale( float theMapScale ) +void VISU_GaussPointsPL::SetMapScale( vtkFloatingPointType theMapScale ) { VISU_ScalarMapPL::SetMapScale( theMapScale ); diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index b342ab56..e8b47fc4 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -107,7 +107,7 @@ public: GetObjID(vtkIdType theID) const; virtual - float* + vtkFloatingPointType* GetNodeCoord(vtkIdType theObjID); void @@ -150,63 +150,63 @@ public: GetPrimitiveType(); //! Get the maximum Point Sprite size, which is supported by hardware. - float + vtkFloatingPointType GetMaximumSupportedSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp. void - SetClamp(float theClamp); + SetClamp(vtkFloatingPointType theClamp); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, vtkFloatingPointType). + vtkFloatingPointType GetClamp(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize. void - SetSize(float theSize); + SetSize(vtkFloatingPointType theSize); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, vtkFloatingPointType). + vtkFloatingPointType GetSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize. void - SetMinSize(float theMinSize); + SetMinSize(vtkFloatingPointType theMinSize); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, vtkFloatingPointType). + vtkFloatingPointType GetMinSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize. void - SetMaxSize(float theMaxSize); + SetMaxSize(vtkFloatingPointType theMaxSize); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, vtkFloatingPointType). + vtkFloatingPointType GetMaxSize(); //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification. void - SetMagnification(float theMagnification); + SetMagnification(vtkFloatingPointType theMagnification); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, vtkFloatingPointType). + vtkFloatingPointType GetMagnification(); //! Set the increment of changing Magnification parameter. void - SetMagnificationIncrement(float theIncrement); + SetMagnificationIncrement(vtkFloatingPointType theIncrement); //! Get the increment of changing Magnification parameter. - float + vtkFloatingPointType GetMagnificationIncrement() { return myMagnificationIncrement; } //! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold. void - SetAlphaThreshold(float theAlphaThreshold); + SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, vtkFloatingPointType). + vtkFloatingPointType GetAlphaThreshold(); //! Set resolution of the Geometrical Sphere. @@ -222,23 +222,23 @@ public: ChangeMagnification( bool up ); //! Get the maximum size of Point Sprites in the presentation. - float + vtkFloatingPointType GetMaxPointSize(); //! Get point size by element's Id. - float + vtkFloatingPointType GetPointSize(vtkIdType theID); //! Get point size by element's Id using the specified scalar array. - float + vtkFloatingPointType GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, float). + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, vtkFloatingPointType). void - SetAverageCellSize(float AverageCellSize); + SetAverageCellSize(vtkFloatingPointType AverageCellSize); - //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, float). - float + //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, vtkFloatingPointType). + vtkFloatingPointType GetAverageCellSize(); //! Set image data for the Point Sprite texture. @@ -259,13 +259,13 @@ public: virtual void SetIsDeformed( bool theIsDeformed ); virtual bool GetIsDeformed() const; - virtual void SetScale( float theScale ); - virtual float GetScale(); - virtual void SetMapScale( float theMapScale = 1.0 ); + virtual void SetScale( vtkFloatingPointType theScale ); + virtual vtkFloatingPointType GetScale(); + virtual void SetMapScale( vtkFloatingPointType theMapScale = 1.0 ); protected: bool myIsDeformed; - float myScaleFactor; + vtkFloatingPointType myScaleFactor; vtkWarpVector *myWarpVector; vtkCellDataToPointData* myCellDataToPointData; std::vector myPassFilter; @@ -281,11 +281,11 @@ protected: vtkGeometryFilter* myGeomFilter; vtkDataArray *myScalarArray; - float mySourceScalarRange[2]; - float myDeltaScalarRange; + vtkFloatingPointType mySourceScalarRange[2]; + vtkFloatingPointType myDeltaScalarRange; int myPrimitiveType; - float myMagnificationIncrement; + vtkFloatingPointType myMagnificationIncrement; }; #endif diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx index 3a3c21a8..08a8dbba 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx @@ -54,7 +54,7 @@ VISU_UnScaledActor::VISU_UnScaledActor() // function: SetCenter // purpose: //==================================================================== -void VISU_UnScaledActor::SetCenter(float *pC) +void VISU_UnScaledActor::SetCenter(vtkFloatingPointType *pC) { for (int i=0; i<3; ++i){ myCenter[i]=pC[i]; @@ -64,7 +64,7 @@ void VISU_UnScaledActor::SetCenter(float *pC) // function:GetBounds // purpose: //==================================================================== -float* VISU_UnScaledActor::GetBounds() +vtkFloatingPointType* VISU_UnScaledActor::GetBounds() { Superclass::GetBounds(); // @@ -81,20 +81,20 @@ float* VISU_UnScaledActor::GetBounds() void VISU_UnScaledActor::Render(vtkRenderer *theRenderer) { if(theRenderer){ - float P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}}; + vtkFloatingPointType P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}}; theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]); theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]); - float aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+ - (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+ - (P[1][2]-P[0][2])*(P[1][2]-P[0][2])); + vtkFloatingPointType aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+ + (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+ + (P[1][2]-P[0][2])*(P[1][2]-P[0][2])); int* aSize = theRenderer->GetRenderWindow()->GetSize(); - float aWinDiag = sqrt(float(aSize[0]*aSize[0]+aSize[1]*aSize[1])); + vtkFloatingPointType aWinDiag = sqrt(vtkFloatingPointType(aSize[0]*aSize[0]+aSize[1]*aSize[1])); vtkDataSet* aDataSet = GetMapper()->GetInput(); - float aLength = aDataSet->GetLength(); - float aPrecision = 1.e-3; - float anOldScale = GetScale()[0]; - float aScale = - mySize*aWorldDiag/aWinDiag/aLength*sqrt(float(aSize[0])/float(aSize[1])); + vtkFloatingPointType aLength = aDataSet->GetLength(); + vtkFloatingPointType aPrecision = 1.e-3; + vtkFloatingPointType anOldScale = GetScale()[0]; + vtkFloatingPointType aScale = + mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1])); SetOrigin(myCenter); // diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx index 8f46e43b..3e278dc0 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx @@ -43,16 +43,16 @@ public: static VISU_UnScaledActor *New(); - void SetCenter(float *); + void SetCenter(vtkFloatingPointType *); virtual void SetSize(int theSize); virtual void Render(vtkRenderer *theRenderer); - virtual float *GetBounds(); + virtual vtkFloatingPointType *GetBounds(); protected: VISU_UnScaledActor(); ~VISU_UnScaledActor(){} - float myCenter[3]; + vtkFloatingPointType myCenter[3]; int mySize; }; diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index 8e14bca9..13941e70 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -33,13 +33,17 @@ vtkStandardNewMacro(VISU_IsoSurfacesPL); -VISU_IsoSurfacesPL::VISU_IsoSurfacesPL(){ +VISU_IsoSurfacesPL +::VISU_IsoSurfacesPL() +{ myContourFilter = vtkContourFilter::New(); myCellDataToPointData = vtkCellDataToPointData::New(); myIsShrinkable = false; } -VISU_IsoSurfacesPL::~VISU_IsoSurfacesPL(){ +VISU_IsoSurfacesPL +::~VISU_IsoSurfacesPL() +{ myContourFilter->UnRegisterAllOutputs(); myContourFilter->Delete(); @@ -47,71 +51,105 @@ VISU_IsoSurfacesPL::~VISU_IsoSurfacesPL(){ myCellDataToPointData->Delete(); } -void VISU_IsoSurfacesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ +void +VISU_IsoSurfacesPL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast(thePipeLine)){ SetNbParts(aPipeLine->GetNbParts()); - float aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()}; + vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()}; SetRange(aRange); } VISU_ScalarMapPL::ShallowCopy(thePipeLine); } -int VISU_IsoSurfacesPL::GetNbParts() { +int +VISU_IsoSurfacesPL +::GetNbParts() +{ return myContourFilter->GetNumberOfContours(); } -void VISU_IsoSurfacesPL::SetNbParts(int theNb) { +void +VISU_IsoSurfacesPL +::SetNbParts(int theNb) +{ myContourFilter->SetNumberOfContours(theNb); Modified(); } -void VISU_IsoSurfacesPL::SetScaling(int theScaling) { +void +VISU_IsoSurfacesPL +::SetScaling(int theScaling) +{ VISU_ScalarMapPL::SetScaling(theScaling); SetRange(myRange); } -void VISU_IsoSurfacesPL::SetRange(float theRange[2]){ +void +VISU_IsoSurfacesPL +::SetRange(vtkFloatingPointType theRange[2]) +{ if(theRange[0] <= theRange[1]){ myRange[0] = theRange[0]; myRange[1] = theRange[1]; - float aRange[2] = {myRange[0], myRange[1]}; + vtkFloatingPointType aRange[2] = {myRange[0], myRange[1]}; if(GetScaling() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(theRange,aRange); myContourFilter->GenerateValues(GetNbParts(),aRange); Modified(); } } -float VISU_IsoSurfacesPL::GetMin() { + +vtkFloatingPointType +VISU_IsoSurfacesPL +::GetMin() +{ return myRange[0]; } -float VISU_IsoSurfacesPL::GetMax() { + +vtkFloatingPointType +VISU_IsoSurfacesPL +::GetMax() +{ return myRange[1]; } -void VISU_IsoSurfacesPL::Init(){ +void +VISU_IsoSurfacesPL +::Init() +{ VISU_ScalarMapPL::Init(); SetNbParts(10); - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); SetRange(aScalarRange); } -VISU_ScalarMapPL::THook* VISU_IsoSurfacesPL::DoHook(){ +VISU_ScalarMapPL::THook* +VISU_IsoSurfacesPL +::DoHook() +{ VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform); return myContourFilter->GetOutput(); } -void VISU_IsoSurfacesPL::Update() +void +VISU_IsoSurfacesPL +::Update() { VISU_ScalarMapPL::Update(); } -void VISU_IsoSurfacesPL::SetMapScale(float theMapScale){ +void +VISU_IsoSurfacesPL +::SetMapScale(vtkFloatingPointType theMapScale) +{ VISU_ScalarMapPL::SetMapScale(theMapScale); - float aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()}; - float aNewRange[2] = {aRange[0], aRange[1]}; + vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()}; + vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]}; if(GetScaling() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aNewRange); myContourFilter->GenerateValues(GetNbParts(),aNewRange); diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.hxx b/src/PIPELINE/VISU_IsoSurfacesPL.hxx index 68732e37..2b62fb18 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.hxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.hxx @@ -32,33 +32,70 @@ class vtkContourFilter; class vtkCellDataToPointData; -class VISU_IsoSurfacesPL : public VISU_ScalarMapPL{ +class VISU_IsoSurfacesPL : public VISU_ScalarMapPL +{ protected: VISU_IsoSurfacesPL(); VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&); + + virtual + ~VISU_IsoSurfacesPL(); + public: vtkTypeMacro(VISU_IsoSurfacesPL,VISU_ScalarMapPL); - static VISU_IsoSurfacesPL* New(); - virtual ~VISU_IsoSurfacesPL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual int GetNbParts(); - virtual void SetNbParts(int theNb = 10); + static + VISU_IsoSurfacesPL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + int + GetNbParts(); + + virtual + void + SetNbParts(int theNb = 10); + + virtual + void + SetScaling(int theScaling = VTK_SCALE_LINEAR); - virtual void SetScaling(int theScaling = VTK_SCALE_LINEAR); - virtual void SetRange(float theRange[2]); - virtual float GetMin(); - virtual float GetMax(); + virtual + void + SetRange(vtkFloatingPointType theRange[2]); + + virtual + vtkFloatingPointType + GetMin(); + + virtual + vtkFloatingPointType + GetMax(); public: - virtual void Init(); - virtual void Update(); - virtual THook* DoHook(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual + void + Init(); + + virtual + void + Update(); + + virtual + THook* + DoHook(); + + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); protected: int myNbParts; - float myRange[2]; + vtkFloatingPointType myRange[2]; vtkCellDataToPointData* myCellDataToPointData; vtkContourFilter *myContourFilter; }; diff --git a/src/PIPELINE/VISU_LookupTable.cxx b/src/PIPELINE/VISU_LookupTable.cxx index c15fdd27..9d9b533b 100644 --- a/src/PIPELINE/VISU_LookupTable.cxx +++ b/src/PIPELINE/VISU_LookupTable.cxx @@ -32,17 +32,18 @@ using namespace std; -VISU_LookupTable *VISU_LookupTable::New() { - vtkObject* ret = vtkObjectFactory::CreateInstance("VISU_LookupTable"); - if(ret) - return (VISU_LookupTable*)ret; - return new VISU_LookupTable; -} +vtkStandardNewMacro(VISU_LookupTable); -VISU_LookupTable::VISU_LookupTable(int sze, int ext) - : vtkLookupTable(sze, ext), myScale(1.0), myBicolor(false) {} +VISU_LookupTable +::VISU_LookupTable(int sze, int ext): + vtkLookupTable(sze, ext), + myScale(1.0), + myBicolor(false) +{} -void VISU_LookupTable::SetMapScale(float theScale) +void +VISU_LookupTable +::SetMapScale(vtkFloatingPointType theScale) { if( myScale != theScale ) { @@ -61,7 +62,11 @@ void VISU_LookupTable::SetBicolor( bool theBicolor ) } -int VISU_LookupTable::ComputeLogRange(float inRange[2], float outRange[2]){ +int +VISU_LookupTable +::ComputeLogRange(vtkFloatingPointType inRange[2], + vtkFloatingPointType outRange[2]) +{ if(inRange[0] >= inRange[1]) return -1; if(0.0 <= inRange[0] && 0.0 < inRange[1]){ @@ -79,9 +84,12 @@ int VISU_LookupTable::ComputeLogRange(float inRange[2], float outRange[2]){ return -1; } -unsigned char* VISU_LookupTable::MapValue(float v) { +unsigned char* +VISU_LookupTable +::MapValue(vtkFloatingPointType v) +{ if(GetScale() == VTK_SCALE_LOG10) { - float aLowBound = log10(this->TableRange[0]); + vtkFloatingPointType aLowBound = log10(this->TableRange[0]); v = pow(10.0f,aLowBound + (v - aLowBound)*myScale); return vtkLookupTable::MapValue(v); } else if (!myBicolor) { @@ -95,8 +103,11 @@ unsigned char* VISU_LookupTable::MapValue(float v) { } // Apply log to value, with appropriate constraints. -inline float VISU_ApplyLogScale(float v, float range[2], - float logRange[2]) +inline +vtkFloatingPointType +VISU_ApplyLogScale(vtkFloatingPointType v, + vtkFloatingPointType range[2], + vtkFloatingPointType logRange[2]) { // is the range set for negative numbers? if (range[0] < 0) @@ -133,15 +144,18 @@ inline float VISU_ApplyLogScale(float v, float range[2], } // Apply shift/scale to the scalar value v and do table lookup. -inline unsigned char *VISU_LinearLookup(float v, - unsigned char *table, - float maxIndex, - float shift, float scale, - bool bicolor) +inline +unsigned char * +VISU_LinearLookup(vtkFloatingPointType v, + unsigned char *table, + vtkFloatingPointType maxIndex, + vtkFloatingPointType shift, + vtkFloatingPointType scale, + bool bicolor) { if( !bicolor ) { - float findx = (v + shift)*scale; + vtkFloatingPointType findx = (v + shift)*scale; if (findx < 0) findx = 0; if (findx > maxIndex) @@ -161,25 +175,30 @@ inline unsigned char *VISU_LinearLookup(float v, // accelerate the mapping by copying the data in 32-bit chunks instead // of 8-bit chunks template -void VISU_LookupTableMapData(vtkLookupTable *self, T *input, - unsigned char *output, int length, - int inIncr, int outFormat, - float theMapScale, bool bicolor) +void +VISU_LookupTableMapData(vtkLookupTable *self, + T *input, + unsigned char *output, + int length, + int inIncr, + int outFormat, + vtkFloatingPointType theMapScale, + bool bicolor) { int i = length; - float *range = self->GetTableRange(); - float maxIndex = self->GetNumberOfColors() - 1; - float shift, scale; + vtkFloatingPointType *range = self->GetTableRange(); + vtkFloatingPointType maxIndex = self->GetNumberOfColors() - 1; + vtkFloatingPointType shift, scale; unsigned char *table = self->GetPointer(0); unsigned char *cptr; - float alpha; + vtkFloatingPointType alpha; if ( (alpha=self->GetAlpha()) >= 1.0 ) //no blending required { if (self->GetScale() == VTK_SCALE_LOG10) { - float val; - float logRange[2]; + vtkFloatingPointType val; + vtkFloatingPointType logRange[2]; VISU_LookupTable::ComputeLogRange(range, logRange); shift = -logRange[0]; if (logRange[1] <= logRange[0]) @@ -309,8 +328,8 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input, { if (self->GetScale() == VTK_SCALE_LOG10) { - float val; - float logRange[2]; + vtkFloatingPointType val; + vtkFloatingPointType logRange[2]; VISU_LookupTable::ComputeLogRange(range, logRange); shift = -logRange[0]; if (logRange[1] <= logRange[0]) @@ -441,10 +460,15 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input, // it is only done on the first render. Colors are cached // for subsequent renders. template -void VISU_LookupTableMapMag(vtkLookupTable *self, T *input, - unsigned char *output, int length, - int inIncr, int outFormat, - float theMapScale, bool bicolor) +void +VISU_LookupTableMapMag(vtkLookupTable *self, + T *input, + unsigned char *output, + int length, + int inIncr, + int outFormat, + vtkFloatingPointType theMapScale, + bool bicolor) { double tmp, sum; double *mag; diff --git a/src/PIPELINE/VISU_LookupTable.hxx b/src/PIPELINE/VISU_LookupTable.hxx index 20f7c23e..72af94a3 100644 --- a/src/PIPELINE/VISU_LookupTable.hxx +++ b/src/PIPELINE/VISU_LookupTable.hxx @@ -20,20 +20,20 @@ class VISU_LookupTable: public vtkLookupTable { int inputDataType, int numberOfValues, int inputIncrement, int outputIncrement); - float GetMapScale() { return myScale; } - void SetMapScale(float theScale = 1.0); + vtkFloatingPointType GetMapScale() { return myScale; } + void SetMapScale(vtkFloatingPointType theScale = 1.0); - float GetBicolor() { return myBicolor; } + bool GetBicolor() { return myBicolor; } void SetBicolor( bool theBicolor ); - static int ComputeLogRange(float inRange[2], float outRange[2]); - unsigned char *MapValue(float v); + static int ComputeLogRange(vtkFloatingPointType inRange[2], vtkFloatingPointType outRange[2]); + unsigned char *MapValue(vtkFloatingPointType v); protected: VISU_LookupTable(int sze=256, int ext=256); ~VISU_LookupTable() {}; - float myScale; + vtkFloatingPointType myScale; bool myBicolor; }; diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index d8eb9e8a..9edaf2e9 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -406,7 +406,7 @@ bool VISU_OpenGLPointSpriteMapper::InitExtensions() //----------------------------------------------------------------------------- float ViewToDisplay( vtkRenderer* theRenderer ) { - float p1[3], p2[3]; + vtkFloatingPointType p1[3], p2[3]; theRenderer->SetViewPoint( 0.0, 0.0, 0.0 ); theRenderer->ViewToDisplay(); @@ -416,7 +416,7 @@ float ViewToDisplay( vtkRenderer* theRenderer ) theRenderer->ViewToDisplay(); theRenderer->GetDisplayPoint( p2 ); - float coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 ); + vtkFloatingPointType coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 ); //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl; //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl; //cout << "ZOOM : " << coefficient << endl; @@ -753,7 +753,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints, TVertex* aVertexArr = new TVertex[ this->TotalCells ]; - float* aPropertyColor = theActor->GetProperty()->GetColor(); + vtkFloatingPointType* aPropertyColor = theActor->GetProperty()->GetColor(); float aColor[3] = {aPropertyColor[0], aPropertyColor[1], aPropertyColor[2]}; unsigned long i = 0; @@ -763,7 +763,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints, { TVertex& aVertex = aVertexArr[i]; vtkIdType aPointId = pts[0]; - float* aCoords = thePoints->GetPoint( aPointId ); + vtkFloatingPointType* aCoords = thePoints->GetPoint( aPointId ); aVertex.vx = aCoords[0]; aVertex.vy = aCoords[1]; aVertex.vz = aCoords[2]; diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 9fcd66fd..34ba2a61 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -181,7 +181,7 @@ VISU_PipeLine int VISU_PipeLine -::CheckAvailableMemory(const float& theSize) +::CheckAvailableMemory(const vtkFloatingPointType& theSize) { try{ if(theSize > ULONG_MAX) return 0; @@ -202,10 +202,10 @@ VISU_PipeLine return 0; } -float +vtkFloatingPointType VISU_PipeLine -::GetAvailableMemory(float theSize, - float theMinSize) +::GetAvailableMemory(vtkFloatingPointType theSize, + vtkFloatingPointType theMinSize) { while(!CheckAvailableMemory(theSize)) if(theSize > theMinSize) @@ -279,36 +279,36 @@ VISU_PipeLine static void ComputeBoundsParam (vtkDataSet* theDataSet, - float theDirection[3], - float theMinPnt[3], - float& theMaxBoundPrj, - float& theMinBoundPrj) + vtkFloatingPointType theDirection[3], + vtkFloatingPointType theMinPnt[3], + vtkFloatingPointType& theMaxBoundPrj, + vtkFloatingPointType& theMinBoundPrj) { - float aBounds[6]; + vtkFloatingPointType aBounds[6]; theDataSet->GetBounds(aBounds); //Enlarge bounds in order to avoid conflicts of precision for(int i = 0; i < 6; i += 2){ static double EPS = 1.0E-3; - float aDelta = (aBounds[i+1] - aBounds[i])*EPS; + vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS; aBounds[i] -= aDelta; aBounds[i+1] += aDelta; } - float aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]}, - {aBounds[1],aBounds[2],aBounds[4]}, - {aBounds[0],aBounds[3],aBounds[4]}, - {aBounds[1],aBounds[3],aBounds[4]}, - {aBounds[0],aBounds[2],aBounds[5]}, - {aBounds[1],aBounds[2],aBounds[5]}, - {aBounds[0],aBounds[3],aBounds[5]}, - {aBounds[1],aBounds[3],aBounds[5]}}; + vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]}, + {aBounds[1],aBounds[2],aBounds[4]}, + {aBounds[0],aBounds[3],aBounds[4]}, + {aBounds[1],aBounds[3],aBounds[4]}, + {aBounds[0],aBounds[2],aBounds[5]}, + {aBounds[1],aBounds[2],aBounds[5]}, + {aBounds[0],aBounds[3],aBounds[5]}, + {aBounds[1],aBounds[3],aBounds[5]}}; int aMaxId = 0, aMinId = aMaxId; theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]); theMinBoundPrj = theMaxBoundPrj; for(int i = 1; i < 8; i++){ - float aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]); + vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]); if(theMaxBoundPrj < aTmp){ theMaxBoundPrj = aTmp; aMaxId = i; @@ -318,7 +318,7 @@ ComputeBoundsParam (vtkDataSet* theDataSet, aMinId = i; } } - float *aMinPnt = aBoundPoints[aMaxId]; + vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId]; theMinPnt[0] = aMinPnt[0]; theMinPnt[1] = aMinPnt[1]; theMinPnt[2] = aMinPnt[2]; @@ -327,13 +327,13 @@ ComputeBoundsParam (vtkDataSet* theDataSet, static void DistanceToPosition(vtkDataSet* theDataSet, - float theDirection[3], - float theDist, - float thePos[3]) + vtkFloatingPointType theDirection[3], + vtkFloatingPointType theDist, + vtkFloatingPointType thePos[3]) { - float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; + vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj); - float aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist; + vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist; thePos[0] = aMinPnt[0]-theDirection[0]*aLength; thePos[1] = aMinPnt[1]-theDirection[1]*aLength; thePos[2] = aMinPnt[2]-theDirection[2]*aLength; @@ -342,37 +342,37 @@ DistanceToPosition(vtkDataSet* theDataSet, static void PositionToDistance (vtkDataSet* theDataSet, - float theDirection[3], - float thePos[3], - float& theDist) + vtkFloatingPointType theDirection[3], + vtkFloatingPointType thePos[3], + vtkFloatingPointType& theDist) { - float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; + vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj); - float aPrj = vtkMath::Dot(theDirection,thePos); + vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos); theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj); } void VISU_PipeLine -::SetPlaneParam(float theDir[3], - float theDist, +::SetPlaneParam(vtkFloatingPointType theDir[3], + vtkFloatingPointType theDist, vtkPlane* thePlane) { thePlane->SetNormal(theDir); - float anOrigin[3]; + vtkFloatingPointType anOrigin[3]; ::DistanceToPosition(GetInput(),theDir,theDist,anOrigin); thePlane->SetOrigin(anOrigin); } void VISU_PipeLine -::GetPlaneParam(float theDir[3], - float& theDist, +::GetPlaneParam(vtkFloatingPointType theDir[3], + vtkFloatingPointType& theDist, vtkPlane* thePlane) { thePlane->GetNormal(theDir); - float anOrigin[3]; + vtkFloatingPointType anOrigin[3]; thePlane->GetOrigin(anOrigin); ::PositionToDistance(GetInput(),theDir,anOrigin,theDist); } @@ -385,7 +385,7 @@ bool VISU_PipeLine ::IsPlanarInput() const { - float aBounds[6]; + vtkFloatingPointType aBounds[6]; GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax if (fabs( aBounds[0] - aBounds[1] ) <= FLT_MIN || fabs( aBounds[2] - aBounds[3] ) <= FLT_MIN || @@ -412,7 +412,7 @@ VISU_PipeLine return myExtractGeometry->GetNodeVTKId(anID); } -float* +vtkFloatingPointType* VISU_PipeLine ::GetNodeCoord(int theObjID) { diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index 5e2a1ed8..76d3d2bc 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -135,12 +135,12 @@ public: static int - CheckAvailableMemory(const float& theSize); + CheckAvailableMemory(const vtkFloatingPointType& theSize); static - float - GetAvailableMemory(float theSize = 16*1024*1024.0, - float theMinSize = 1024*1024.0); + vtkFloatingPointType + GetAvailableMemory(vtkFloatingPointType theSize = 16*1024*1024.0, + vtkFloatingPointType theMinSize = 1024*1024.0); // Clipping planes void @@ -156,13 +156,13 @@ public: GetClippingPlane(vtkIdType theID) const; void - SetPlaneParam(float theDir[3], - float theDist, + SetPlaneParam(vtkFloatingPointType theDir[3], + vtkFloatingPointType theDist, vtkPlane* thePlane); void - GetPlaneParam(float theDir[3], - float& theDist, + GetPlaneParam(vtkFloatingPointType theDir[3], + vtkFloatingPointType& theDist, vtkPlane* thePlane); bool @@ -177,7 +177,7 @@ public: GetNodeVTKID(vtkIdType theID); virtual - float* + vtkFloatingPointType* GetNodeCoord(vtkIdType theObjID); virtual diff --git a/src/PIPELINE/VISU_PipeLineUtils.cxx b/src/PIPELINE/VISU_PipeLineUtils.cxx index f60c2cca..404baf1e 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.cxx +++ b/src/PIPELINE/VISU_PipeLineUtils.cxx @@ -26,11 +26,19 @@ #include "VISU_PipeLineUtils.hxx" -void VISU::Mul(const float A[3], float b, float C[3]){ // A*b; +void +VISU::Mul(const vtkFloatingPointType A[3], + vtkFloatingPointType b, + vtkFloatingPointType C[3]) +{ // A*b; for(int i = 0; i < 3; i++) C[i] = A[i]*b; } -void VISU::Sub(const float A[3], const float B[3], float C[3]){ //A-B +void +VISU::Sub(const vtkFloatingPointType A[3], + const vtkFloatingPointType B[3], + vtkFloatingPointType C[3]) +{ //A-B for(int i = 0; i < 3; i++) C[i] = A[i] - B[i]; } diff --git a/src/PIPELINE/VISU_PipeLineUtils.hxx b/src/PIPELINE/VISU_PipeLineUtils.hxx index 7b252350..af67ea96 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.hxx +++ b/src/PIPELINE/VISU_PipeLineUtils.hxx @@ -55,9 +55,17 @@ #endif -namespace VISU{ - void Mul(const float A[3], float b, float C[3]); // C = A * b - void Sub(const float A[3], const float B[3], float C[3]); // C = A - B +namespace VISU +{ + void + Mul(const vtkFloatingPointType A[3], + vtkFloatingPointType b, + vtkFloatingPointType C[3]); // C = A * b + + void + Sub(const vtkFloatingPointType A[3], + const vtkFloatingPointType B[3], + vtkFloatingPointType C[3]); // C = A - B template void diff --git a/src/PIPELINE/VISU_PlanesWidget.cxx b/src/PIPELINE/VISU_PlanesWidget.cxx index 93efa07b..dff6b274 100644 --- a/src/PIPELINE/VISU_PlanesWidget.cxx +++ b/src/PIPELINE/VISU_PlanesWidget.cxx @@ -61,16 +61,19 @@ #include static - bool IsValidPlane2Position(vtkPlane *pPx, - vtkDataSet *pDataSet, - float aTol=0.003); +bool +IsValidPlane2Position(vtkPlane *pPx, + vtkDataSet *pDataSet, + vtkFloatingPointType aTol=0.003); static - void GetBndPoints(vtkDataSet *pDataSet, - float aPnts[24]); +void +GetBndPoints(vtkDataSet *pDataSet, + vtkFloatingPointType aPnts[24]); static - float DistanceToPlane(const float x[3], - const float n[3], - const float p0[3]); +vtkFloatingPointType +DistanceToPlane(const vtkFloatingPointType x[3], + const vtkFloatingPointType n[3], + const vtkFloatingPointType p0[3]); vtkCxxRevisionMacro(VISU_PlanesWidget, "$Revision$"); vtkStandardNewMacro(VISU_PlanesWidget); @@ -207,7 +210,7 @@ VISU_PlanesWidget::VISU_PlanesWidget() this->Transform = vtkTransform::New(); // Define the point coordinates - float bounds[6]; + vtkFloatingPointType bounds[6]; bounds[0] = -0.5; bounds[1] = 0.5; bounds[2] = -0.5; @@ -311,14 +314,16 @@ vtkImplicitFunction* VISU_PlanesWidget::ImplicitFunction() // function: SetDistance // purpose : //================================================================== -void VISU_PlanesWidget::SetDistance(const float theDistance) +void +VISU_PlanesWidget +::SetDistance(const vtkFloatingPointType theDistance) { if( theDistance <= 0.0 || theDistance == myDistance ) return; myDistance=theDistance; // - float *origin, *normal, oNew[3], aN2[3]; + vtkFloatingPointType *origin, *normal, oNew[3], aN2[3]; origin = myPlane1->GetOrigin(); normal = myPlane1->GetNormal(); vtkMath::Normalize(normal); @@ -335,7 +340,9 @@ void VISU_PlanesWidget::SetDistance(const float theDistance) // function: Distance // purpose : //================================================================== -float VISU_PlanesWidget::Distance()const +vtkFloatingPointType +VISU_PlanesWidget +::Distance() const { return myDistance; } @@ -853,13 +860,13 @@ void VISU_PlanesWidget::Push(double *p1, double *p2) { //Get the motion vector int i; - float v[3]; + vtkFloatingPointType v[3]; // for (i=0; i<3; ++i){ v[i] = p2[i] - p1[i]; } // - float aOr1[3], aNr1[3], aNr2[3], aD, z1; + vtkFloatingPointType aOr1[3], aNr1[3], aNr2[3], aD, z1; // myPlane1->GetOrigin(aOr1); myPlane1->GetNormal(aNr1); @@ -893,9 +900,9 @@ void VISU_PlanesWidget::TranslateOrigin(double *p1, double *p2) } // //Add to the current point, project back down onto plane - float *o = myPlane1->GetOrigin(); - float *n = myPlane1->GetNormal(); - float newOrigin[3]; + vtkFloatingPointType *o = myPlane1->GetOrigin(); + vtkFloatingPointType *n = myPlane1->GetNormal(); + vtkFloatingPointType newOrigin[3]; // for (i=0; i<3; ++i){ newOrigin[i]=o[i] + v[i]; @@ -908,9 +915,9 @@ void VISU_PlanesWidget::TranslateOrigin(double *p1, double *p2) // function: SetOriginInternal // purpose : Set the origin of the plane.(for Internal calls) //================================================================== -void VISU_PlanesWidget::SetOriginInternal(float x[3]) +void VISU_PlanesWidget::SetOriginInternal(vtkFloatingPointType x[3]) { - float *bounds = this->myOutline->GetOutput()->GetBounds(); + vtkFloatingPointType *bounds = this->myOutline->GetOutput()->GetBounds(); int i, j; for (i=0; i<3; ++i) { j=2*i; @@ -923,7 +930,7 @@ void VISU_PlanesWidget::SetOriginInternal(float x[3]) } // bool bFlag; - float aOr2[3], aNr2[3], aNr1[3]; + vtkFloatingPointType aOr2[3], aNr2[3], aNr1[3]; vtkPlane *pPx; // myPlane1->GetNormal(aNr1); @@ -959,8 +966,8 @@ void VISU_PlanesWidget::Rotate(int X, int Y, v[i] = p2[i] - p1[i]; } // - float *origin = myPlane1->GetOrigin(); - float *normal = myPlane1->GetNormal(); + vtkFloatingPointType *origin = myPlane1->GetOrigin(); + vtkFloatingPointType *normal = myPlane1->GetNormal(); // Create axis of rotation and angle of rotation vtkMath::Cross(vpn,v,axis); @@ -982,7 +989,7 @@ void VISU_PlanesWidget::Rotate(int X, int Y, this->Transform->Translate(-origin[0],-origin[1],-origin[2]); //Set the new normal - float nNew[3], aN2[3], oNew[3]; + vtkFloatingPointType nNew[3], aN2[3], oNew[3]; this->Transform->TransformNormal(normal,nNew); // for (i=0; i<3; ++i){ @@ -1013,7 +1020,7 @@ void VISU_PlanesWidget::Rotate(int X, int Y, void VISU_PlanesWidget::PushDistance(double *p1, double *p2) { int i; - float v[3], *anOrigin1, *aN1, *anOrigin2, *aN2, aD; + vtkFloatingPointType v[3], *anOrigin1, *aN1, *anOrigin2, *aN2, aD; //Get the motion vector for (i=0; i<3; ++i){ v[i] = p2[i] - p1[i]; @@ -1026,17 +1033,17 @@ void VISU_PlanesWidget::PushDistance(double *p1, double *p2) vtkMath::Normalize(aN1); - float origin[3]; + vtkFloatingPointType origin[3]; double distance = vtkMath::Dot( v, aN2 ); for(i=0; i<3; ++i) { origin[i] = anOrigin2[i] + distance * aN2[i]; } - float d = DistanceToPlane(origin, aN1, anOrigin1); + vtkFloatingPointType d = DistanceToPlane(origin, aN1, anOrigin1); if( d <= 0.0 ) return; // bool bFlag; - float aOr2[3], aNr2[3]; + vtkFloatingPointType aOr2[3], aNr2[3]; vtkPlane *pPx; // myPlane2->GetOrigin(aOr2); @@ -1073,8 +1080,8 @@ void VISU_PlanesWidget::TranslatePlane(double *p1, double *p2) v[2] = p2[2] - p1[2]; //Translate the plane - float oNew[3]; - float *origin = myPlane1->GetOrigin(); + vtkFloatingPointType oNew[3]; + vtkFloatingPointType *origin = myPlane1->GetOrigin(); oNew[0] = origin[0] + v[0]; oNew[1] = origin[1] + v[1]; oNew[2] = origin[2] + v[2]; @@ -1101,8 +1108,8 @@ void VISU_PlanesWidget::TranslateOutline(double *p1, double *p2) v[2] = p2[2] - p1[2]; //Translate the bounding box - float *origin = myBox->GetOrigin(); - float oNew[3]; + vtkFloatingPointType *origin = myBox->GetOrigin(); + vtkFloatingPointType oNew[3]; oNew[0] = origin[0] + v[0]; oNew[1] = origin[1] + v[1]; oNew[2] = origin[2] + v[2]; @@ -1138,10 +1145,10 @@ void VISU_PlanesWidget::Scale(double *p1, double *p2, v[2] = p2[2] - p1[2]; //int res = this->PlaneSource->GetXResolution(); - float *o = myPlane1->GetOrigin(); + vtkFloatingPointType *o = myPlane1->GetOrigin(); // Compute the scale factor - float sf = vtkMath::Norm(v) / this->myOutline->GetOutput()->GetLength(); + vtkFloatingPointType sf = vtkMath::Norm(v) / this->myOutline->GetOutput()->GetLength(); if ( Y > this->Interactor->GetLastEventPosition()[1] ) { sf = 1.0 + sf; } @@ -1154,9 +1161,9 @@ void VISU_PlanesWidget::Scale(double *p1, double *p2, this->Transform->Scale(sf,sf,sf); this->Transform->Translate(-o[0],-o[1],-o[2]); - float *origin = myBox->GetOrigin(); - float *spacing = myBox->GetSpacing(); - float oNew[3], p[3], pNew[3]; + vtkFloatingPointType *origin = myBox->GetOrigin(); + vtkFloatingPointType *spacing = myBox->GetSpacing(); + vtkFloatingPointType oNew[3], p[3], pNew[3]; p[0] = origin[0] + spacing[0]; p[1] = origin[1] + spacing[1]; p[2] = origin[2] + spacing[2]; @@ -1215,9 +1222,9 @@ void VISU_PlanesWidget::CreateDefaultProperties() // function: InitialPlaceWidget // purpose : //================================================================== -void VISU_PlanesWidget::InitialPlaceWidget(float bds[6]) +void VISU_PlanesWidget::InitialPlaceWidget(vtkFloatingPointType bds[6]) { - float bounds[6], origin[3]; + vtkFloatingPointType bounds[6], origin[3]; PlaceWidget(bds); // @@ -1226,7 +1233,7 @@ void VISU_PlanesWidget::InitialPlaceWidget(float bds[6]) (bounds[3]+bounds[2])/2.0, (bounds[5]+bounds[4])/2.0); - static float DIST_COEFF = 0.1; + static vtkFloatingPointType DIST_COEFF = 0.1; SetDistance(this->InitialLength*DIST_COEFF); // this->UpdateRepresentation(); @@ -1235,10 +1242,10 @@ void VISU_PlanesWidget::InitialPlaceWidget(float bds[6]) // function: PlaceWidget // purpose : //================================================================== -void VISU_PlanesWidget::PlaceWidget(float bds[6]) +void VISU_PlanesWidget::PlaceWidget(vtkFloatingPointType bds[6]) { int i; - float bounds[6], origin[3]; + vtkFloatingPointType bounds[6], origin[3]; this->AdjustBounds(bds, bounds, origin); @@ -1281,9 +1288,9 @@ void VISU_PlanesWidget::PlaceWidget(float bds[6]) // function: SetOrigin // purpose :Set the origin of the plane.(for external calls) //================================================================== -void VISU_PlanesWidget::SetOrigin(float x, float y, float z) +void VISU_PlanesWidget::SetOrigin(vtkFloatingPointType x, vtkFloatingPointType y, vtkFloatingPointType z) { - float origin[3]; + vtkFloatingPointType origin[3]; origin[0] = x; origin[1] = y; origin[2] = z; @@ -1293,9 +1300,9 @@ void VISU_PlanesWidget::SetOrigin(float x, float y, float z) // function: SetOrigin // purpose : Set the origin of the plane.(for external calls) //================================================================== -void VISU_PlanesWidget::SetOrigin(float x[3]) +void VISU_PlanesWidget::SetOrigin(vtkFloatingPointType x[3]) { - float *bounds = this->myOutline->GetOutput()->GetBounds(); + vtkFloatingPointType *bounds = this->myOutline->GetOutput()->GetBounds(); for (int i=0; i<3; i++) { if ( x[i] < bounds[2*i] ) { x[i] = bounds[2*i]; @@ -1305,7 +1312,7 @@ void VISU_PlanesWidget::SetOrigin(float x[3]) } } myPlane1->SetOrigin(x); - float *origin, *normal, oNew[3]; + vtkFloatingPointType *origin, *normal, oNew[3]; origin = myPlane1->GetOrigin(); normal = myPlane1->GetNormal(); vtkMath::Normalize(normal); @@ -1319,12 +1326,12 @@ void VISU_PlanesWidget::SetOrigin(float x[3]) // function: GetOrigin // purpose :Get the origin of the plane. //================================================================== -float* VISU_PlanesWidget::GetOrigin() +vtkFloatingPointType* VISU_PlanesWidget::GetOrigin() { return myPlane1->GetOrigin(); } -void VISU_PlanesWidget::GetOrigin(float xyz[3]) +void VISU_PlanesWidget::GetOrigin(vtkFloatingPointType xyz[3]) { myPlane1->GetOrigin(xyz); } @@ -1332,9 +1339,9 @@ void VISU_PlanesWidget::GetOrigin(float xyz[3]) // function: SetNormal // purpose :Set the normal to the plane. //================================================================== -void VISU_PlanesWidget::SetNormal(float x, float y, float z) +void VISU_PlanesWidget::SetNormal(vtkFloatingPointType x, vtkFloatingPointType y, vtkFloatingPointType z) { - float n[3]; + vtkFloatingPointType n[3]; n[0] = x; n[1] = y; n[2] = z; @@ -1352,7 +1359,7 @@ void VISU_PlanesWidget::SetNormal(float x, float y, float z) // function: SetNormal // purpose :Set the normal to the plane. //================================================================== -void VISU_PlanesWidget::SetNormal(float n[3]) +void VISU_PlanesWidget::SetNormal(vtkFloatingPointType n[3]) { this->SetNormal(n[0], n[1], n[2]); } @@ -1360,7 +1367,7 @@ void VISU_PlanesWidget::SetNormal(float n[3]) // function: GetNormal // purpose :Get the normal to the plane. //================================================================== -float* VISU_PlanesWidget::GetNormal() +vtkFloatingPointType* VISU_PlanesWidget::GetNormal() { return myPlane1->GetNormal(); } @@ -1368,7 +1375,7 @@ float* VISU_PlanesWidget::GetNormal() // function: GetNormal // purpose :Get the normal to the plane. //================================================================== -void VISU_PlanesWidget::GetNormal(float xyz[3]) +void VISU_PlanesWidget::GetNormal(vtkFloatingPointType xyz[3]) { myPlane1->GetNormal(xyz); } @@ -1492,12 +1499,12 @@ void VISU_PlanesWidget::UpdateRepresentation() return; } - float *origin = myPlane1->GetOrigin(); - float *normal = myPlane1->GetNormal(); - float p2[3]; + vtkFloatingPointType *origin = myPlane1->GetOrigin(); + vtkFloatingPointType *normal = myPlane1->GetNormal(); + vtkFloatingPointType p2[3]; // Setup the plane normal - float d = this->myOutline->GetOutput()->GetLength(); + vtkFloatingPointType d = this->myOutline->GetOutput()->GetLength(); p2[0] = origin[0] + 0.30 * d * normal[0]; p2[1] = origin[1] + 0.30 * d * normal[1]; @@ -1540,12 +1547,12 @@ void VISU_PlanesWidget::PrintSelf(ostream& os, vtkIndent indent) //================================================================== bool IsValidPlane2Position(vtkPlane *pPx, vtkDataSet *pDataSet, - float aTol) + vtkFloatingPointType aTol) { bool bRet; int i, iFound; - float aD, aDmax, aPnts[24], aDiagonal; - float aTol1, aOr[3], aN[3]; + vtkFloatingPointType aD, aDmax, aPnts[24], aDiagonal; + vtkFloatingPointType aTol1, aOr[3], aN[3]; // bRet=false; aDiagonal=pDataSet->GetLength(); @@ -1575,15 +1582,16 @@ bool IsValidPlane2Position(vtkPlane *pPx, // function: GetBndPoints // purpose : //================================================================== -void GetBndPoints(vtkDataSet *pDataSet, - float aPnts[24]) +void +GetBndPoints(vtkDataSet *pDataSet, + vtkFloatingPointType aPnts[24]) { - int aIndx[24]={ + int aIndx[24] = { 0,2,4,1,2,4,1,3,4,0,3,4, 0,2,5,1,2,5,1,3,5,0,3,5 }; int i; - float *pBounds=pDataSet->GetBounds(); + vtkFloatingPointType *pBounds=pDataSet->GetBounds(); // for (i=0; i<24; ++i){ aPnts[i]=pBounds[aIndx[i]]; @@ -1593,13 +1601,14 @@ void GetBndPoints(vtkDataSet *pDataSet, // function: DistanceToPlane // purpose : //================================================================== -float DistanceToPlane(const float x[3], - const float n[3], - const float p0[3]) +vtkFloatingPointType +DistanceToPlane(const vtkFloatingPointType x[3], + const vtkFloatingPointType n[3], + const vtkFloatingPointType p0[3]) { - return ((float) (n[0]*(x[0]-p0[0]) + - n[1]*(x[1]-p0[1]) + - n[2]*(x[2]-p0[2]))); + return ((n[0]*(x[0]-p0[0]) + + n[1]*(x[1]-p0[1]) + + n[2]*(x[2]-p0[2]))); } /* //================================================================== @@ -1608,7 +1617,7 @@ float DistanceToPlane(const float x[3], //================================================================== void VISU_PlanesWidget::SizeHandles() { - // float radius = + // vtkFloatingPointType radius = this->vtk3DWidget::SizeHandles(1.35); } */ diff --git a/src/PIPELINE/VISU_PlanesWidget.hxx b/src/PIPELINE/VISU_PlanesWidget.hxx index fdf45367..2b4370d0 100644 --- a/src/PIPELINE/VISU_PlanesWidget.hxx +++ b/src/PIPELINE/VISU_PlanesWidget.hxx @@ -59,31 +59,59 @@ public: vtkTypeRevisionMacro(VISU_PlanesWidget,VISU_ImplicitFunctionWidget); void PrintSelf(ostream& os, vtkIndent indent); - void SetDistance (const float theDistance); - float Distance()const; + void + SetDistance(const vtkFloatingPointType theDistance); - vtkGetMacro(InitialLength,float); + vtkFloatingPointType + Distance() const; - virtual vtkImplicitFunction* ImplicitFunction(); + vtkGetMacro(InitialLength,vtkFloatingPointType); + + virtual + vtkImplicitFunction* + ImplicitFunction(); // Description: // Methods that satisfy the superclass' API. - virtual void SetEnabled(int); - virtual void PlaceWidget(float bounds[6]); + virtual + void + SetEnabled(int); + + virtual + void + PlaceWidget(vtkFloatingPointType bounds[6]); // Description: // Get the origin of the plane. - void SetOrigin(float x, float y, float z); - void SetOrigin(float x[3]); - float* GetOrigin(); - void GetOrigin(float xyz[3]); + void + SetOrigin(vtkFloatingPointType x, + vtkFloatingPointType y, + vtkFloatingPointType z); + + void + SetOrigin(vtkFloatingPointType x[3]); + + vtkFloatingPointType* + GetOrigin(); + + void + GetOrigin(vtkFloatingPointType xyz[3]); // Description: // Get the normal to the plane. - void SetNormal(float x, float y, float z); - void SetNormal(float x[3]); - float* GetNormal(); - void GetNormal(float xyz[3]); + void + SetNormal(vtkFloatingPointType x, + vtkFloatingPointType y, + vtkFloatingPointType z); + + void + SetNormal(vtkFloatingPointType x[3]); + + vtkFloatingPointType* + GetNormal(); + + void + GetNormal(vtkFloatingPointType xyz[3]); // Description: // Force the plane widget to be aligned with one of the x-y-z axes. @@ -91,13 +119,20 @@ public: // Remember that when the state changes, a ModifiedEvent is invoked. // This can be used to snap the plane to the axes if it is orginally // not aligned. - void SetNormalToXAxis(int); + void + SetNormalToXAxis(int); + vtkGetMacro(NormalToXAxis,int); vtkBooleanMacro(NormalToXAxis,int); - void SetNormalToYAxis(int); + + void + SetNormalToYAxis(int); + vtkGetMacro(NormalToYAxis,int); vtkBooleanMacro(NormalToYAxis,int); - void SetNormalToZAxis(int); + + void + SetNormalToZAxis(int); vtkGetMacro(NormalToZAxis,int); vtkBooleanMacro(NormalToZAxis,int); @@ -113,8 +148,12 @@ public: // interferes with the object that it is operating on (i.e., the // plane interferes with the cut surface it produces producing // z-buffer artifacts.) - void SetDrawPlane(int plane); - int GetDrawPlane(){ + void + SetDrawPlane(int plane); + + int + GetDrawPlane() + { return myDrawPlane; } @@ -128,7 +167,8 @@ public: // Description: // Grab the polydata that defines the plane. The polydata contains a single // polygon that is clipped by the bounding box. - void GetPolyData(vtkPolyData *pd); + void + GetPolyData(vtkPolyData *pd); // Description: // Satisfies superclass API. This returns a pointer to the underlying @@ -140,12 +180,14 @@ public: // instance of the class vtkPlane. Note that vtkPlane is a subclass of // vtkImplicitFunction, meaning that it can be used by a variety of filters // to perform clipping, cutting, and selection of data. - void GetPlane(vtkPlane *plane); + void + GetPlane(vtkPlane *plane); // Description: // Satisfies the superclass API. This will change the state of the widget // to match changes that have been made to the underlying PolyDataSource - void UpdatePlacement(void); + void + UpdatePlacement(void); // Description: // Get the properties on the normal (line and cone). @@ -168,7 +210,8 @@ public: // applies to the edges when tubed.) vtkGetObjectMacro(EdgesProperty,vtkProperty); - void InitialPlaceWidget(float bds[6]); + void + InitialPlaceWidget(vtkFloatingPointType bds[6]); protected: VISU_PlanesWidget(); @@ -191,8 +234,10 @@ protected: //ETX //handles the events - static void ProcessEvents(vtkObject* object, unsigned long event, - void* clientdata, void* calldata); + static + void + ProcessEvents(vtkObject* object, unsigned long event, + void* clientdata, void* calldata); // ProcessEvents() dispatches to these methods. void OnLeftButtonDown(); @@ -204,7 +249,7 @@ protected: void OnMouseMove(); // // Methods to manipulate the plane - void ConstrainOrigin(float x[3]); + void ConstrainOrigin(vtkFloatingPointType x[3]); void Rotate(int X, int Y, double *p1, double *p2, double *vpn); void TranslatePlane(double *p1, double *p2); void TranslateOutline(double *p1, double *p2); @@ -221,7 +266,7 @@ protected: void HighlightNormal(int highlight); void HighlightOutline(int highlight); void UpdateRepresentation(); - void SetOriginInternal(float x[3]); + void SetOriginInternal(vtkFloatingPointType x[3]); // Controlling ivars int NormalToXAxis; @@ -238,7 +283,7 @@ protected: vtkPlane *myPlane1; vtkPlane *myPlane2; - float myDistance; + vtkFloatingPointType myDistance; vtkImplicitBoolean *myImplicitFunction; // The bounding box is represented by a single voxel image data diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 164d9a7a..928accc0 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -86,9 +86,9 @@ GetOrientation(vtkDataSet* theDataSet) { theDataSet->Update(); - float aBounds[6]; + vtkFloatingPointType aBounds[6]; theDataSet->GetBounds(aBounds); - float aDelta[3] = {aBounds[1] - aBounds[0], aBounds[3] - aBounds[2], aBounds[5] - aBounds[4]}; + vtkFloatingPointType aDelta[3] = {aBounds[1] - aBounds[0], aBounds[3] - aBounds[2], aBounds[5] - aBounds[4]}; if(aDelta[0] >= aDelta[1] && aDelta[0] >= aDelta[2]) if(aDelta[1] >= aDelta[2]) @@ -111,18 +111,18 @@ GetOrientation(vtkDataSet* theDataSet) return VISU_CutPlanesPL::XY; } -float +vtkFloatingPointType VISU_Plot3DPL:: GetScaleFactor(vtkDataSet* theDataSet) { theDataSet->Update(); - float aLength = theDataSet->GetLength(); // diagonal length + vtkFloatingPointType aLength = theDataSet->GetLength(); // diagonal length - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); - static float EPS = 0.3; - float aRange = aScalarRange[1]; + static vtkFloatingPointType EPS = 0.3; + vtkFloatingPointType aRange = aScalarRange[1]; if(aRange > 0.0) return aLength / aRange * EPS; @@ -150,8 +150,8 @@ void VISU_Plot3DPL:: Update() { - float aPlaneNormal[3]; - float anOrigin[3]; + vtkFloatingPointType aPlaneNormal[3]; + vtkFloatingPointType anOrigin[3]; GetBasePlane( anOrigin, aPlaneNormal ); vtkPolyData* aPolyData = 0; @@ -198,7 +198,7 @@ Update() }else myContourFilter->SetInput(aPolyData); - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); myContourFilter->GenerateValues(GetNumberOfContours(),aScalarRange); @@ -232,13 +232,13 @@ GetNumberOfContours() const void VISU_Plot3DPL:: -SetScaleFactor(float theScaleFactor) +SetScaleFactor(vtkFloatingPointType theScaleFactor) { myScaleFactor = theScaleFactor; myWarpScalar->SetScaleFactor(theScaleFactor); } -float +vtkFloatingPointType VISU_Plot3DPL:: GetScaleFactor() const { @@ -247,7 +247,7 @@ GetScaleFactor() const void VISU_Plot3DPL:: -SetPlanePosition(float thePosition, +SetPlanePosition(vtkFloatingPointType thePosition, bool theIsRelative) { myIsRelative = theIsRelative; @@ -269,7 +269,7 @@ GetPlaneOrientation() const } -float +vtkFloatingPointType VISU_Plot3DPL:: GetRotateX() { @@ -281,7 +281,7 @@ GetRotateX() return 0; } -float +vtkFloatingPointType VISU_Plot3DPL:: GetRotateY(){ switch(myOrientation){ @@ -295,8 +295,8 @@ GetRotateY(){ void VISU_Plot3DPL:: SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, - float theXAngle, - float theYAngle) + vtkFloatingPointType theXAngle, + vtkFloatingPointType theYAngle) { switch(theOrientation){ case VISU_CutPlanesPL::XY: myAngle[0] = theXAngle; break; @@ -311,7 +311,7 @@ SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, myOrientation = theOrientation; } -float +vtkFloatingPointType VISU_Plot3DPL:: GetPlanePosition() const { @@ -323,14 +323,14 @@ GetPlanePosition() const //purpose : //======================================================================= -void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], - float theNormal[3], +void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3], bool theCenterOrigine ) const { VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation); - float aPosition = myPosition; - float aBounds[6], aBoundPrj[3]; + vtkFloatingPointType aPosition = myPosition; + vtkFloatingPointType aBounds[6], aBoundPrj[3]; if ( myIsRelative ) { GetInput()->GetBounds(aBounds); @@ -342,7 +342,7 @@ void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], if ( theCenterOrigine ) { // move theOrigin to the center of aBounds projections to the plane GetInput2()->GetBounds(aBounds); - float boundPoints[8][3] = { + vtkFloatingPointType boundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]}, {aBounds[1],aBounds[2],aBounds[4]}, {aBounds[0],aBounds[3],aBounds[4]}, @@ -351,9 +351,9 @@ void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], {aBounds[1],aBounds[2],aBounds[5]}, {aBounds[0],aBounds[3],aBounds[5]}, {aBounds[1],aBounds[3],aBounds[5]}}; - float newOrigin[3] = { 0,0,0 }; + vtkFloatingPointType newOrigin[3] = { 0,0,0 }; for(int i = 0; i < 8; i++) { - float proj[3]; + vtkFloatingPointType proj[3]; vtkPlane::ProjectPoint( boundPoints[i], theOrigin, theNormal, proj ); newOrigin[0] += proj[0]; newOrigin[1] += proj[1]; @@ -370,9 +370,10 @@ void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], //purpose : return absolute position range //======================================================================= -void VISU_Plot3DPL::GetMinMaxPosition( float& minPos, float& maxPos ) const +void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos, + vtkFloatingPointType& maxPos ) const { - float aBounds[6], aBoundPrj[3], aNormal[3]; + vtkFloatingPointType aBounds[6], aBoundPrj[3], aNormal[3]; VISU_CutPlanesPL::GetDir(aNormal,myAngle,myOrientation); GetInput()->GetBounds(aBounds); VISU_CutPlanesPL::GetBoundProject(aBoundPrj,aBounds,aNormal); @@ -385,14 +386,14 @@ void VISU_Plot3DPL::GetMinMaxPosition( float& minPos, float& maxPos ) const //purpose : //======================================================================= -void VISU_Plot3DPL::SetMapScale(float theMapScale) +void VISU_Plot3DPL::SetMapScale(vtkFloatingPointType theMapScale) { VISU_ScalarMapPL::SetMapScale(theMapScale); if ( myIsContour ) { - float aRange[2]; + vtkFloatingPointType aRange[2]; GetSourceRange(aRange); - float aNewRange[] = { aRange[1] - theMapScale*(aRange[1]-aRange[0]), aRange[1] }; + vtkFloatingPointType aNewRange[] = { aRange[1] - theMapScale*(aRange[1]-aRange[0]), aRange[1] }; myContourFilter->GenerateValues(GetNumberOfContours(),aNewRange); } myWarpScalar->SetScaleFactor(myScaleFactor*theMapScale); diff --git a/src/PIPELINE/VISU_Plot3DPL.hxx b/src/PIPELINE/VISU_Plot3DPL.hxx index 9df47b2d..4b60e226 100644 --- a/src/PIPELINE/VISU_Plot3DPL.hxx +++ b/src/PIPELINE/VISU_Plot3DPL.hxx @@ -52,31 +52,31 @@ public: VISU_CutPlanesPL::PlaneOrientation GetPlaneOrientation() const; - float + vtkFloatingPointType GetRotateX(); - float + vtkFloatingPointType GetRotateY(); void SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, - float theXAngle = 0.0, - float theYAngle = 0.0); + vtkFloatingPointType theXAngle = 0.0, + vtkFloatingPointType theYAngle = 0.0); - float + vtkFloatingPointType GetPlanePosition() const; bool IsPositionRelative() const; void - SetPlanePosition(float thePosition, + SetPlanePosition(vtkFloatingPointType thePosition, bool theIsRelative); void - SetScaleFactor(float theScaleFactor); + SetScaleFactor(vtkFloatingPointType theScaleFactor); - float + vtkFloatingPointType GetScaleFactor() const; void @@ -91,11 +91,12 @@ public: int GetNumberOfContours() const; - void GetBasePlane (float theOrigin[3], - float theNormal[3], + void GetBasePlane (vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3], bool theCenterOrigine = false ) const; - void GetMinMaxPosition( float& minPos, float& maxPos ) const; + void GetMinMaxPosition( vtkFloatingPointType& minPos, + vtkFloatingPointType& maxPos ) const; public: virtual void Init(); @@ -105,17 +106,17 @@ public: VISU_CutPlanesPL::PlaneOrientation GetOrientation(vtkDataSet* theDataSet); - float + vtkFloatingPointType GetScaleFactor(vtkDataSet* theDataSet); - void SetMapScale(float theMapScale); + void SetMapScale(vtkFloatingPointType theMapScale); protected: virtual THook* DoHook(); - float myAngle[3]; + vtkFloatingPointType myAngle[3]; bool myIsRelative, myIsContour; - float myPosition, myScaleFactor; + vtkFloatingPointType myPosition, myScaleFactor; VISU_CutPlanesPL::PlaneOrientation myOrientation; TVTKSmartPtr myCellDataToPointData; diff --git a/src/PIPELINE/VISU_ScalarBarActor.cxx b/src/PIPELINE/VISU_ScalarBarActor.cxx index afa44bd7..b6625853 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.cxx +++ b/src/PIPELINE/VISU_ScalarBarActor.cxx @@ -258,7 +258,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) // we hard code how many steps to display int numColors = this->MaximumNumberOfColors; - float *range = lut->GetRange(); + vtkFloatingPointType *range = lut->GetRange(); int numPts = 2*(numColors + 1); vtkPoints *pts = vtkPoints::New(); @@ -315,13 +315,13 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) this->NumberOfLabelsBuilt = this->NumberOfLabels; // generate points - float x[3]; x[2] = 0.0; - float delta, val; + vtkFloatingPointType x[3]; x[2] = 0.0; + vtkFloatingPointType delta, val; if ( this->Orientation == VTK_ORIENT_VERTICAL ) { barWidth = size[0] - 4 - labelSize[0]; barHeight = (int)(0.86*size[1]); - delta=(float)barHeight/numColors; + delta=(vtkFloatingPointType)barHeight/numColors; for (i=0; iInsertNextCell(4,ptIds); if ( isLogTable ){ //SALOME specific - float rgbval = log10(range[0]) + + vtkFloatingPointType rgbval = log10(range[0]) + i*(log10(range[1])-log10(range[0]))/(numColors -1); rgba = lut->MapValue(rgbval); }else{ rgba = lut->MapValue(range[0] + (range[1] - range[0])* - ((float)i /(numColors-1.0))); + ((vtkFloatingPointType)i /(numColors-1.0))); } rgb = colors->GetPointer(3*i); //write into array directly @@ -383,7 +383,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) for (i=0; i < this->NumberOfLabels; i++) { - val = (float)i/(this->NumberOfLabels-1) *barHeight; + val = (vtkFloatingPointType)i/(this->NumberOfLabels-1) *barHeight; this->TextMappers[i]->GetSize(viewport,sizeTextData); this->TextMappers[i]->GetTextProperty()->SetJustificationToLeft(); this->TextActors[i]->SetPosition(barWidth+3, @@ -397,7 +397,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) for (i=0; i < this->NumberOfLabels; i++) { this->TextMappers[i]->GetTextProperty()->SetJustificationToCentered(); - val = (float)i/(this->NumberOfLabels-1) * barWidth; + val = (vtkFloatingPointType)i/(this->NumberOfLabels-1) * barWidth; this->TextActors[i]->SetPosition(val, barHeight + 0.05*size[1]); } } @@ -503,7 +503,7 @@ void VISU_ScalarBarActor::ShallowCopy(vtkProp *prop) void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, vtkViewport *viewport, - float *range) + vtkFloatingPointType *range) { labelSize[0] = labelSize[1] = 0; @@ -512,7 +512,7 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, char string[512]; - float val; + vtkFloatingPointType val; int i; // TODO: this should be optimized, maybe by keeping a list of @@ -529,11 +529,11 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, this->TextMappers[i] = vtkTextMapper::New(); if(isLogTable && 0 < i && i < this->NumberOfLabels - 1){ // SALOME specific - float lval = log10(range[0]) + (float)i/(this->NumberOfLabels-1) * + vtkFloatingPointType lval = log10(range[0]) + (vtkFloatingPointType)i/(this->NumberOfLabels-1) * (log10(range[1])-log10(range[0])); val = pow(10,lval); }else{ - val = range[0] + (float)i/(this->NumberOfLabels-1) * (range[1]-range[0]); + val = range[0] + (vtkFloatingPointType)i/(this->NumberOfLabels-1) * (range[1]-range[0]); } sprintf(string, this->LabelFormat, val); this->TextMappers[i]->SetInput(string); diff --git a/src/PIPELINE/VISU_ScalarBarActor.hxx b/src/PIPELINE/VISU_ScalarBarActor.hxx index be2f62ce..7db60d5a 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.hxx +++ b/src/PIPELINE/VISU_ScalarBarActor.hxx @@ -138,7 +138,7 @@ protected: vtkTextMapper **TextMappers; virtual void AllocateAndSizeLabels(int *labelSize, int *size, - vtkViewport *viewport, float *range); + vtkViewport *viewport, vtkFloatingPointType *range); private: vtkTextMapper *TitleMapper; diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index 561b2432..8f24c298 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -45,7 +45,7 @@ namespace inline void MarkValueByColor(vtkLookupTable* theTable, - float theValue, + vtkFloatingPointType theValue, unsigned char* theColor) { vtkIdType anIndex = theTable->GetIndex(theValue); @@ -81,12 +81,12 @@ namespace unsigned char aRedPtr[3] = {255, 0, 0}; unsigned char aBluePtr[3] = {0, 0, 255}; - float aRange[2]; + vtkFloatingPointType aRange[2]; theTable->GetTableRange(aRange); vtkIdType aNbColors = theTable->GetNumberOfColors(); - float aDelta = (aRange[1]-aRange[0])/aNbColors; - float aValue = aRange[0]+0.5*aDelta; + vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors; + vtkFloatingPointType aValue = aRange[0]+0.5*aDelta; for(int i = 0; i < aNbColors; i++){ vtkIdType anIndex = theTable->GetIndex(aValue); unsigned char* aTablePtr = theTable->GetPointer(anIndex); @@ -206,15 +206,15 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetRangeLocal(float *theRange) +::SetRangeLocal(vtkFloatingPointType *theRange) { myLocalLookupTable->SetTableRange(theRange); } void VISU_ScalarBarCtrl -::SetRangeLocal(float theMin, - float theMax) +::SetRangeLocal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax) { myLocalLookupTable->SetTableRange(theMin,theMax); } @@ -223,15 +223,15 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetRangeGlobal(float *theRange) +::SetRangeGlobal(vtkFloatingPointType *theRange) { myGlobalLookupTable->SetTableRange(theRange); } void VISU_ScalarBarCtrl -::SetRangeGlobal(float theMin, - float theMax) +::SetRangeGlobal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax) { myGlobalLookupTable->SetTableRange(theMin,theMax); } @@ -298,13 +298,13 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetWidth(float theWidth) +::SetWidth(vtkFloatingPointType theWidth) { myGlobalScalarBar->SetWidth(theWidth); myLocalScalarBar->SetWidth(theWidth); } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetWidth() const { @@ -315,14 +315,14 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetHeight(float theHeight) +::SetHeight(vtkFloatingPointType theHeight) { myGlobalScalarBar->SetHeight(theHeight); myLocalScalarBar->SetHeight(theHeight); } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetHeight() const { @@ -333,13 +333,13 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetPosition(const float* thePosition) +::SetPosition(const vtkFloatingPointType* thePosition) { myPosition[0] = thePosition[0]; myPosition[1] = thePosition[1]; } -const float* +const vtkFloatingPointType* VISU_ScalarBarCtrl::GetPosition() const { return myPosition; @@ -349,12 +349,12 @@ VISU_ScalarBarCtrl::GetPosition() const //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetSpacing(const float theSpacing) +::SetSpacing(const vtkFloatingPointType theSpacing) { myDistance = theSpacing; } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetSpacing() const { @@ -381,12 +381,12 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetMarkValue(const float theValue) +::SetMarkValue(const vtkFloatingPointType theValue) { myMarkedValue = theValue; } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetMarkValue() const { @@ -441,7 +441,7 @@ VISU_ScalarBarCtrl } } if(myGlobalRangeIsDefined){ - float aLocalRange[2]; + vtkFloatingPointType aLocalRange[2]; myLocalLookupTable->GetTableRange(aLocalRange); MarkValueByColor(myGlobalLookupTable, aLocalRange[0], myBlack); MarkValueByColor(myGlobalLookupTable, aLocalRange[1], myBlack); @@ -459,10 +459,10 @@ VISU_ScalarBarCtrl vtkCoordinate * aCoordinate = theScalarBarActor->GetPositionCoordinate(); aCoordinate->SetCoordinateSystemToNormalizedViewport(); if(theScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL){ - float aWidth = theScalarBarActor->GetWidth(); + vtkFloatingPointType aWidth = theScalarBarActor->GetWidth(); aCoordinate->SetValue(myPosition[0]+theId*(aWidth+myDistance), myPosition[1]); }else{ - float aHeight = theScalarBarActor->GetHeight(); + vtkFloatingPointType aHeight = theScalarBarActor->GetHeight(); aCoordinate->SetValue(myPosition[0], myPosition[1]+theId*(aHeight+myDistance)); } // Initialize Lookup Tables and Scalar Bars diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx index c1a2f958..db7bec43 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.hxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.hxx @@ -37,88 +37,147 @@ class VISU_ScalarBarCtrl : public vtkObject { public: vtkTypeMacro(VISU_ScalarBarCtrl, vtkObject); - static VISU_ScalarBarCtrl* New(); + static + VISU_ScalarBarCtrl* + New(); enum EMode {eSimple, eGlobal, eLocal}; // Mode - void SetMode(EMode theMode); - EMode GetMode() const; + void + SetMode(EMode theMode); + + EMode + GetMode() const; // Ranges - void SetRangeGlobal(float theMin, - float theMax); - void SetRangeGlobal(float *theRange); + void + SetRangeGlobal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax); + void + SetRangeGlobal(vtkFloatingPointType *theRange); - void SetGlobalRangeIsDefined(bool theIsDefined); + void + SetGlobalRangeIsDefined(bool theIsDefined); - void SetRangeLocal(float theMin, - float theMax); - void SetRangeLocal(float *theRange); + void + SetRangeLocal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax); + void + SetRangeLocal(vtkFloatingPointType *theRange); // Selectors - vtkScalarBarActor* GetLocalBar(); - vtkLookupTable* GetLocalTable(); + vtkScalarBarActor* + GetLocalBar(); + + vtkLookupTable* + GetLocalTable(); - vtkScalarBarActor* GetGlobalBar(); - vtkLookupTable* GetGlobalTable(); + vtkScalarBarActor* + GetGlobalBar(); + + vtkLookupTable* + GetGlobalTable(); // // Renderer - void AddToRender(vtkRenderer* theRenderer); - void RemoveFromRender(vtkRenderer* theRenderer); + void + AddToRender(vtkRenderer* theRenderer); + + void + RemoveFromRender(vtkRenderer* theRenderer); // // Visibility - void SetVisibility(int theFlag); - int GetVisibility() const; - // + void + SetVisibility(int theFlag); + + int + GetVisibility() const; + // Visibility - void SetCtrlVisibility(int theFlag); - int GetCtrlVisibility() const; - // + void + SetCtrlVisibility(int theFlag); + + int + GetCtrlVisibility() const; + // Build void Update(); - // + // Position - void SetWidth(const float theWidth); - float GetWidth()const; - void SetHeight(const float theHeight); - float GetHeight()const; - void SetPosition(const float* thePosition); - const float* GetPosition()const; + void + SetWidth(const vtkFloatingPointType theWidth); + + vtkFloatingPointType + GetWidth() const; + + void + SetHeight(const vtkFloatingPointType theHeight); + + vtkFloatingPointType + GetHeight() const; + + void + SetPosition(const vtkFloatingPointType* thePosition); + + const vtkFloatingPointType* + GetPosition() const; // // Spacing - void SetSpacing(const float theSpacing); - float GetSpacing()const; + void + SetSpacing(const vtkFloatingPointType theSpacing); + + vtkFloatingPointType + GetSpacing() const; // // Rainbow/bicolor - bool GetBicolor() const; - void SetBicolor(const bool theBicolor); + bool + GetBicolor() const; + + void + SetBicolor(const bool theBicolor); // // Misc - void SetMarkValue (const float theValue); - float GetMarkValue ()const; - void SetIsMarked(const bool theFlag); - bool GetIsMarked()const; + void + SetMarkValue(const vtkFloatingPointType theValue); + + vtkFloatingPointType + GetMarkValue() const; + + void + SetIsMarked(const bool theFlag); + + bool + GetIsMarked()const; // protected: VISU_ScalarBarCtrl(); - virtual ~VISU_ScalarBarCtrl(); + + virtual + ~VISU_ScalarBarCtrl(); - void UpdateForBicolor(); - void UpdateForColor(); - void UpdateMarkValue(); - void PrepareTables(); + void + UpdateForBicolor(); + + void + UpdateForColor(); + + void + UpdateMarkValue(); + + void + PrepareTables(); - void PrepareTables(vtkScalarBarActor* theScalarBarActor, - vtkLookupTable *theLookupTable, - vtkIdType theId); + void + PrepareTables(vtkScalarBarActor* theScalarBarActor, + vtkLookupTable *theLookupTable, + vtkIdType theId); protected: EMode myMode; bool myGlobalRangeIsDefined; - float myDistance; - float myPosition[2]; + vtkFloatingPointType myDistance; + vtkFloatingPointType myPosition[2]; bool myBicolor; int myCtrlVisibility; @@ -126,7 +185,7 @@ protected: unsigned char myGrey[3]; // bool myMarked; - float myMarkedValue; + vtkFloatingPointType myMarkedValue; // vtkScalarBarActor *myGlobalScalarBar; vtkLookupTable *myGlobalLookupTable; diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx index 0d0ccad5..d911cffc 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -48,7 +48,9 @@ vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL) * Merge filter which unify the deformation and scalars * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data */ -VISU_ScalarMapOnDeformedShapePL::VISU_ScalarMapOnDeformedShapePL(){ +VISU_ScalarMapOnDeformedShapePL +::VISU_ScalarMapOnDeformedShapePL() +{ myDeformVectors = vtkWarpVector::New(); myMergeFilter = vtkMergeFilter::New(); myExtractorScalars = VISU_Extractor::New(); @@ -59,7 +61,9 @@ VISU_ScalarMapOnDeformedShapePL::VISU_ScalarMapOnDeformedShapePL(){ * Destructor. * Delete all fields. */ -VISU_ScalarMapOnDeformedShapePL::~VISU_ScalarMapOnDeformedShapePL(){ +VISU_ScalarMapOnDeformedShapePL +::~VISU_ScalarMapOnDeformedShapePL() +{ myDeformVectors->UnRegisterAllOutputs(); myDeformVectors->Delete(); @@ -76,13 +80,15 @@ VISU_ScalarMapOnDeformedShapePL::~VISU_ScalarMapOnDeformedShapePL(){ /*! * Initial method */ -void VISU_ScalarMapOnDeformedShapePL::Init(){ - +void +VISU_ScalarMapOnDeformedShapePL +::Init() +{ if (GetScalars() == NULL) SetScalars(GetInput2()); Superclass::Init(); - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); static double EPS = 1.0 / VTK_LARGE_FLOAT; if(aScalarRange[1] > EPS) @@ -102,7 +108,9 @@ void VISU_ScalarMapOnDeformedShapePL::Init(){ * Build method * Building of deformation and puts result to merge filter. */ -void VISU_ScalarMapOnDeformedShapePL::Build() +void +VISU_ScalarMapOnDeformedShapePL +::Build() { // Set input for extractor myExtractor->SetInput(GetInput2()); @@ -119,12 +127,15 @@ void VISU_ScalarMapOnDeformedShapePL::Build() /*! * Update method */ -void VISU_ScalarMapOnDeformedShapePL::Update(){ +void +VISU_ScalarMapOnDeformedShapePL +::Update() +{ this->UpdateScalars(); - float aRange[2]; + vtkFloatingPointType aRange[2]; GetSourceRange(aRange); - float aScalarRange[2] = {aRange[0], aRange[1]}; + vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]}; if(myBarTable->GetScale() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aScalarRange); @@ -143,7 +154,10 @@ void VISU_ScalarMapOnDeformedShapePL::Update(){ * Update scalars method. * Put scalars to merge filter. */ -void VISU_ScalarMapOnDeformedShapePL::UpdateScalars(){ +void +VISU_ScalarMapOnDeformedShapePL +::UpdateScalars() +{ if(myScalars->GetCellData()->GetVectors() != NULL || myScalars->GetPointData()->GetVectors() != NULL) myMergeFilter->SetScalars(myExtractorScalars->GetOutput()); @@ -155,12 +169,15 @@ void VISU_ScalarMapOnDeformedShapePL::UpdateScalars(){ * Copy information about pipline. * Copy scale and scalars. */ -void VISU_ScalarMapOnDeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){ +void +VISU_ScalarMapOnDeformedShapePL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast(thePipeLine); if(aPipeLine){ SetScale(aPipeLine->GetScale()); SetScalars(aPipeLine->GetScalars()); - float aRange[2]; + vtkFloatingPointType aRange[2]; aPipeLine->GetSourceRange(aRange); SetScalarRange(aRange); } @@ -171,7 +188,10 @@ void VISU_ScalarMapOnDeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){ * Set scalars. * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction. */ -void VISU_ScalarMapOnDeformedShapePL::SetScalars(vtkDataSet *theScalars){ +void +VISU_ScalarMapOnDeformedShapePL +::SetScalars(vtkDataSet *theScalars) +{ myScalars = theScalars; vtkUnstructuredGrid* aScalars = GetScalars(); myExtractorScalars->SetInput(aScalars); @@ -181,14 +201,20 @@ void VISU_ScalarMapOnDeformedShapePL::SetScalars(vtkDataSet *theScalars){ /*! * Get pointer to input scalars. */ -vtkUnstructuredGrid* VISU_ScalarMapOnDeformedShapePL::GetScalars(){ +vtkUnstructuredGrid* +VISU_ScalarMapOnDeformedShapePL +::GetScalars() +{ return myScalars.GetPointer(); } /*! * Sets scale for deformed shape */ -void VISU_ScalarMapOnDeformedShapePL::SetScale(float theScale) { +void +VISU_ScalarMapOnDeformedShapePL +::SetScale(vtkFloatingPointType theScale) +{ if(myScaleFactor == theScale) return; myScaleFactor = theScale; myDeformVectors->SetScaleFactor(myScaleFactor); @@ -198,15 +224,21 @@ void VISU_ScalarMapOnDeformedShapePL::SetScale(float theScale) { /*! * Gets scale of deformed shape. */ -float VISU_ScalarMapOnDeformedShapePL::GetScale() { - float aScale=myDeformVectors->GetScaleFactor(); +vtkFloatingPointType +VISU_ScalarMapOnDeformedShapePL +::GetScale() +{ + vtkFloatingPointType aScale=myDeformVectors->GetScaleFactor(); return aScale; } /*! * Set scale factor of deformation. */ -void VISU_ScalarMapOnDeformedShapePL::SetMapScale(float theMapScale){ +void +VISU_ScalarMapOnDeformedShapePL +::SetMapScale(vtkFloatingPointType theMapScale) +{ myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale); Modified(); } @@ -214,7 +246,10 @@ void VISU_ScalarMapOnDeformedShapePL::SetMapScale(float theMapScale){ /*! * Gets scalar mode. */ -int VISU_ScalarMapOnDeformedShapePL::GetScalarMode(){ +int +VISU_ScalarMapOnDeformedShapePL +::GetScalarMode() +{ int aMode=myExtractorScalars->GetScalarMode(); return aMode; } @@ -222,7 +257,10 @@ int VISU_ScalarMapOnDeformedShapePL::GetScalarMode(){ /*! * Sets scalar mode. */ -void VISU_ScalarMapOnDeformedShapePL::SetScalarMode(int theScalarMode){ +void +VISU_ScalarMapOnDeformedShapePL +::SetScalarMode(int theScalarMode) +{ myExtractorScalars->SetScalarMode(theScalarMode); Modified(); } @@ -233,7 +271,10 @@ void VISU_ScalarMapOnDeformedShapePL::SetScalarMode(int theScalarMode){ * \li theRange[0] - minimum value * \li theRange[1] - maximum value */ -void VISU_ScalarMapOnDeformedShapePL::GetSourceRange(float theRange[2]){ +void +VISU_ScalarMapOnDeformedShapePL +::GetSourceRange(vtkFloatingPointType theRange[2]) +{ myExtractorScalars->Update(); myExtractorScalars->GetUnstructuredGridOutput()->GetScalarRange(theRange); } diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx index 6d1ccf9a..4105c413 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx @@ -50,13 +50,13 @@ public: virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetScale(float theScale); - virtual float GetScale(); + virtual void SetScale(vtkFloatingPointType theScale); + virtual vtkFloatingPointType GetScale(); virtual int GetScalarMode(); virtual void SetScalarMode(int theScalarMode = 0); - virtual void GetSourceRange(float theRange[2]); + virtual void GetSourceRange(vtkFloatingPointType theRange[2]); virtual void SetScalars(vtkDataSet *theScalars); virtual vtkUnstructuredGrid* GetScalars(); @@ -81,10 +81,10 @@ public: void UpdateScalars(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual void SetMapScale(vtkFloatingPointType theMapScale = 1.0); protected: - float myScaleFactor; + vtkFloatingPointType myScaleFactor; vtkWarpVector *myDeformVectors; vtkMergeFilter *myMergeFilter; vtkSmartPointer myScalars; diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index daaa24e6..0d854a16 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -142,7 +142,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- -float* +vtkFloatingPointType* VISU_ScalarMapPL ::GetScalarRange() { @@ -151,7 +151,7 @@ VISU_ScalarMapPL void VISU_ScalarMapPL -::SetScalarRange(float theRange[2]) +::SetScalarRange(vtkFloatingPointType theRange[2]) { myFieldTransform->SetScalarRange(theRange); myBarTable->SetRange(theRange); @@ -160,17 +160,17 @@ VISU_ScalarMapPL void VISU_ScalarMapPL -::SetScalarMin(float theValue) +::SetScalarMin(vtkFloatingPointType theValue) { - float aScalarRange[2] = {theValue, GetScalarRange()[1]}; + vtkFloatingPointType aScalarRange[2] = {theValue, GetScalarRange()[1]}; SetScalarRange(aScalarRange); } void VISU_ScalarMapPL -::SetScalarMax(float theValue) +::SetScalarMax(vtkFloatingPointType theValue) { - float aScalarRange[2] = {GetScalarRange()[0], theValue}; + vtkFloatingPointType aScalarRange[2] = {GetScalarRange()[0], theValue}; SetScalarRange(aScalarRange); } @@ -224,8 +224,8 @@ void VISU_ScalarMapPL ::Update() { - float *aRange = myFieldTransform->GetScalarRange(); - float aScalarRange[2] = {aRange[0], aRange[1]}; + vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange(); + vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]}; if(myBarTable->GetScale() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aScalarRange); myMapperTable->SetRange(aScalarRange); @@ -259,13 +259,13 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::SetMapScale(float theMapScale) +::SetMapScale(vtkFloatingPointType theMapScale) { myMapperTable->SetMapScale(theMapScale); myMapperTable->Build(); } -float +vtkFloatingPointType VISU_ScalarMapPL::GetMapScale() { return myMapperTable->GetMapScale(); @@ -275,7 +275,7 @@ VISU_ScalarMapPL::GetMapScale() //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::GetSourceRange(float theRange[2]) +::GetSourceRange(vtkFloatingPointType theRange[2]) { myExtractor->Update(); myExtractor->GetOutput()->GetScalarRange(theRange); @@ -285,7 +285,7 @@ void VISU_ScalarMapPL ::SetSourceRange() { - float aRange[2]; + vtkFloatingPointType aRange[2]; GetSourceRange(aRange); SetScalarRange(aRange); } diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index 1d810fb9..526b2dae 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -77,20 +77,20 @@ public: SetScaling(int theScaling = VTK_SCALE_LINEAR); virtual - float* + vtkFloatingPointType* GetScalarRange(); virtual void - SetScalarRange(float theRange[2]); + SetScalarRange(vtkFloatingPointType theRange[2]); virtual void - SetScalarMin(float theValue); + SetScalarMin(vtkFloatingPointType theValue); virtual void - SetScalarMax(float theValue); + SetScalarMax(vtkFloatingPointType theValue); virtual void @@ -124,15 +124,15 @@ public: virtual void - SetMapScale(float theMapScale = 1.0); + SetMapScale(vtkFloatingPointType theMapScale = 1.0); virtual - float + vtkFloatingPointType GetMapScale(); virtual void - GetSourceRange(float theRange[2]); + GetSourceRange(vtkFloatingPointType theRange[2]); virtual void diff --git a/src/PIPELINE/VISU_SphereWidget.cxx b/src/PIPELINE/VISU_SphereWidget.cxx index 2134aeb7..985283d6 100755 --- a/src/PIPELINE/VISU_SphereWidget.cxx +++ b/src/PIPELINE/VISU_SphereWidget.cxx @@ -43,7 +43,7 @@ VISU_SphereWidget::VISU_SphereWidget() mySphereActor->SetMapper(mySphereMapper); // // Define the point coordinates - float bounds[6]; + vtkFloatingPointType bounds[6]; for(int i = 0; i < 6; i += 2){ bounds[i]=-.5; bounds[i+1]=-bounds[i]; @@ -126,7 +126,7 @@ int VISU_SphereWidget::GetPhiResolution() // function: SetRadius // purpose : //==================================================================== -void VISU_SphereWidget::SetRadius(float theRadius) +void VISU_SphereWidget::SetRadius(vtkFloatingPointType theRadius) { if ( theRadius <= myRmin ) { theRadius = myRmin; @@ -138,7 +138,7 @@ void VISU_SphereWidget::SetRadius(float theRadius) // function: GetRadius // purpose : //==================================================================== -float VISU_SphereWidget::GetRadius() +vtkFloatingPointType VISU_SphereWidget::GetRadius() { return mySphereSource->GetRadius(); } @@ -146,7 +146,7 @@ float VISU_SphereWidget::GetRadius() // function: SetCenter // purpose : //==================================================================== -void VISU_SphereWidget::SetCenter(float theCenter[3]) +void VISU_SphereWidget::SetCenter(vtkFloatingPointType theCenter[3]) { mySphereSource->SetCenter(theCenter); mySphere->SetCenter(theCenter); @@ -155,9 +155,9 @@ void VISU_SphereWidget::SetCenter(float theCenter[3]) // function: SetCenter // purpose : //==================================================================== -void VISU_SphereWidget::SetCenter(float theX, float theY, float theZ) +void VISU_SphereWidget::SetCenter(vtkFloatingPointType theX, vtkFloatingPointType theY, vtkFloatingPointType theZ) { - float aCenter[3] = {theX, theY, theZ}; + vtkFloatingPointType aCenter[3] = {theX, theY, theZ}; SetCenter(aCenter); } @@ -165,7 +165,7 @@ void VISU_SphereWidget::SetCenter(float theX, float theY, float theZ) // function: GetCenter // purpose : //==================================================================== -float* VISU_SphereWidget::GetCenter() +vtkFloatingPointType* VISU_SphereWidget::GetCenter() { return mySphereSource->GetCenter(); } @@ -173,7 +173,7 @@ float* VISU_SphereWidget::GetCenter() // function: GetCenter // purpose : //==================================================================== -void VISU_SphereWidget::GetCenter(float theCenter[3]) +void VISU_SphereWidget::GetCenter(vtkFloatingPointType theCenter[3]) { mySphereSource->GetCenter(theCenter); } @@ -469,7 +469,7 @@ void VISU_SphereWidget::OnMiddleButtonUp() //==================================================================== void VISU_SphereWidget::Translate(double *p1, double *p2) { - float v[3], aC[3], aC1[3]; + vtkFloatingPointType v[3], aC[3], aC1[3]; // v[0] = p2[0] - p1[0]; v[1] = p2[1] - p1[1]; @@ -495,7 +495,7 @@ void VISU_SphereWidget::Scale(double *p1, double *p2, v[1] = p2[1] - p1[1]; v[2] = p2[2] - p1[2]; // - float aC[3], aR, sf, aR1; + vtkFloatingPointType aC[3], aR, sf, aR1; aR=mySphereSource->GetRadius(); mySphereSource->GetCenter(aC); sf=vtkMath::Norm(v)/aR; @@ -561,12 +561,12 @@ void VISU_SphereWidget::CreateDefaultProperties() // function:PlaceWidget // purpose: //==================================================================== -void VISU_SphereWidget::PlaceWidget(float bds[6]) +void VISU_SphereWidget::PlaceWidget(vtkFloatingPointType bds[6]) { - float bounds[6], center[3], radius; + vtkFloatingPointType bounds[6], center[3], radius; this->AdjustBounds(bds, bounds, center); - float dX, dY, dZ; + vtkFloatingPointType dX, dY, dZ; // dX=bounds[1]-bounds[0]; dY=bounds[3]-bounds[2]; @@ -591,7 +591,7 @@ void VISU_SphereWidget::PlaceWidget(float bds[6]) (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); - static float EPS = 1.0E-1; + static vtkFloatingPointType EPS = 1.0E-1; myRmin = EPS*InitialLength; } diff --git a/src/PIPELINE/VISU_SphereWidget.hxx b/src/PIPELINE/VISU_SphereWidget.hxx index 040a4180..78be7f55 100755 --- a/src/PIPELINE/VISU_SphereWidget.hxx +++ b/src/PIPELINE/VISU_SphereWidget.hxx @@ -33,7 +33,7 @@ public: virtual void SetEnabled(int); // //PlaceWidget - virtual void PlaceWidget(float bounds[6]); + virtual void PlaceWidget(vtkFloatingPointType bounds[6]); // // Description: // Set/Get the resolution of the sphere in the Theta direction. @@ -46,22 +46,24 @@ public: // Description: // Set/Get the radius of sphere. Default is .5. - void SetRadius(float r); - float GetRadius(); + void SetRadius(vtkFloatingPointType r); + vtkFloatingPointType GetRadius(); // Description: // Set/Get the center of the sphere. - void SetCenter(float x, float y, float z); - void SetCenter(float x[3]); + void SetCenter(vtkFloatingPointType x, + vtkFloatingPointType y, + vtkFloatingPointType z); + void SetCenter(vtkFloatingPointType x[3]); - float* GetCenter(); - void GetCenter(float xyz[3]); + vtkFloatingPointType* GetCenter(); + void GetCenter(vtkFloatingPointType xyz[3]); // Description: // Set the ratio of the radius changing. - void SetRatio(float r) { myRatio = r; } - float GetRatio() { return myRatio; } + void SetRatio(vtkFloatingPointType r) { myRatio = r; } + vtkFloatingPointType GetRatio() { return myRatio; } void ChangeRadius(bool up); @@ -122,10 +124,10 @@ protected: // the manipulator in general. vtkProperty *mySphereProperty; vtkProperty *mySelectedSphereProperty; - float myRmin; + vtkFloatingPointType myRmin; vtkSphere *mySphere; vtkImplicitSum* myImplicitSum; - float myRatio; + vtkFloatingPointType myRatio; private: VISU_SphereWidget(const VISU_SphereWidget&); //Not implemented void operator=(const VISU_SphereWidget&); //Not implemented diff --git a/src/PIPELINE/VISU_StreamLinesPL.cxx b/src/PIPELINE/VISU_StreamLinesPL.cxx index 509074a9..834db9de 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.cxx +++ b/src/PIPELINE/VISU_StreamLinesPL.cxx @@ -42,10 +42,10 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -static float EPS = 1.0e-7; -static float aMinNbOfSteps = 1.0E+2; -//static float aMaxNbOfSteps = 1.0E+3; -static float aCoeffOfIntStep = 1.0E+1; +static vtkFloatingPointType EPS = 1.0e-7; +static vtkFloatingPointType aMinNbOfSteps = 1.0E+2; +//static vtkFloatingPointType aMaxNbOfSteps = 1.0E+3; +static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1; vtkStandardNewMacro(VISU_StreamLinesPL); @@ -86,49 +86,57 @@ void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ } -float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength, - float thePropogationTime, float thePercents) +vtkFloatingPointType +VISU_StreamLinesPL +::GetNecasseryMemorySize(vtkIdType theNbOfPoints, + vtkFloatingPointType theStepLength, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType thePercents) { - static float aStreamPointSize = sizeof(float)*15 + sizeof(vtkIdType)*2; - static float aStreamArraySize = aStreamPointSize*1024; // == 69632 + static vtkFloatingPointType aStreamPointSize = sizeof(vtkFloatingPointType)*15 + sizeof(vtkIdType)*2; + static vtkFloatingPointType aStreamArraySize = aStreamPointSize*1024; // == 69632 - float aNbCells = thePercents*theNbOfPoints*2.0; - float aNbPointsPerCell = thePropogationTime/theStepLength; - float aCellsSize = aNbCells*(1+aNbPointsPerCell); - float aPointsSize = aCellsSize*3.0*sizeof(float); + vtkFloatingPointType aNbCells = thePercents*theNbOfPoints*2.0; + vtkFloatingPointType aNbPointsPerCell = thePropogationTime/theStepLength; + vtkFloatingPointType aCellsSize = aNbCells*(1+aNbPointsPerCell); + vtkFloatingPointType aPointsSize = aCellsSize*3.0*sizeof(vtkFloatingPointType); - float aConnectivitySize = aCellsSize*sizeof(vtkIdType); - float aTypesSize = aNbCells*sizeof(char); - float aLocationsSize = aNbCells*sizeof(int); - //float aNbCellsPerPoint = aCellsSize / aNbCells - 1; - float aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize; + vtkFloatingPointType aConnectivitySize = aCellsSize*sizeof(vtkIdType); + vtkFloatingPointType aTypesSize = aNbCells*sizeof(char); + vtkFloatingPointType aLocationsSize = aNbCells*sizeof(int); + //vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1; + vtkFloatingPointType aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize; - float anAssignedDataSize = aCellsSize*4.0*sizeof(float); - float anOutputDataSetSize = aMeshSize + anAssignedDataSize; + vtkFloatingPointType anAssignedDataSize = aCellsSize*4.0*sizeof(vtkFloatingPointType); + vtkFloatingPointType anOutputDataSetSize = aMeshSize + anAssignedDataSize; - float aResult = aStreamArraySize*aNbCells + anOutputDataSetSize; + vtkFloatingPointType aResult = aStreamArraySize*aNbCells + anOutputDataSetSize; return aResult; } -int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength, - float& thePropogationTime, float& thePercents) +int +VISU_StreamLinesPL +::FindPossibleParams(vtkPointSet* theDataSet, + vtkFloatingPointType& theStepLength, + vtkFloatingPointType& thePropogationTime, + vtkFloatingPointType& thePercents) { - static float aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0; + static vtkFloatingPointType aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0; vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints(); - float aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); + vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); int isPoss = CheckAvailableMemory(aSize); if(!isPoss){ - float aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime); - float aMinStepLength = GetMinStepLength(theDataSet); - float aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease; + vtkFloatingPointType aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime); + vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet); + vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease; for(int i = 2, aStepChanged = 1, aPerecentsChanged = 1; aStepChanged || aPerecentsChanged; i++){ - float aStepLength = theStepLength + aDeltaStepLength; + vtkFloatingPointType aStepLength = theStepLength + aDeltaStepLength; if(aStepLength < aMaxStepLength) theStepLength = aStepLength; else if(aStepChanged){ aStepLength = aMaxStepLength; aStepChanged = 0; } - float aPercents = thePercents /= aPercentsDecrease; + vtkFloatingPointType aPercents = thePercents /= aPercentsDecrease; if(aPercents*aNbOfPoints > 1) thePercents = aPercents; else if(aPerecentsChanged) { thePercents = 1.1 / aNbOfPoints; @@ -146,13 +154,15 @@ int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theSt } -int VISU_StreamLinesPL::SetParams(float theIntStep, - float thePropogationTime, - float theStepLength, - vtkPointSet* theSource, - float thePercents, - int theDirection, - int isOnlyTry) +int +VISU_StreamLinesPL +::SetParams(vtkFloatingPointType theIntStep, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType theStepLength, + vtkPointSet* theSource, + vtkFloatingPointType thePercents, + int theDirection, + int isOnlyTry) { vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->GetUnstructuredGridOutput(); aDataSet->Update(); @@ -187,31 +197,50 @@ int VISU_StreamLinesPL::SetParams(float theIntStep, } -vtkPointSet* VISU_StreamLinesPL::GetSource() { +vtkPointSet* +VISU_StreamLinesPL +::GetSource() +{ return mySource; } -float VISU_StreamLinesPL::GetUsedPoints() { +vtkFloatingPointType +VISU_StreamLinesPL +::GetUsedPoints() +{ return myPercents; } -vtkDataSet* VISU_StreamLinesPL::GetStreamerSource(){ +vtkDataSet* +VISU_StreamLinesPL +::GetStreamerSource() +{ return myStream->GetSource(); } -float VISU_StreamLinesPL::GetVelocityCoeff(){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetVelocityCoeff() +{ return GetVelocityCoeff(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetVelocityCoeff(vtkPointSet* theDataSet){ - float* aScalarRange = theDataSet->GetScalarRange(); +vtkFloatingPointType +VISU_StreamLinesPL +::GetVelocityCoeff(vtkPointSet* theDataSet) +{ + vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange(); return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0; } -int VISU_StreamLinesPL::IsPossible(vtkPointSet* theDataSet, float thePercents){ - float aStepLength = GetBaseStepLength(theDataSet); - float aBasePropTime = GetBasePropagationTime(theDataSet); +int +VISU_StreamLinesPL +::IsPossible(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ + vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet); + vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet); VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New(); aPointsFilter->SetInput(theDataSet); vtkPointSet* aDataSet = aPointsFilter->GetOutput(); @@ -223,71 +252,105 @@ int VISU_StreamLinesPL::IsPossible(vtkPointSet* theDataSet, float thePercents){ } -float VISU_StreamLinesPL::GetIntegrationStep(){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetIntegrationStep() +{ return myStream->GetIntegrationStepLength(); } -float VISU_StreamLinesPL::GetStepLength() { + +vtkFloatingPointType +VISU_StreamLinesPL +::GetStepLength() +{ return myStream->GetStepLength(); } -float VISU_StreamLinesPL::GetPropagationTime() { + +vtkFloatingPointType +VISU_StreamLinesPL +::GetPropagationTime() +{ return myStream->GetMaximumPropagationTime(); } -int VISU_StreamLinesPL::GetDirection(){ + +int +VISU_StreamLinesPL +::GetDirection() +{ return myStream->GetIntegrationDirection(); } -float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents) { +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ if(!theDataSet) return -1.0; - float aVolume = 1.0; + vtkFloatingPointType aVolume = 1.0; int degree = 0; theDataSet->Update(); - float* aBounds = theDataSet->GetBounds(); + vtkFloatingPointType* aBounds = theDataSet->GetBounds(); for(int i = 0, j = 0; i < 3; ++i, j = 2*i){ - float tmp = aBounds[j+1] - aBounds[j]; + vtkFloatingPointType tmp = aBounds[j+1] - aBounds[j]; if (tmp > EPS ) { aVolume *= tmp; degree += 1; } } if (degree < 1) return 0.0; // absolutely empty object - float anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep; - float aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet); + vtkFloatingPointType anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep; + vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet); thePercents = 1.0; vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints(); - float aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents); - float aRealSize = GetAvailableMemory(aSize); - float anAverageVolume = aVolume / aRealSize; - float aStep = pow(double(anAverageVolume), double(1.0/double(degree))); + vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents); + vtkFloatingPointType aRealSize = GetAvailableMemory(aSize); + vtkFloatingPointType anAverageVolume = aVolume / aRealSize; + vtkFloatingPointType aStep = pow(double(anAverageVolume), double(1.0/double(degree))); return aStep; } -float VISU_StreamLinesPL::GetMinIntegrationStep(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinIntegrationStep() +{ return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints()); } -float VISU_StreamLinesPL::GetMaxIntegrationStep(vtkPointSet* theDataSet) { +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxIntegrationStep(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; theDataSet->Update(); - float aLength = theDataSet->GetLength(); - float* aBounds = theDataSet->GetBounds(); - float aMaxSizeY = (aBounds[3]-aBounds[2])/aLength; - float aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength; - float aMinMax = (aBounds[1] - aBounds[0])/aLength; + vtkFloatingPointType aLength = theDataSet->GetLength(); + vtkFloatingPointType* aBounds = theDataSet->GetBounds(); + vtkFloatingPointType aMaxSizeY = (aBounds[3]-aBounds[2])/aLength; + vtkFloatingPointType aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength; + vtkFloatingPointType aMinMax = (aBounds[1] - aBounds[0])/aLength; if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY; if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ; return aMinMax*aLength/2.0; } -float VISU_StreamLinesPL::GetMaxIntegrationStep(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxIntegrationStep() +{ return GetMaxIntegrationStep(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetBaseIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ theDataSet->Update(); - float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); - float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); - float anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep; - float aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints(); + vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); + vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); + vtkFloatingPointType anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep; + vtkFloatingPointType aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints(); if(aMinMax > anIntegrationStep) anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep; if(aMinIntegrationStep > anIntegrationStep) @@ -295,10 +358,15 @@ float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float return anIntegrationStep; } -float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){ +vtkFloatingPointType +VISU_StreamLinesPL +::CorrectIntegrationStep(vtkFloatingPointType theStep, + vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ theDataSet->Update(); - float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); - float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); + vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); + vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); if(aMinIntegrationStep > theStep) theStep = aMinIntegrationStep; if(aMaxIntegrationStep < theStep) @@ -307,99 +375,156 @@ float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* the } -float VISU_StreamLinesPL::GetMinPropagationTime(vtkPointSet* theDataSet){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinPropagationTime(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; return GetMinStepLength(theDataSet); } -float VISU_StreamLinesPL::GetMinPropagationTime(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinPropagationTime() +{ return GetMinPropagationTime(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetMaxPropagationTime(vtkPointSet* theDataSet){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxPropagationTime(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; return GetBasePropagationTime(theDataSet)*aMinNbOfSteps; } -float VISU_StreamLinesPL::GetMaxPropagationTime(){ + +vtkFloatingPointType VISU_StreamLinesPL::GetMaxPropagationTime(){ return GetMaxPropagationTime(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet){ - float aMinPropagationTime = GetMinPropagationTime(theDataSet); - float aMaxPropagationTime = GetMaxPropagationTime(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::CorrectPropagationTime(vtkFloatingPointType thePropagationTime, + vtkPointSet* theDataSet) +{ + vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet); + vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet); if(aMinPropagationTime > thePropagationTime) thePropagationTime = aMinPropagationTime; if(aMaxPropagationTime < thePropagationTime) thePropagationTime = aMaxPropagationTime; return thePropagationTime; } -float VISU_StreamLinesPL::GetBasePropagationTime(vtkPointSet* theDataSet){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetBasePropagationTime(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; theDataSet->Update(); - float aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet); + vtkFloatingPointType aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet); return aPropagationTime; } -float VISU_StreamLinesPL::GetBasePropagationTime(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetBasePropagationTime() +{ return GetBasePropagationTime(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetMinStepLength(vtkPointSet* theDataSet){ - static float aNbOfStepsOfIntStep = 1.0E+1; - float anIntStep = GetMinIntegrationStep(theDataSet); - float aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinStepLength(vtkPointSet* theDataSet) +{ + static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1; + vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet); + vtkFloatingPointType aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet); return aStepLength; } -float VISU_StreamLinesPL::GetMinStepLength(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinStepLength() +{ return GetMinStepLength(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetMaxStepLength(vtkPointSet* theDataSet){ - float aStepLength = GetBasePropagationTime(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxStepLength(vtkPointSet* theDataSet) +{ + vtkFloatingPointType aStepLength = GetBasePropagationTime(theDataSet); return aStepLength; } -float VISU_StreamLinesPL::GetMaxStepLength(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxStepLength() +{ return GetMaxStepLength(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::CorrectStepLength(float theStep, vtkPointSet* theDataSet){ - float aMinStep = GetMinStepLength(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::CorrectStepLength(vtkFloatingPointType theStep, + vtkPointSet* theDataSet) +{ + vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet); if(theStep < aMinStep) theStep = aMinStep; - float aMaxStep = GetMaxStepLength(theDataSet); + vtkFloatingPointType aMaxStep = GetMaxStepLength(theDataSet); if(theStep > aMaxStep) theStep = aMaxStep; return theStep; } -float VISU_StreamLinesPL::GetBaseStepLength(vtkPointSet* theDataSet){ - static float anAvgNbOfSteps = 1.0E+2; - float aPropagationTime = GetBasePropagationTime(theDataSet); - float aStepLength = aPropagationTime/anAvgNbOfSteps; + +vtkFloatingPointType +VISU_StreamLinesPL +::GetBaseStepLength(vtkPointSet* theDataSet) +{ + static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2; + vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet); + vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps; aStepLength = CorrectStepLength(aStepLength,theDataSet); return aStepLength; } -void VISU_StreamLinesPL::Init(){ +void +VISU_StreamLinesPL +::Init() +{ VISU_ScalarMapPL::Init(); vtkPointSet* aDataSet = myExtractor->GetOutput(); - float anIntStep = GetBaseIntegrationStep(aDataSet); - float aPropagationTime = GetBasePropagationTime(aDataSet); - float aStepLength = GetBaseStepLength(aDataSet); + vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet); + vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet); + vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet); SetParams(anIntStep,aPropagationTime,aStepLength); } -VISU_ScalarMapPL::THook* VISU_StreamLinesPL::DoHook(){ +VISU_ScalarMapPL::THook* +VISU_StreamLinesPL +::DoHook() +{ GetInput2()->Update(); VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform); - float *aBounds = GetInput2()->GetBounds(); + vtkFloatingPointType *aBounds = GetInput2()->GetBounds(); myGeomFilter->SetExtent(aBounds); myGeomFilter->ExtentClippingOn(); myGeomFilter->SetInput(myStream->GetOutput()); return myGeomFilter->GetOutput(); } -void VISU_StreamLinesPL::Update(){ +void +VISU_StreamLinesPL +::Update() +{ VISU_ScalarMapPL::Update(); } -void VISU_StreamLinesPL::SetMapScale(float theMapScale){ +void +VISU_StreamLinesPL +::SetMapScale(vtkFloatingPointType theMapScale) +{ VISU_ScalarMapPL::SetMapScale(theMapScale); } diff --git a/src/PIPELINE/VISU_StreamLinesPL.hxx b/src/PIPELINE/VISU_StreamLinesPL.hxx index b360f974..448c63ca 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.hxx +++ b/src/PIPELINE/VISU_StreamLinesPL.hxx @@ -37,82 +37,197 @@ class vtkCellCenters; class VTKViewer_GeometryFilter; class VISU_UsedPointsFilter; -class VISU_StreamLinesPL : public VISU_DeformedShapePL{ +class VISU_StreamLinesPL : public VISU_DeformedShapePL +{ protected: VISU_StreamLinesPL(); VISU_StreamLinesPL(const VISU_StreamLinesPL&); + + virtual + ~VISU_StreamLinesPL(); + public: vtkTypeMacro(VISU_StreamLinesPL,VISU_DeformedShapePL); - static VISU_StreamLinesPL* New(); - virtual ~VISU_StreamLinesPL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - - virtual int SetParams(float theIntStep, - float thePropogationTime, - float theStepLength, - vtkPointSet* theSource = NULL, - float thePercents = 0.3, - int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS, - int isOnlyTry = false); - virtual vtkPointSet* GetSource(); - virtual float GetUsedPoints(); - virtual float GetIntegrationStep(); - virtual float GetPropagationTime(); - virtual float GetStepLength(); - virtual int GetDirection(); - - virtual vtkDataSet* GetStreamerSource(); - virtual float GetVelocityCoeff(); - - virtual float GetMaxIntegrationStep(); - virtual float GetMinIntegrationStep(); - - virtual float GetMinStepLength(); - virtual float GetMaxStepLength(); - - virtual float GetMinPropagationTime(); - virtual float GetMaxPropagationTime(); - virtual float GetBasePropagationTime(); + + static + VISU_StreamLinesPL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + int + SetParams(vtkFloatingPointType theIntStep, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType theStepLength, + vtkPointSet* theSource = NULL, + vtkFloatingPointType thePercents = 0.3, + int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS, + int isOnlyTry = false); + + virtual + vtkPointSet* + GetSource(); + + virtual + vtkFloatingPointType + GetUsedPoints(); + + virtual + vtkFloatingPointType + GetIntegrationStep(); + + virtual + vtkFloatingPointType + GetPropagationTime(); + + virtual + vtkFloatingPointType + GetStepLength(); + + virtual + int + GetDirection(); + + virtual + vtkDataSet* + GetStreamerSource(); + + virtual + vtkFloatingPointType + GetVelocityCoeff(); + + virtual + vtkFloatingPointType + GetMaxIntegrationStep(); + + virtual + vtkFloatingPointType + GetMinIntegrationStep(); + + virtual + vtkFloatingPointType + GetMinStepLength(); + + virtual + vtkFloatingPointType + GetMaxStepLength(); + + virtual + vtkFloatingPointType + GetMinPropagationTime(); + + virtual + vtkFloatingPointType + GetMaxPropagationTime(); + + virtual + vtkFloatingPointType + GetBasePropagationTime(); public: - virtual THook* DoHook(); - virtual void Init(); - virtual void Update(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual + THook* + DoHook(); + + virtual + void + Init(); + + virtual + void + Update(); + + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); public: - static float GetMaxIntegrationStep(vtkPointSet* theDataSet); - static float GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents = 0.3); - static float GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents = 0.3); + static + vtkFloatingPointType + GetMaxIntegrationStep(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMinIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); + static + vtkFloatingPointType + GetBaseIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); - static float GetMinPropagationTime(vtkPointSet* theDataSet); - static float GetMaxPropagationTime(vtkPointSet* theDataSet); - static float GetBasePropagationTime(vtkPointSet* theDataSet); + static + vtkFloatingPointType + GetMinPropagationTime(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMaxPropagationTime(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetBasePropagationTime(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMinStepLength(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMaxStepLength(vtkPointSet* theDataSet); - static float GetMinStepLength(vtkPointSet* theDataSet); - static float GetMaxStepLength(vtkPointSet* theDataSet); - static float GetBaseStepLength(vtkPointSet* theDataSet); + static + vtkFloatingPointType + GetBaseStepLength(vtkPointSet* theDataSet); - static float GetVelocityCoeff(vtkPointSet* theDataSet); + static + vtkFloatingPointType + GetVelocityCoeff(vtkPointSet* theDataSet); - static int IsPossible(vtkPointSet* theDataSet, float thePercents = 0.3); + static + int + IsPossible(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); protected: - static float GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength, - float thePropogationTime, float thePercents = 0.3); - static int FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength, - float& thePropogationTime, float& thePercents); + static + vtkFloatingPointType + GetNecasseryMemorySize(vtkIdType theNbOfPoints, + vtkFloatingPointType theStepLength, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType thePercents = 0.3); + + static + int + FindPossibleParams(vtkPointSet* theDataSet, + vtkFloatingPointType& theStepLength, + vtkFloatingPointType& thePropogationTime, + vtkFloatingPointType& thePercents); - static float CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents = 0.3); - static float CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet); - static float CorrectStepLength(float theStep, vtkPointSet* theDataSet); + static + vtkFloatingPointType + CorrectIntegrationStep(vtkFloatingPointType theStep, + vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); + + static + vtkFloatingPointType + CorrectPropagationTime(vtkFloatingPointType thePropagationTime, + vtkPointSet* theDataSet); + + static + vtkFloatingPointType + CorrectStepLength(vtkFloatingPointType theStep, + vtkPointSet* theDataSet); vtkStreamLine* myStream; vtkPointSet* mySource; vtkCellCenters* myCenters; VTKViewer_GeometryFilter *myGeomFilter; VISU_UsedPointsFilter *myPointsFilter; - float myPercents; + vtkFloatingPointType myPercents; }; diff --git a/src/PIPELINE/VISU_VectorsPL.cxx b/src/PIPELINE/VISU_VectorsPL.cxx index 92a5e575..d37324f6 100644 --- a/src/PIPELINE/VISU_VectorsPL.cxx +++ b/src/PIPELINE/VISU_VectorsPL.cxx @@ -101,7 +101,7 @@ VISU_VectorsPL void VISU_VectorsPL -::SetScale(float theScale) +::SetScale(vtkFloatingPointType theScale) { if(myScaleFactor == theScale) return; @@ -114,7 +114,7 @@ VISU_VectorsPL Modified(); } -float +vtkFloatingPointType VISU_VectorsPL ::GetScale() { @@ -219,7 +219,7 @@ VISU_VectorsPL void VISU_VectorsPL -::SetMapScale(float theMapScale) +::SetMapScale(vtkFloatingPointType theMapScale) { VISU_ScalarMapPL::SetMapScale(theMapScale); diff --git a/src/PIPELINE/VISU_VectorsPL.hxx b/src/PIPELINE/VISU_VectorsPL.hxx index 312d56fc..9f3e6db4 100644 --- a/src/PIPELINE/VISU_VectorsPL.hxx +++ b/src/PIPELINE/VISU_VectorsPL.hxx @@ -39,41 +39,94 @@ class vtkLineSource; class vtkGlyph3D; -class VISU_VectorsPL : public VISU_DeformedShapePL{ +class VISU_VectorsPL : public VISU_DeformedShapePL +{ protected: VISU_VectorsPL(); VISU_VectorsPL(const VISU_VectorsPL&); + + virtual + ~VISU_VectorsPL(); + public: vtkTypeMacro(VISU_VectorsPL,VISU_DeformedShapePL); - static VISU_VectorsPL* New(); - virtual ~VISU_VectorsPL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetScale(float theScale); - virtual float GetScale(); + static + VISU_VectorsPL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + void + SetScale(vtkFloatingPointType theScale); + + virtual + vtkFloatingPointType + GetScale(); enum GlyphType{ ARROW, CONE2, CONE6, NONE}; - virtual void SetGlyphType(GlyphType theType) { myTypeGlyph = theType;} - virtual GlyphType GetGlyphType() { return myTypeGlyph;} + + virtual + void + SetGlyphType(GlyphType theType) + { + myTypeGlyph = theType; + } + + virtual + GlyphType + GetGlyphType() + { + return myTypeGlyph; + } enum GlyphPos{ CENTER, TAIL,HEAD}; - virtual void SetGlyphPos(GlyphPos thePos) { myPosGlyph = thePos;} - virtual GlyphPos GetGlyphPos() { return myPosGlyph;} + + virtual + void + SetGlyphPos(GlyphPos thePos) + { + myPosGlyph = thePos; + } + + virtual + GlyphPos + GetGlyphPos() + { + return myPosGlyph; + } public: - virtual void Init(); - virtual void Update(); + virtual + void + Init(); + + virtual + void + Update(); vtkDataSet* GetOutput(); - virtual void SetTransform(VTKViewer_Transform* theTransform); - virtual VTKViewer_Transform* GetTransform(); + virtual + void + SetTransform(VTKViewer_Transform* theTransform); + + virtual + VTKViewer_Transform* + GetTransform(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); protected: - virtual THook* DoHook(); + virtual + THook* + DoHook(); GlyphType myTypeGlyph; GlyphPos myPosGlyph; diff --git a/src/PIPELINE/VISU_WidgetCtrl.cxx b/src/PIPELINE/VISU_WidgetCtrl.cxx index bb62dc63..3e970a52 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.cxx +++ b/src/PIPELINE/VISU_WidgetCtrl.cxx @@ -268,7 +268,7 @@ VISU_SphereWidget* VISU_WidgetCtrl::GetSphereWidget() // function: PlaceWidget // purpose : //================================================================== -void VISU_WidgetCtrl::PlaceWidget(float theBounds[6]) +void VISU_WidgetCtrl::PlaceWidget(vtkFloatingPointType theBounds[6]) { for (int i=0; iPlaceWidget(theBounds); @@ -298,7 +298,7 @@ vtkRenderWindowInteractor* VISU_WidgetCtrl::GetInteractor() // function: SetPlaceFactor // purpose : //================================================================== -void VISU_WidgetCtrl::SetPlaceFactor(float theFactor) +void VISU_WidgetCtrl::SetPlaceFactor(vtkFloatingPointType theFactor) { for (int i=0; iSetPlaceFactor(theFactor); @@ -310,7 +310,7 @@ void VISU_WidgetCtrl::SetPlaceFactor(float theFactor) // function: GetPlaceFactor // purpose : //================================================================== -float VISU_WidgetCtrl::GetPlaceFactor() +vtkFloatingPointType VISU_WidgetCtrl::GetPlaceFactor() { return myWidgets[0]->GetPlaceFactor(); } @@ -324,9 +324,9 @@ vtkImplicitFunction* VISU_WidgetCtrl::ImplicitFunction() } //================================================================== -float +vtkFloatingPointType VISU_WidgetCtrl -::EvaluateFunction(float theX[3]) +::EvaluateFunction(vtkFloatingPointType theX[3]) { if(VISU_ImplicitFunctionWidget* aWidget = GetActiveWidget()){ if(vtkImplicitFunction* aFunction = aWidget->ImplicitFunction()) @@ -338,7 +338,8 @@ VISU_WidgetCtrl //================================================================== void VISU_WidgetCtrl -::EvaluateGradient(float theX[3], float theG[3]) +::EvaluateGradient(vtkFloatingPointType theX[3], + vtkFloatingPointType theG[3]) { theG[0] = theG[1] = theG[2] = 0.0; if(VISU_ImplicitFunctionWidget* aWidget = GetActiveWidget()){ diff --git a/src/PIPELINE/VISU_WidgetCtrl.hxx b/src/PIPELINE/VISU_WidgetCtrl.hxx index 8737b5dc..78b80566 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.hxx +++ b/src/PIPELINE/VISU_WidgetCtrl.hxx @@ -51,18 +51,19 @@ public: vtkImplicitFunction* ImplicitFunction(); virtual - float - EvaluateFunction(float theX[3]); + vtkFloatingPointType + EvaluateFunction(vtkFloatingPointType theX[3]); virtual void - EvaluateGradient(float theX[3], float theG[3]); + EvaluateGradient(vtkFloatingPointType theX[3], + vtkFloatingPointType theG[3]); virtual unsigned long GetMTime(); - void PlaceWidget(float theBounds[6]); + void PlaceWidget(vtkFloatingPointType theBounds[6]); void SetEnabled(int theFlag); int GetEnabled(); void On() {SetEnabled(1);} @@ -71,8 +72,11 @@ public: void SetInteractor(vtkRenderWindowInteractor* theRWI); vtkRenderWindowInteractor* GetInteractor(); // - void SetPlaceFactor(float theFactor); - float GetPlaceFactor(); + void + SetPlaceFactor(vtkFloatingPointType theFactor); + + vtkFloatingPointType + GetPlaceFactor(); // void SetActiveIndex(const int theFlag); int GetActiveIndex()const; @@ -105,7 +109,7 @@ protected: int myActiveIndex; int myCounter; int myDisableAll; - float myPriority; + vtkFloatingPointType myPriority; VISU_ImplicitFunctionWidget *myWidgets[2]; VISU_ImplicitFunctionWidget *myDummyWidget; VISU_PlanesWidget *myPlanesWidget;