]> OCCT Git - occt-copy.git/commitdiff
0024010: Voxel_DS: getting the origin point of a voxel
authorPawel <pawel-kowalski@wp.pl>
Thu, 6 Jun 2013 06:21:21 +0000 (10:21 +0400)
committerPawel <pawel-kowalski@wp.pl>
Thu, 6 Jun 2013 06:21:21 +0000 (10:21 +0400)
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.

src/Voxel/Voxel_DS.cdl
src/Voxel/Voxel_DS.cxx

index 20a6187320ed3b291a229835caf87f711698633f..941dad609d79375da8bcc2c04cf19db00eee9552 100755 (executable)
@@ -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;
index b7e8ff2bd5a23d2419be843f1c2ae10bb5b0f7e6..39e3405a427868630ec22fafd64c8fee4d2f9554 100755 (executable)
@@ -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.