1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

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.
This commit is contained in:
Pawel
2013-06-06 10:21:21 +04:00
parent bbf847ad1b
commit 310659466b
2 changed files with 21 additions and 3 deletions

View File

@@ -78,6 +78,15 @@ is
yc : out Real from Standard; yc : out Real from Standard;
zc : out Real from Standard); zc : out Real from Standard);
---Purpose: Returns the center point of a voxel with co-ordinates (ix, iy, iz). ---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; GetVoxel(me;
x : Real from Standard; x : Real from Standard;

View File

@@ -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, 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 Standard_Real& xc, Standard_Real& yc, Standard_Real& zc) const
{ {
xc = myX + ix * myDX + myHalfDX; GetOrigin(ix, iy, iz, xc, yc, zc);
yc = myY + iy * myDY + myHalfDY; xc += myHalfDX;
zc = myZ + iz * myDZ + myHalfDZ; 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. // The method uses a chordial approach to find the index of voxel by co-ordinate.