CuboidIntegerGrid3D.cpp

Go to the documentation of this file.
00001 
00011 #include "CuboidIntegerGrid3D.h"
00012 
00013 CuboidIntegerGrid3D::CuboidIntegerGrid3D( size_t nx, size_t ny, size_t nz ) :
00014     Point3DSet( nx*ny*nz ), origin(0,0,0)
00015 {
00016     populate( 0, 0, 0, nx, ny, nz );
00017 }
00018 
00019 CuboidIntegerGrid3D::CuboidIntegerGrid3D( Point3D<int> const& size, Point3D<double> const& origin ) :
00020     Point3DSet( size.x() * size.y() * size.z() ), origin( origin )
00021 {
00022     populate( (int)origin.x(), (int)origin.y(), (int)origin.z(), size.x(), size.y(), size.z() );
00023 }
00024 
00025 CuboidIntegerGrid3D::CuboidIntegerGrid3D( Volume3DSize const& size, Point3D<double> const& origin ) :
00026     Point3DSet( size.x() * size.y() * size.z() ), origin( origin )
00027 {
00028     populate( (int)origin.x(), (int)origin.y(), (int)origin.z(), size.x(), size.y(), size.z() );
00029 }
00030 
00031 void CuboidIntegerGrid3D::populate( int ox, int oy, int oz, size_t nx, size_t ny, size_t nz ) {
00032     int x,y,z;
00033     size_t cx,cy,cz;
00034     Point3D<double> p;
00035     size_t i = 0;
00036     for( x=ox, cx=0; cx < nx; cx++, x++ )
00037         for( y=oy, cy=0; cy < ny; cy++, y++ )
00038             for( z=oz, cz=0; cz < nz; cz++, z++ ) {
00039                 p = Point3D<double>(x,y,z);
00040                 m_points[ i ] = p;
00041                 lookup[ p ] = i++;
00042             }
00043 }

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5