From: Pawel Date: Thu, 6 Jun 2013 06:21:21 +0000 (+0400) Subject: 0024010: Voxel_DS: getting the origin point of a voxel X-Git-Tag: V6_7_0_beta~249 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=310659466b2c71e016d6b3874da457d1613b9cca;p=occt-copy.git 0024010: Voxel_DS: getting the origin point of a voxel A method obtaining the voxel origin added. 1. (xc, yc, zc) is renamed to (x0, y0, z0) 2. The method GetCenter() calls now the method GetOrigin() internally to reduce amount of code and increase readability. --- 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.