diff --git a/src/Voxel/Voxel_DS.cdl b/src/Voxel/Voxel_DS.cdl index 20a6187320..941dad609d 100755 --- a/src/Voxel/Voxel_DS.cdl +++ b/src/Voxel/Voxel_DS.cdl @@ -78,6 +78,15 @@ is yc : out Real from Standard; zc : out Real from Standard); ---Purpose: Returns the center point of a voxel with co-ordinates (ix, iy, iz). + + GetOrigin(me; + ix : Integer from Standard; + iy : Integer from Standard; + iz : Integer from Standard; + x0 : out Real from Standard; + y0 : out Real from Standard; + z0 : out Real from Standard); + ---Purpose: Returns the origin point of a voxel with co-ordinates (ix, iy, iz). GetVoxel(me; x : Real from Standard; diff --git a/src/Voxel/Voxel_DS.cxx b/src/Voxel/Voxel_DS.cxx index b7e8ff2bd5..39e3405a42 100755 --- a/src/Voxel/Voxel_DS.cxx +++ b/src/Voxel/Voxel_DS.cxx @@ -112,9 +112,18 @@ Standard_Integer Voxel_DS::GetNbZ() const void Voxel_DS::GetCenter(const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz, Standard_Real& xc, Standard_Real& yc, Standard_Real& zc) const { - xc = myX + ix * myDX + myHalfDX; - yc = myY + iy * myDY + myHalfDY; - zc = myZ + iz * myDZ + myHalfDZ; + GetOrigin(ix, iy, iz, xc, yc, zc); + xc += myHalfDX; + yc += myHalfDY; + zc += myHalfDZ; +} + +void Voxel_DS::GetOrigin(const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz, + Standard_Real& x0, Standard_Real& y0, Standard_Real& z0) const +{ + x0 = myX + ix * myDX; + y0 = myY + iy * myDY; + z0 = myZ + iz * myDZ; } // The method uses a chordial approach to find the index of voxel by co-ordinate.