GridGenerator< T > Class Template Reference

#include <TAPsGridGenerator.hpp>

Collaboration diagram for GridGenerator< T >:

Collaboration graph
[legend]

List of all members.

Public Types

enum  VertexFlag {
  UNSET = 0, OUTSIDE_MODEL, RIGHT_OUTSIDE_BOUNDARY, ON_BOUNDARY,
  RIGHT_INSIDE_BOUNDARY, INSIDE_MODEL, DUMMY, UNSET = 0,
  OUTSIDE_MODEL, RIGHT_OUTSIDE_BOUNDARY, ON_BOUNDARY, RIGHT_INSIDE_BOUNDARY,
  INSIDE_MODEL, DUMMY
}
enum  VertexFlag {
  UNSET = 0, OUTSIDE_MODEL, RIGHT_OUTSIDE_BOUNDARY, ON_BOUNDARY,
  RIGHT_INSIDE_BOUNDARY, INSIDE_MODEL, DUMMY, UNSET = 0,
  OUTSIDE_MODEL, RIGHT_OUTSIDE_BOUNDARY, ON_BOUNDARY, RIGHT_INSIDE_BOUNDARY,
  INSIDE_MODEL, DUMMY
}

Public Member Functions

void DeleteGrids ()
void DeleteGrids ()
bool DoesGridGeneratorGenerateGridInversely () const
bool DoesGridGeneratorGenerateGridInversely () const
bool DoesGridGeneratorGenerateGridNormally () const
bool DoesGridGeneratorGenerateGridNormally () const
bool DoesGridGeneratorUseDefaultIntpVal () const
bool DoesGridGeneratorUseDefaultIntpVal () const
bool DoesGridGeneratorUseHardware () const
bool DoesGridGeneratorUseHardware () const
bool DoesGridGeneratorUseMeshOffsetForIntpVal () const
bool DoesGridGeneratorUseMeshOffsetForIntpVal () const
bool DoesGridGeneratorUseSoftware () const
bool DoesGridGeneratorUseSoftware () const
void DRAW_SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::XPolygonalModel< T > *pXPModel)
void DRAW_SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::XPolygonalModel< T > *pXPModel)
bool GenerateDefinedGrids2x2x2 (unsigned char config=1, int iNumOfXSlices=2, int iNumOfYSlices=2, int iNumOfZSlices=2, Vector3< T > *lowPoint=NULL, Vector3< T > *highPoint=NULL)
bool GenerateGridsWithDimension (T iGridWidth, T iGridHeight, T iGridDepth, Vector3< T > *lowPoint=NULL, Vector3< T > *highPoint=NULL)
bool GenerateGridsWithDimension (T iGridWidth, T iGridHeight, T iGridDepth, Vector3< T > *lowPoint=NULL, Vector3< T > *highPoint=NULL)
bool GenerateGridsWithSize (int iNumOfXSlices, int iNumOfYSlices, int iNumOfZSlices, Vector3< T > *lowPoint=NULL, Vector3< T > *highPoint=NULL)
bool GenerateGridsWithSize (int iNumOfXSlices, int iNumOfYSlices, int iNumOfZSlices, Vector3< T > *lowPoint=NULL, Vector3< T > *highPoint=NULL)
Vector3< T > GetAABBMaxPt () const
Vector3< T > GetAABBMaxPt () const
Vector3< T > GetAABBMinPt () const
Vector3< T > GetAABBMinPt () const
void GetDefaultIntpVal () const
void GetDefaultIntpVal () const
GetGridDimensionX () const
GetGridDimensionX () const
GetGridDimensionY () const
GetGridDimensionY () const
GetGridDimensionZ () const
GetGridDimensionZ () const
int GetGridSizeX () const
int GetGridSizeX () const
int GetGridSizeY () const
int GetGridSizeY () const
int GetGridSizeZ () const
int GetGridSizeZ () const
OpenGL::Model< T > * GetModelUseToGenGrid () const
OpenGL::Model< T > * GetModelUseToGenGrid () const
 GridGenerator (OpenGL::Model< T > *pModel=NULL, bool useSoftware=false, bool genInversely=false, bool useDefaultIntpValue=false, T defaultIntpValue=0.5)
 GridGenerator (OpenGL::Model< T > *pModel=NULL, bool useSoftware=false, bool genInversely=false, bool useDefaultIntpValue=false, T defaultIntpValue=0.5)
bool IsGridGenerated ()
bool IsGridGenerated ()
bool ReGenerateGrids ()
bool ReGenerateGrids ()
VertexFlag const ***const ReturnPtrToVertexFlagData () const
VertexFlag ***const ReturnPtrToVertexFlagData ()
VertexFlag const ***const ReturnPtrToVertexFlagData () const
VertexFlag ***const ReturnPtrToVertexFlagData ()
T const ****const ReturnPtrToVertexInterpolationData () const
T ****const ReturnPtrToVertexInterpolationData ()
T const ****const ReturnPtrToVertexInterpolationData () const
T ****const ReturnPtrToVertexInterpolationData ()
T const ****const ReturnPtrToVertexNormalData () const
T ****const ReturnPtrToVertexNormalData ()
T const ****const ReturnPtrToVertexNormalData () const
T ****const ReturnPtrToVertexNormalData ()
T const ****const ReturnPtrToVertexPositionData () const
T ****const ReturnPtrToVertexPositionData ()
T const ****const ReturnPtrToVertexPositionData () const
T ****const ReturnPtrToVertexPositionData ()
void SetDefaultIntpVal (T val)
void SetDefaultIntpVal (T val)
void SetGridGeneratorToGenerateGridInversely ()
void SetGridGeneratorToGenerateGridInversely ()
void SetGridGeneratorToGenerateGridNormally ()
void SetGridGeneratorToGenerateGridNormally ()
void SetGridGeneratorToUseHardware ()
void SetGridGeneratorToUseHardware ()
void SetGridGeneratorToUseSoftware ()
void SetGridGeneratorToUseSoftware ()
void SetGridGeneratorUseDefaultIntpVal ()
void SetGridGeneratorUseDefaultIntpVal ()
void SetGridGeneratorUseMeshOffsetForIntpVal ()
void SetGridGeneratorUseMeshOffsetForIntpVal ()
void SetModelUseToGenGrid (OpenGL::Model< T > *pModel)
void SetModelUseToGenGrid (OpenGL::Model< T > *pModel)
 ~GridGenerator ()
 ~GridGenerator ()

Private Member Functions

void AllocateGridsForFlag1 ()
void AllocateGridsForFlag1 ()
void AllocateGridsForNormal ()
void AllocateGridsForNormal ()
void AllocateGridsForPosition ()
void AllocateGridsForPosition ()
void AllocateGridsForVertexInterpolation ()
void AllocateGridsForVertexInterpolation ()
void ClearExtraRightOutsidePoints ()
void ClearExtraRightOutsidePoints ()
void DeleteGridsForFlag1 ()
void DeleteGridsForFlag1 ()
void DeleteGridsForNormal ()
void DeleteGridsForNormal ()
void DeleteGridsForPosition ()
void DeleteGridsForPosition ()
void DeleteGridsForVertexInterpolation ()
void DeleteGridsForVertexInterpolation ()
void FindBoundingBoxDimension (Vector3< T > *lowPoint, Vector3< T > *highPoint)
void FindBoundingBoxDimension (Vector3< T > *lowPoint, Vector3< T > *highPoint)
void GenerateGrids ()
void GenerateGrids ()
void GenerateGridsForFlag1 ()
void GenerateGridsForFlag1 ()
void GenerateGridsForNormal ()
void GenerateGridsForNormal ()
void GenerateGridsForPosition ()
void GenerateGridsForPosition ()
void GenerateGridsForVertexInterpolation ()
void GenerateGridsForVertexInterpolation ()
void InverseInsideOutside ()
void InverseInsideOutside ()
void SetAllGridPointsToInsideOutsideModel_HW (OpenGL::HalfEdgeModel< T > *pHEModel)
void SetAllGridPointsToInsideOutsideModel_HW (OpenGL::XPolygonalModel< T > *pXPModel)
void SetAllGridPointsToInsideOutsideModel_HW (OpenGL::PolygonalModel< T > *pPModel)
void SetAllGridPointsToInsideOutsideModel_HW ()
void SetAllGridPointsToInsideOutsideModel_HW (OpenGL::HalfEdgeModel< T > *pHEModel)
void SetAllGridPointsToInsideOutsideModel_HW (OpenGL::XPolygonalModel< T > *pXPModel)
void SetAllGridPointsToInsideOutsideModel_HW (OpenGL::PolygonalModel< T > *pPModel)
void SetAllGridPointsToInsideOutsideModel_HW ()
void SetAllGridPointsToInsideOutsideModel_SW ()
void SetAllGridPointsToInsideOutsideModel_SW ()
void SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::HalfEdgeModel< T > *pHEModel)
void SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::XPolygonalModel< T > *pXPModel)
void SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::PolygonalModel< T > *pPModel)
void SetGridPointsToInsideOutsideModelBoundary_SW ()
void SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::HalfEdgeModel< T > *pHEModel)
void SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::XPolygonalModel< T > *pXPModel)
void SetGridPointsToInsideOutsideModelBoundary_SW (OpenGL::PolygonalModel< T > *pPModel)
void SetGridPointsToInsideOutsideModelBoundary_SW ()
void SetVertexInterpolationData (OpenGL::HalfEdgeModel< T > *pHEModel)
void SetVertexInterpolationData (OpenGL::XPolygonalModel< T > *pXPModel)
void SetVertexInterpolationData (OpenGL::PolygonalModel< T > *pPModel)
void SetVertexInterpolationData ()
void SetVertexInterpolationData (OpenGL::HalfEdgeModel< T > *pHEModel)
void SetVertexInterpolationData (OpenGL::XPolygonalModel< T > *pXPModel)
void SetVertexInterpolationData (OpenGL::PolygonalModel< T > *pPModel)
void SetVertexInterpolationData ()
void SetVertexInterpolationData (T tDefaultVal)

Private Attributes

VertexFlag *** m_abVertexFlag1
m_atGridDimension [3]
T **** m_atVertexInterpolation
T **** m_atVertexNormal
T **** m_atVertexPosition
int m_auiGridSize [3]
bool m_bGenGridInversely
bool m_bUseDefaultIntpVal
bool m_bUseSoftwareToGenGrid
OpenGL::Model< T > * m_pModel
m_tAABBMax [3]
m_tAABBMin [3]
m_tDefaultIntpVal


Detailed Description

template<typename T>
class GridGenerator< T >

Definition at line 56 of file TAPsGridGenerator.hpp.


Member Enumeration Documentation

template<typename T>
enum GridGenerator::VertexFlag

Enumerator:
UNSET 
OUTSIDE_MODEL 
RIGHT_OUTSIDE_BOUNDARY 
ON_BOUNDARY 
RIGHT_INSIDE_BOUNDARY 
INSIDE_MODEL 
DUMMY 
UNSET 
OUTSIDE_MODEL 
RIGHT_OUTSIDE_BOUNDARY 
ON_BOUNDARY 
RIGHT_INSIDE_BOUNDARY 
INSIDE_MODEL 
DUMMY 

Definition at line 156 of file TAPsGridGenerator_BAK.hpp.

00156                            {
00157         UNSET                   = 0,
00158         OUTSIDE_MODEL,
00159         RIGHT_OUTSIDE_BOUNDARY,
00160         ON_BOUNDARY,
00161         RIGHT_INSIDE_BOUNDARY,
00162         INSIDE_MODEL,
00163         DUMMY
00164     };

template<typename T>
enum GridGenerator::VertexFlag

Enumerator:
UNSET 
OUTSIDE_MODEL 
RIGHT_OUTSIDE_BOUNDARY 
ON_BOUNDARY 
RIGHT_INSIDE_BOUNDARY 
INSIDE_MODEL 
DUMMY 
UNSET 
OUTSIDE_MODEL 
RIGHT_OUTSIDE_BOUNDARY 
ON_BOUNDARY 
RIGHT_INSIDE_BOUNDARY 
INSIDE_MODEL 
DUMMY 

Definition at line 167 of file TAPsGridGenerator.hpp.

00167                            {
00168         UNSET                   = 0,
00169         OUTSIDE_MODEL,
00170         RIGHT_OUTSIDE_BOUNDARY,
00171         ON_BOUNDARY,
00172         RIGHT_INSIDE_BOUNDARY,
00173         INSIDE_MODEL,
00174         DUMMY
00175     };


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs GridGenerator< T >::GridGenerator ( OpenGL::Model< T > *  pModel = NULL,
bool  useSoftware = false,
bool  genInversely = false,
bool  useDefaultIntpValue = false,
defaultIntpValue = 0.5 
) [inline]

Create a grid object of the input model.

Definition at line 22 of file TAPsGridGenerator.cpp.

00026     : m_pModel( pModel ), 
00027       m_atVertexPosition( NULL ), 
00028       m_atVertexNormal( NULL ), 
00029       m_abVertexFlag1( NULL ), 
00030       m_atVertexInterpolation( NULL ), 
00031       m_bUseSoftwareToGenGrid( useSoftware ), 
00032       m_bGenGridInversely( genInversely ), 
00033       m_bUseDefaultIntpVal( useDefaultIntpValue ), 
00034       m_tDefaultIntpVal( defaultIntpValue ) 
00035 {
00036     m_atGridDimension[0] = m_atGridDimension[1] = m_atGridDimension[2] = 0;
00037     m_auiGridSize[0] = m_auiGridSize[1] = m_auiGridSize[2] = 0;
00038     //---------------------------------------------------------------
00039 
00040 //=============================================================================
00041 // TAPs in TIPS
00042 #ifdef TAPs_IN_TIPS
00043     //---------------------------------
00044     // Set default 8 corner points
00045     // based on a cube centering at (0,0,0).
00046     T halfSize = 0.5;
00047     m_vBBPts[0].SetXYZ(  halfSize, -halfSize, -halfSize );
00048     m_vBBPts[1].SetXYZ(  halfSize,  halfSize, -halfSize );
00049     m_vBBPts[2].SetXYZ( -halfSize,  halfSize, -halfSize );
00050     m_vBBPts[3].SetXYZ( -halfSize, -halfSize, -halfSize );
00051     m_vBBPts[4].SetXYZ(  halfSize, -halfSize,  halfSize );
00052     m_vBBPts[5].SetXYZ(  halfSize,  halfSize,  halfSize );
00053     m_vBBPts[6].SetXYZ( -halfSize,  halfSize,  halfSize );
00054     m_vBBPts[7].SetXYZ( -halfSize, -halfSize,  halfSize );
00055     //---------------------------------
00056     // Set default grid dimension and size
00057     T size = 8;
00058     m_atGridDimension[0] = m_atGridDimension[1] = m_atGridDimension[2] = (halfSize * 2.0) / (size-1.0);
00059     m_auiGridSize[0] = m_auiGridSize[1] = m_auiGridSize[2] = static_cast<int>( size );
00060 #endif // TAPs_IN_TIPS
00061 //=============================================================================
00062 }

template<typename T>
GridGenerator< T >::~GridGenerator (  )  [inline]

Definition at line 66 of file TAPsGridGenerator.cpp.

00067 {
00068     DeleteGrids();
00069 }

template<typename T>
GridGenerator< T >::GridGenerator ( OpenGL::Model< T > *  pModel = NULL,
bool  useSoftware = false,
bool  genInversely = false,
bool  useDefaultIntpValue = false,
defaultIntpValue = 0.5 
)

template<typename T>
GridGenerator< T >::~GridGenerator (  ) 


Member Function Documentation

template<typename T>
void GridGenerator< T >::AllocateGridsForFlag1 (  )  [private]

template<typename T>
void GridGenerator< T >::AllocateGridsForFlag1 (  )  [inline, private]

Definition at line 704 of file TAPsGridGenerator.cpp.

00705 {
00706     //DeleteGridsForFlag1();
00707     //---------------------------------------------------------------
00708     m_abVertexFlag1 = new VertexFlag **[ m_auiGridSize[0] ];
00709     assert( m_abVertexFlag1 );
00710     for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
00711         m_abVertexFlag1[i] = new VertexFlag *[ m_auiGridSize[1] ];
00712         assert( m_abVertexFlag1[i] );
00713         for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
00714             m_abVertexFlag1[i][j] = new VertexFlag [ m_auiGridSize[2] ];
00715             assert( m_abVertexFlag1[i][j] );
00716             for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
00717                 m_abVertexFlag1[i][j][k] = UNSET;
00718             }
00719         }
00720     }
00721     //---------------------------------------------------------------
00722 }

template<typename T>
void GridGenerator< T >::AllocateGridsForNormal (  )  [private]

template<typename T>
void GridGenerator< T >::AllocateGridsForNormal (  )  [inline, private]

Definition at line 681 of file TAPsGridGenerator.cpp.

00682 {
00683     //DeleteGridsForNormal();
00684     //---------------------------------------------------------------
00685     m_atVertexNormal = new T***[ m_auiGridSize[0] ];
00686     assert( m_atVertexNormal );
00687     for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
00688         m_atVertexNormal[i] = new T**[ m_auiGridSize[1] ];
00689         assert( m_atVertexNormal[i] );
00690         for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
00691             m_atVertexNormal[i][j] = new T*[ m_auiGridSize[2] ];
00692             assert( m_atVertexNormal[i][j] );
00693             for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
00694                 m_atVertexNormal[i][j][k] = new T[ 3 ];
00695                 assert( m_atVertexNormal[i][j][k] );
00696             }
00697         }
00698     }
00699     //---------------------------------------------------------------
00700 }

template<typename T>
void GridGenerator< T >::AllocateGridsForPosition (  )  [private]

template<typename T>
void GridGenerator< T >::AllocateGridsForPosition (  )  [inline, private]

Definition at line 658 of file TAPsGridGenerator.cpp.

00659 {
00660     //DeleteGridsForPosition();
00661     //---------------------------------------------------------------
00662     m_atVertexPosition = new T***[ m_auiGridSize[0] ];
00663     assert( m_atVertexPosition );
00664     for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
00665         m_atVertexPosition[i] = new T**[ m_auiGridSize[1] ];
00666         assert( m_atVertexPosition[i] );
00667         for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
00668             m_atVertexPosition[i][j] = new T*[ m_auiGridSize[2] ];
00669             assert( m_atVertexPosition[i][j] );
00670             for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
00671                 m_atVertexPosition[i][j][k] = new T[ 3 ];
00672                 assert( m_atVertexPosition[i][j][k] );
00673             }
00674         }
00675     }
00676     //---------------------------------------------------------------
00677 }

template<typename T>
void GridGenerator< T >::AllocateGridsForVertexInterpolation (  )  [private]

template<typename T>
void GridGenerator< T >::AllocateGridsForVertexInterpolation (  )  [inline, private]

Definition at line 726 of file TAPsGridGenerator.cpp.

00727 {
00728     //DeleteGridsForVertexInterpolation();
00729     //---------------------------------------------------------------
00730     m_atVertexInterpolation = new T***[ m_auiGridSize[0] ];
00731     assert( m_atVertexInterpolation );
00732     for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
00733         m_atVertexInterpolation[i] = new T**[ m_auiGridSize[1] ];
00734         assert( m_atVertexInterpolation[i] );
00735         for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
00736             m_atVertexInterpolation[i][j] = new T*[ m_auiGridSize[2] ];
00737             assert( m_atVertexInterpolation[i][j] );
00738             for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
00739                 m_atVertexInterpolation[i][j][k] = new T[ 3 ];
00740                 assert( m_atVertexInterpolation[i][j][k] );
00741             }
00742         }
00743     }
00744     //---------------------------------------------------------------
00745 }

template<typename T>
void GridGenerator< T >::ClearExtraRightOutsidePoints (  )  [private]

template<typename T>
void GridGenerator< T >::ClearExtraRightOutsidePoints (  )  [inline, private]

Definition at line 1224 of file TAPsGridGenerator.cpp.

01225 {
01226     bool bNeedChange;
01227     //===============================================================
01228     // All elements not on bounding box's boundary
01229     //---------------------------------------------------------------
01230     for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01231         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01232             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01233                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01234                     bNeedChange = true;
01235                     //-----------------
01236                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01237                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01238                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01239                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01240                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01241                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01242                     //-----------------
01243                     if ( bNeedChange ) {
01244                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01245                     }
01246                 }
01247             }
01248         }
01249     }
01250     //---------------------------------------------------------------
01251     // END INSIDE BOUNDARY
01252     //===============================================================
01253 
01254     //===============================================================
01255     // All elements on the RIGHT boundary of bounding box
01256     //---------------------------------------------------------------
01257     for ( int i = m_auiGridSize[0]-1; i <= m_auiGridSize[0]-1; ++i ) {
01258         //-------------------------------------------------
01259         // Inside the RIGHT boundary
01260         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01261             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01262                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01263                     bNeedChange = true;
01264                     //-----------------
01265                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01266                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01267                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01268                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01269                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01270                     //else if   ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01271                     //-----------------
01272                     if ( bNeedChange ) {
01273                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01274                     }
01275                 }
01276             }
01277         }
01278         //-------------------------------------------------
01279         // Top row of the RIGHT boundary, except cornors
01280         for ( int j = m_auiGridSize[1]-1; j <= m_auiGridSize[1]-1; ++j ) {
01281             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01282                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01283                     bNeedChange = true;
01284                     //-----------------
01285                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01286                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01287                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01288                     //else if   ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01289                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01290                     //else if   ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01291                     //-----------------
01292                     if ( bNeedChange ) {
01293                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01294                     }
01295                 }
01296             }
01297         }
01298         //-------------------------------------------------
01299         // Bottom row of the RIGHT boundary, except cornors
01300         for ( int j = 0; j <= 0; ++j ) {
01301             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01302                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01303                     bNeedChange = true;
01304                     //-----------------
01305                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01306                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01307                     //else if   ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01308                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01309                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01310                     //else if   ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01311                     //-----------------
01312                     if ( bNeedChange ) {
01313                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01314                     }
01315                 }
01316             }
01317         }
01318         //-------------------------------------------------
01319         // Right-most column of the RIGHT boundary, except cornors
01320         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01321             for ( int k = m_auiGridSize[2]-1; k <= m_auiGridSize[2]-1; ++k ) {
01322                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01323                     bNeedChange = true;
01324                     //-----------------
01325                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01326                     //else if   ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01327                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01328                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01329                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01330                     //else if   ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01331                     //-----------------
01332                     if ( bNeedChange ) {
01333                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01334                     }
01335                 }
01336             }
01337         }
01338         //-------------------------------------------------
01339         // Left-most column of the RIGHT boundary, except cornors
01340         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01341             for ( int k = 0; k <= 0; ++k ) {
01342                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01343                     bNeedChange = true;
01344                     //-----------------
01345                     //if        ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01346                     if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01347                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01348                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01349                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01350                     //else if   ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01351                     //-----------------
01352                     if ( bNeedChange ) {
01353                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01354                     }
01355                 }
01356             }
01357         }
01358     }
01359     //---------------------------------------------------------------
01360     // END RIGHT BOUNDARY
01361     //===============================================================
01362 
01363     //===============================================================
01364     // All elements on the LEFT boundary of bounding box
01365     //---------------------------------------------------------------
01366     for ( int i = 0; i <= 0; ++i ) {
01367         //-------------------------------------------------
01368         // Inside the LEFT boundary
01369         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01370             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01371                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01372                     bNeedChange = true;
01373                     //-----------------
01374                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01375                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01376                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01377                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01378                     //else if   ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01379                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01380                     //-----------------
01381                     if ( bNeedChange ) {
01382                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01383                     }
01384                 }
01385             }
01386         }
01387         //-------------------------------------------------
01388         // Top row of the LEFT boundary, except cornors
01389         for ( int j = m_auiGridSize[1]-1; j <= m_auiGridSize[1]-1; ++j ) {
01390             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01391                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01392                     bNeedChange = true;
01393                     //-----------------
01394                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01395                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01396                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01397                     //else if   ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01398                     //else if   ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01399                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01400                     //-----------------
01401                     if ( bNeedChange ) {
01402                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01403                     }
01404                 }
01405             }
01406         }
01407         //-------------------------------------------------
01408         // Bottom row of the LEFT boundary, except cornors
01409         for ( int j = 0; j <= 0; ++j ) {
01410             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01411                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01412                     bNeedChange = true;
01413                     //-----------------
01414                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01415                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01416                     //else if   ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01417                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01418                     //else if   ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01419                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01420                     //-----------------
01421                     if ( bNeedChange ) {
01422                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01423                     }
01424                 }
01425             }
01426         }
01427         //-------------------------------------------------
01428         // Right-most column of the LEFT boundary, except cornors
01429         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01430             for ( int k = m_auiGridSize[2]-1; k <= m_auiGridSize[2]-1; ++k ) {
01431                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01432                     bNeedChange = true;
01433                     //-----------------
01434                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01435                     //else if   ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01436                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01437                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01438                     //else if   ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01439                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01440                     //-----------------
01441                     if ( bNeedChange ) {
01442                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01443                     }
01444                 }
01445             }
01446         }
01447         //-------------------------------------------------
01448         // Left-most column of the LEFT boundary, except cornors
01449         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01450             for ( int k = 0; k <= 0; ++k ) {
01451                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01452                     bNeedChange = true;
01453                     //-----------------
01454                     //if        ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01455                     if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01456                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01457                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01458                     //else if   ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01459                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01460                     //-----------------
01461                     if ( bNeedChange ) {
01462                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01463                     }
01464                 }
01465             }
01466         }
01467     }
01468     //---------------------------------------------------------------
01469     // END LEFT BOUNDARY
01470     //===============================================================
01471 
01472     //===============================================================
01473     // All elements on the TOP boundary of bounding box
01474     //---------------------------------------------------------------
01475     for ( int j = m_auiGridSize[1]-1; j <= m_auiGridSize[1]-1; ++j ) {
01476         //-------------------------------------------------
01477         // Inside the TOP boundary
01478         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01479             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01480                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01481                     bNeedChange = true;
01482                     //-----------------
01483                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01484                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01485                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01486                     //else if   ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01487                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01488                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01489                     //-----------------
01490                     if ( bNeedChange ) {
01491                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01492                     }
01493                 }
01494             }
01495         }
01496         //-------------------------------------------------
01497         // Top row of the TOP boundary, except cornors
01498         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01499             for ( int k = 0; k <= 0; ++k ) {
01500                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01501                     bNeedChange = true;
01502                     //-----------------
01503                     //if        ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01504                     if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01505                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01506                     //else if   ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01507                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01508                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01509                     //-----------------
01510                     if ( bNeedChange ) {
01511                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01512                     }
01513                 }
01514             }
01515         }
01516         //-------------------------------------------------
01517         // Bottom row of the TOP boundary, except cornors
01518         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01519             for ( int k = m_auiGridSize[2]-1; k <= m_auiGridSize[2]-1; ++k ) {
01520                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01521                     bNeedChange = true;
01522                     //-----------------
01523                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01524                     //else if   ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01525                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01526                     //else if   ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01527                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01528                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01529                     //-----------------
01530                     if ( bNeedChange ) {
01531                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01532                     }
01533                 }
01534             }
01535         }
01536     }
01537     //---------------------------------------------------------------
01538     // END TOP BOUNDARY
01539     //===============================================================
01540 
01541     //===============================================================
01542     // All elements on the BOTTOM boundary of bounding box
01543     //---------------------------------------------------------------
01544     for ( int j = 0; j <= 0; ++j ) {
01545         //-------------------------------------------------
01546         // Inside the BOTTOM boundary
01547         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01548             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01549                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01550                     bNeedChange = true;
01551                     //-----------------
01552                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01553                     else if ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01554                     //else if   ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01555                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01556                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01557                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01558                     //-----------------
01559                     if ( bNeedChange ) {
01560                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01561                     }
01562                 }
01563             }
01564         }
01565         //-------------------------------------------------
01566         // Top row of the BOTTOM boundary, except cornors
01567         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01568             for ( int k = 0; k <= 0; ++k ) {
01569                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01570                     bNeedChange = true;
01571                     //-----------------
01572                     //if        ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01573                     if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01574                     //else if   ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01575                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01576                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01577                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01578                     //-----------------
01579                     if ( bNeedChange ) {
01580                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01581                     }
01582                 }
01583             }
01584         }
01585         //-------------------------------------------------
01586         // Bottom row of the BOTTOM boundary, except cornors
01587         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01588             for ( int k = m_auiGridSize[2]-1; k <= m_auiGridSize[2]-1; ++k ) {
01589                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01590                     bNeedChange = true;
01591                     //-----------------
01592                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01593                     //else if   ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01594                     //else if   ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01595                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01596                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01597                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01598                     //-----------------
01599                     if ( bNeedChange ) {
01600                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01601                     }
01602                 }
01603             }
01604         }
01605     }
01606     //---------------------------------------------------------------
01607     // END BOTTOM BOUNDARY
01608     //===============================================================
01609 
01610     //===============================================================
01611     // All elements on the FRONT boundary of bounding box
01612     //---------------------------------------------------------------
01613     for ( int k = m_auiGridSize[2]-1; k <= m_auiGridSize[2]-1; ++k ) {
01614         //-------------------------------------------------
01615         // Inside the FRONT boundary
01616         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01617             for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01618                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01619                     bNeedChange = true;
01620                     //-----------------
01621                     if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01622                     //else if   ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01623                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01624                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01625                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01626                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01627                     //-----------------
01628                     if ( bNeedChange ) {
01629                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01630                     }
01631                 }
01632             }
01633         }
01634     }
01635     //---------------------------------------------------------------
01636     // END FRONT BOUNDARY
01637     //===============================================================
01638 
01639     //===============================================================
01640     // All elements on the BACK boundary of bounding box
01641     //---------------------------------------------------------------
01642     for ( int k = 0; k <= 0; ++k ) {
01643         //-------------------------------------------------
01644         // Inside the BACK boundary
01645         for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01646             for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01647                 if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY ) {
01648                     bNeedChange = true;
01649                     //-----------------
01650                     //if        ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01651                     if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01652                     else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01653                     else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01654                     else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01655                     else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01656                     //-----------------
01657                     if ( bNeedChange ) {
01658                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01659                     }
01660                 }
01661             }
01662         }
01663     }
01664     //---------------------------------------------------------------
01665     // END BACK BOUNDARY
01666     //===============================================================
01667 
01668     //===============================================================
01669     // All of the eight corner points of the boundary of bounding box
01670     //---------------------------------------------------------------
01671     //    ^ j
01672     //    |
01673     //    |
01674     //    O----->i
01675     //   /
01676     //  /
01677     // k
01678     {
01679         //---------------------------------------
01680         int i = 0, j = 0, k = 0;
01681         bNeedChange = true;
01682         //-----------------
01683         if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01684         else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01685         else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01686         //-----------------
01687         if ( bNeedChange ) {
01688             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01689         }
01690         //---------------------------------------
01691         k = m_auiGridSize[2]-1;
01692         bNeedChange = true;
01693         //-----------------
01694         if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01695         else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01696         else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01697         //-----------------
01698         if ( bNeedChange ) {
01699             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01700         }
01701         //---------------------------------------
01702         j = m_auiGridSize[1]-1;
01703         bNeedChange = true;
01704         //-----------------
01705         if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01706         else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01707         else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01708         //-----------------
01709         if ( bNeedChange ) {
01710             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01711         }
01712         //---------------------------------------
01713         k = 0;
01714         bNeedChange = true;
01715         //-----------------
01716         if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01717         else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01718         else if ( m_abVertexFlag1[i+1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01719         //-----------------
01720         if ( bNeedChange ) {
01721             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01722         }
01723         //---------------------------------------
01724         i = m_auiGridSize[0]-1;
01725         j = 0;
01726         bNeedChange = true;
01727         //-----------------
01728         if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01729         else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01730         else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01731         //-----------------
01732         if ( bNeedChange ) {
01733             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01734         }
01735         //---------------------------------------
01736         k = m_auiGridSize[2]-1;
01737         bNeedChange = true;
01738         //-----------------
01739         if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01740         else if ( m_abVertexFlag1[i][j+1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01741         else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01742         //-----------------
01743         if ( bNeedChange ) {
01744             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01745         }
01746         //---------------------------------------
01747         j = m_auiGridSize[1]-1;
01748         bNeedChange = true;
01749         //-----------------
01750         if      ( m_abVertexFlag1[i][j][k-1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01751         else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01752         else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01753         //-----------------
01754         if ( bNeedChange ) {
01755             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01756         }
01757         //---------------------------------------
01758         k = 0;
01759         bNeedChange = true;
01760         //-----------------
01761         if      ( m_abVertexFlag1[i][j][k+1] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01762         else if ( m_abVertexFlag1[i][j-1][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01763         else if ( m_abVertexFlag1[i-1][j][k] > RIGHT_OUTSIDE_BOUNDARY )     bNeedChange = false;
01764         //-----------------
01765         if ( bNeedChange ) {
01766             m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01767         }
01768         //---------------------------------------
01769     }
01770     //---------------------------------------------------------------
01771     // END THE EIGHT CORNERS BOUNDARY
01772     //===============================================================
01773 }

template<typename T>
void GridGenerator< T >::DeleteGrids (  ) 

template<typename T>
void GridGenerator< T >::DeleteGrids (  )  [inline]

Definition at line 2202 of file TAPsGridGenerator.cpp.

template<typename T>
void GridGenerator< T >::DeleteGridsForFlag1 (  )  [private]

template<typename T>
void GridGenerator< T >::DeleteGridsForFlag1 (  )  [inline, private]

Definition at line 2252 of file TAPsGridGenerator.cpp.

02253 {
02254     //---------------------------------------------------------------
02255     if ( m_abVertexFlag1 ) {
02256         for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
02257             for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
02258                 delete [] m_abVertexFlag1[i][j];
02259             }
02260             delete [] m_abVertexFlag1[i];
02261         }
02262         delete m_abVertexFlag1;
02263         m_abVertexFlag1 = NULL;
02264     }
02265 }

template<typename T>
void GridGenerator< T >::DeleteGridsForNormal (  )  [private]

template<typename T>
void GridGenerator< T >::DeleteGridsForNormal (  )  [inline, private]

Definition at line 2232 of file TAPsGridGenerator.cpp.

02233 {
02234     //---------------------------------------------------------------
02235     if ( m_atVertexNormal ) {
02236         for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
02237             for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
02238                 for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
02239                     delete [] m_atVertexNormal[i][j][k];
02240                 }
02241                 delete [] m_atVertexNormal[i][j];
02242             }
02243             delete [] m_atVertexNormal[i];
02244         }
02245         delete m_atVertexNormal;
02246         m_atVertexNormal = NULL;
02247     }
02248 }

template<typename T>
void GridGenerator< T >::DeleteGridsForPosition (  )  [private]

template<typename T>
void GridGenerator< T >::DeleteGridsForPosition (  )  [inline, private]

Definition at line 2212 of file TAPsGridGenerator.cpp.

02213 {
02214     //---------------------------------------------------------------
02215     if ( m_atVertexPosition ) {
02216         for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
02217             for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
02218                 for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
02219                     delete [] m_atVertexPosition[i][j][k];
02220                 }
02221                 delete [] m_atVertexPosition[i][j];
02222             }
02223             delete [] m_atVertexPosition[i];
02224         }
02225         delete m_atVertexPosition;
02226         m_atVertexPosition = NULL;
02227     }
02228 }

template<typename T>
void GridGenerator< T >::DeleteGridsForVertexInterpolation (  )  [private]

template<typename T>
void GridGenerator< T >::DeleteGridsForVertexInterpolation (  )  [inline, private]

Definition at line 2269 of file TAPsGridGenerator.cpp.

02270 {
02271     //---------------------------------------------------------------
02272     if ( m_atVertexInterpolation ) {
02273         for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
02274             for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
02275                 for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
02276                     delete [] m_atVertexInterpolation[i][j][k];
02277                 }
02278                 delete [] m_atVertexInterpolation[i][j];
02279             }
02280             delete [] m_atVertexInterpolation[i];
02281         }
02282         delete m_atVertexInterpolation;
02283         m_atVertexInterpolation = NULL;
02284     }
02285 }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorGenerateGridInversely (  )  const [inline]

Definition at line 111 of file TAPsGridGenerator_BAK.hpp.

00111 { return m_bGenGridInversely; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorGenerateGridInversely (  )  const [inline]

Definition at line 122 of file TAPsGridGenerator.hpp.

00122 { return m_bGenGridInversely; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorGenerateGridNormally (  )  const [inline]

Definition at line 112 of file TAPsGridGenerator_BAK.hpp.

00112 { return !m_bGenGridInversely; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorGenerateGridNormally (  )  const [inline]

Definition at line 123 of file TAPsGridGenerator.hpp.

00123 { return !m_bGenGridInversely; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseDefaultIntpVal (  )  const [inline]

If "use default interpolation value is set", then the grid generator sets each vertex's interpolation value to the default interpolation value.

If "use mesh offset for interpolation value is set", then the grid generator sets interpolation values of each pair of a right outside boundary vertex and a right inside boundary vertex where the offset distance of this pair from the face of the (triangle) mesh that is intersected by the pair of vertices. All other vertices' interpolation values are set to the default interpolation value.

The default interpolation value is 0.5.

The default is "use mesh offset for interpolation value".

Definition at line 132 of file TAPsGridGenerator_BAK.hpp.

00132 { return m_bUseDefaultIntpVal; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseDefaultIntpVal (  )  const [inline]

If "use default interpolation value is set", then the grid generator sets each vertex's interpolation value to the default interpolation value.

If "use mesh offset for interpolation value is set", then the grid generator sets interpolation values of each pair of a right outside boundary vertex and a right inside boundary vertex where the offset distance of this pair from the face of the (triangle) mesh that is intersected by the pair of vertices. All other vertices' interpolation values are set to the default interpolation value.

The default interpolation value is 0.5.

The default is "use mesh offset for interpolation value".

Definition at line 143 of file TAPsGridGenerator.hpp.

00143 { return m_bUseDefaultIntpVal; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseHardware (  )  const [inline]

Definition at line 107 of file TAPsGridGenerator_BAK.hpp.

00107 { return !m_bUseSoftwareToGenGrid; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseHardware (  )  const [inline]

Definition at line 118 of file TAPsGridGenerator.hpp.

00118 { return !m_bUseSoftwareToGenGrid; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseMeshOffsetForIntpVal (  )  const [inline]

Definition at line 133 of file TAPsGridGenerator_BAK.hpp.

00133 { return !m_bUseDefaultIntpVal; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseMeshOffsetForIntpVal (  )  const [inline]

Definition at line 144 of file TAPsGridGenerator.hpp.

00144 { return !m_bUseDefaultIntpVal; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseSoftware (  )  const [inline]

Definition at line 106 of file TAPsGridGenerator_BAK.hpp.

00106 { return m_bUseSoftwareToGenGrid; }

template<typename T>
bool GridGenerator< T >::DoesGridGeneratorUseSoftware (  )  const [inline]

Definition at line 117 of file TAPsGridGenerator.hpp.

00117 { return m_bUseSoftwareToGenGrid; }

template<typename T>
void GridGenerator< T >::DRAW_SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::XPolygonalModel< T > *  pXPModel  ) 

template<typename T>
void GridGenerator< T >::DRAW_SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::XPolygonalModel< T > *  pXPModel  ) 

template<typename T>
void GridGenerator< T >::FindBoundingBoxDimension ( Vector3< T > *  lowPoint,
Vector3< T > *  highPoint 
) [private]

template<typename T>
void GridGenerator< T >::FindBoundingBoxDimension ( Vector3< T > *  lowPoint,
Vector3< T > *  highPoint 
) [inline, private]

Definition at line 342 of file TAPsGridGenerator.cpp.

00345 {
00346     /*
00347     if ( !pModel )  return;
00348     //---------------------------------------------------------------
00349     PolygonalModel<T> *     pPologonalModel 
00350                     = dynamic_cast< PolygonalModel<T> * >( pModel );
00351     XPolygonalModel<T> *    pXPologonalModel 
00352                     = dynamic_cast< XPolygonalModel<T> * >( pModel );
00353     HalfEdgeModel<T> *      pHalfEdgeModel 
00354                     = dynamic_cast< HalfEdgeModel<T> * >( pModel );
00355     //---------------------------------------------------------------
00356     // For PolygonalModel
00357     if ( pPologonalModel ) {
00358     }
00359     //---------------------------------------------------------------
00360     // For XPolygonalModel
00361     if ( pXPologonalModel ) {
00362         
00363     }
00364     //---------------------------------------------------------------
00365     // For HalfEdgeModel
00366     if ( pHalfEdgeModel ) {
00367     }
00368     //*/
00369     if ( lowPoint == NULL || highPoint == NULL ) {
00370         m_pModel->CalBoundingAABB();        // Could be commented out
00371         Vector3<T> lowPoint  = m_pModel->GetBoundingAABBLowPoint();
00372         Vector3<T> highPoint = m_pModel->GetBoundingAABBHighPoint();
00373 
00374         // AABB SCALING ADJUSTER
00375         //-----------------------------------------------------
00376         // This scaling makes the grid box bigger than the AABB of the mesh.
00377         // So that all of the border grid points are outside the mesh.
00378         //*
00379         Vector3<T> scale = (highPoint - lowPoint) * 0.00001;
00380         //Vector3<T> scale = (highPoint - lowPoint) * 0.25;
00381         //Vector3<T> scale = (highPoint - lowPoint) * 1;
00382         lowPoint  -= scale;
00383         highPoint += scale;
00384         //*/
00385         //-----------------------------------------------------
00386         // Set the size of the grid box
00387         m_tAABBMin[0] = lowPoint[0];
00388         m_tAABBMin[1] = lowPoint[1];
00389         m_tAABBMin[2] = lowPoint[2];
00390         m_tAABBMax[0] = highPoint[0];
00391         m_tAABBMax[1] = highPoint[1];
00392         m_tAABBMax[2] = highPoint[2];
00393     }
00394     else {
00395         //-----------------------------------------------------
00396         // Set the size of the grid box
00397         m_tAABBMin[0] = lowPoint->GetX();
00398         m_tAABBMin[1] = lowPoint->GetY();
00399         m_tAABBMin[2] = lowPoint->GetZ();
00400         m_tAABBMax[0] = highPoint->GetX();
00401         m_tAABBMax[1] = highPoint->GetY();
00402         m_tAABBMax[2] = highPoint->GetZ();
00403     }
00404 
00405 //  assert( m_tAABBMax[0] >= m_tAABBMin[0] );
00406 //  assert( m_tAABBMax[1] >= m_tAABBMin[1] );
00407 //  assert( m_tAABBMax[2] >= m_tAABBMin[2] );
00408     //assert( 
00409     //  (   ( m_tAABBMax[0] - m_tAABBMin[0] )
00410     //  +   ( m_tAABBMax[1] - m_tAABBMin[1] )
00411     //  +   ( m_tAABBMax[2] - m_tAABBMin[2] )
00412     //  ) > 0
00413     //);
00414 }

template<typename T>
bool GridGenerator< T >::GenerateDefinedGrids2x2x2 ( unsigned char  config = 1,
int  iNumOfXSlices = 2,
int  iNumOfYSlices = 2,
int  iNumOfZSlices = 2,
Vector3< T > *  lowPoint = NULL,
Vector3< T > *  highPoint = NULL 
) [inline]

Definition at line 247 of file TAPsGridGenerator.cpp.

00252 {
00253     // Flag arrangement (right-handed xyz-coordinates)
00254     //     3---2
00255     //    /|  /|
00256     //   / 0-/-1
00257     //  7---6 /
00258     //  |/  |/
00259     //  4---5
00260     int idx[8][3] = {
00261         { 0,0,0 }, 
00262         { 1,0,0 }, 
00263         { 1,1,0 }, 
00264         { 0,1,0 }, 
00265         { 0,0,1 }, 
00266         { 1,0,1 }, 
00267         { 1,1,1 }, 
00268         { 0,1,1 } 
00269     };
00270 
00271     if ( !m_pModel )    return false;
00272     //---------------------------------------------------------------
00273     DeleteGrids();
00274     //---------------------------------------------------------------
00275     // Set Size
00276     m_auiGridSize[0] = iNumOfXSlices = 2;
00277     m_auiGridSize[1] = iNumOfYSlices = 2;
00278     m_auiGridSize[2] = iNumOfZSlices = 2;
00279     //---------------------------------------------------------------
00280     //*
00281     // Set Dimension
00282     // without adjustment
00283     FindBoundingBoxDimension( lowPoint, highPoint );
00284     m_atGridDimension[0] = ( m_tAABBMax[0] - m_tAABBMin[0] ) / ( m_auiGridSize[0] - 1 );
00285     m_atGridDimension[1] = ( m_tAABBMax[1] - m_tAABBMin[1] ) / ( m_auiGridSize[1] - 1 );
00286     m_atGridDimension[2] = ( m_tAABBMax[2] - m_tAABBMin[2] ) / ( m_auiGridSize[2] - 1 );
00287 
00288     T tMinMaxIdx[8][3] = {
00289         { m_tAABBMin[0], m_tAABBMin[1], m_tAABBMin[2] }, 
00290         { m_tAABBMax[0], m_tAABBMin[1], m_tAABBMin[2] }, 
00291         { m_tAABBMax[0], m_tAABBMax[1], m_tAABBMin[2] }, 
00292         { m_tAABBMin[0], m_tAABBMax[1], m_tAABBMin[2] }, 
00293         { m_tAABBMin[0], m_tAABBMin[1], m_tAABBMax[2] }, 
00294         { m_tAABBMax[0], m_tAABBMin[1], m_tAABBMax[2] }, 
00295         { m_tAABBMax[0], m_tAABBMax[1], m_tAABBMax[2] }, 
00296         { m_tAABBMin[0], m_tAABBMax[1], m_tAABBMax[2] }, 
00297     };
00298     //*/
00299     //---------------------------------------------------------------
00300     //GenerateGrids();
00301     GenerateGridsForPosition();
00302     GenerateGridsForNormal();
00303     GenerateGridsForFlag1();
00304     GenerateGridsForVertexInterpolation();
00305     //---------------------------------------------------------------
00306     char mask = 1;
00307     for ( int i = 0; i < 8; ++i ) {
00308         m_atVertexPosition[idx[i][0]][idx[i][1]][idx[i][2]][0] = tMinMaxIdx[i][0];
00309         m_atVertexPosition[idx[i][0]][idx[i][1]][idx[i][2]][1] = tMinMaxIdx[i][1];
00310         m_atVertexPosition[idx[i][0]][idx[i][1]][idx[i][2]][2] = tMinMaxIdx[i][2];
00311         if ( config & mask ) {
00312             m_abVertexFlag1[idx[i][0]][idx[i][1]][idx[i][2]] = RIGHT_INSIDE_BOUNDARY;
00313         }
00314         else {
00315             m_abVertexFlag1[idx[i][0]][idx[i][1]][idx[i][2]] = RIGHT_OUTSIDE_BOUNDARY;
00316         }
00317         mask = mask<<1;
00318     }
00319     //---------------------------------------------------------------
00320     SetVertexInterpolationData( 0.5 );
00321     //---------------------------------------------------------------
00322 #ifdef TAPs_DEBUG_MODE
00323 #ifdef TAPs_USE_WXWIDGETS
00324     wxLogWarning( wxT( "Grid Generator (GenerateDefinedGrids2x2x2):" ) );
00325     wxLogWarning( wxT( "  w/ size: %i, %i, %i" ), m_auiGridSize[0], m_auiGridSize[1], m_auiGridSize[2] );
00326     wxLogWarning( wxT( "  w/ dim: %g, %g, %g" ), m_atGridDimension[0], m_atGridDimension[1], m_atGridDimension[2] );
00327 #else
00328     //std::cerr << "Error: " << glewGetErrorString( err ) << std::endl;
00329 #endif
00330 #endif
00331     //---------------------------------------------------------------
00332     return true;
00333 }

template<typename T>
void GridGenerator< T >::GenerateGrids (  )  [private]

template<typename T>
void GridGenerator< T >::GenerateGrids (  )  [inline, private]

Definition at line 578 of file TAPsGridGenerator.cpp.

00579 {
00580     GenerateGridsForPosition();
00581     GenerateGridsForNormal();
00582     GenerateGridsForFlag1();
00583     GenerateGridsForVertexInterpolation();
00584     //---------------------------------------------------------------
00585 #ifdef TAPs_GRID_GENERATOR_BY_SOFTWARE
00586     if ( m_bUseSoftwareToGenGrid ) {
00587         SetGridPointsToInsideOutsideModelBoundary_SW();
00588         SetAllGridPointsToInsideOutsideModel_SW();
00589     }
00590 #endif
00591 #ifdef TAPs_GRID_GENERATOR_BY_HARDWARE
00592     if ( !m_bUseSoftwareToGenGrid ) {
00593         SetAllGridPointsToInsideOutsideModel_HW();
00594     }
00595 #endif
00596     //---------------------------------------------------------------
00597     ClearExtraRightOutsidePoints();
00598     if ( m_bGenGridInversely ) {
00599         InverseInsideOutside();
00600         ClearExtraRightOutsidePoints();
00601     }
00602     SetVertexInterpolationData();
00603 }

template<typename T>
void GridGenerator< T >::GenerateGridsForFlag1 (  )  [private]

template<typename T>
void GridGenerator< T >::GenerateGridsForFlag1 (  )  [inline, private]

Definition at line 640 of file TAPsGridGenerator.cpp.

00641 {
00642     //---------------------------------------------------------------
00643     AllocateGridsForFlag1();
00644     //---------------------------------------------------------------
00645 }

template<typename T>
void GridGenerator< T >::GenerateGridsForNormal (  )  [private]

template<typename T>
void GridGenerator< T >::GenerateGridsForNormal (  )  [inline, private]

Definition at line 631 of file TAPsGridGenerator.cpp.

00632 {
00633     //---------------------------------------------------------------
00634     AllocateGridsForNormal();
00635     //---------------------------------------------------------------
00636 }

template<typename T>
void GridGenerator< T >::GenerateGridsForPosition (  )  [private]

template<typename T>
void GridGenerator< T >::GenerateGridsForPosition (  )  [inline, private]

Definition at line 607 of file TAPsGridGenerator.cpp.

00608 {
00609     AllocateGridsForPosition();
00610     //---------------------------------------------------------------
00611     T x = m_tAABBMin[0];// - m_atGridDimension[0];
00612     for ( int i = 0; i < m_auiGridSize[0]; ++i ) {
00613         T y = m_tAABBMin[1];// - m_atGridDimension[1];
00614         for ( int j = 0; j < m_auiGridSize[1]; ++j ) {
00615             T z = m_tAABBMin[2];// - m_atGridDimension[2];
00616             for ( int k = 0; k < m_auiGridSize[2]; ++k ) {
00617                 m_atVertexPosition[i][j][k][0] = x;
00618                 m_atVertexPosition[i][j][k][1] = y;
00619                 m_atVertexPosition[i][j][k][2] = z;
00620                 z += m_atGridDimension[2];
00621             }
00622             y += m_atGridDimension[1];
00623         }
00624         x += m_atGridDimension[0];
00625     }
00626     //---------------------------------------------------------------
00627 }

template<typename T>
void GridGenerator< T >::GenerateGridsForVertexInterpolation (  )  [private]

template<typename T>
void GridGenerator< T >::GenerateGridsForVertexInterpolation (  )  [inline, private]

Definition at line 649 of file TAPsGridGenerator.cpp.

00650 {
00651     //---------------------------------------------------------------
00652     AllocateGridsForVertexInterpolation();
00653     //---------------------------------------------------------------
00654 }

template<typename T>
bool GridGenerator< T >::GenerateGridsWithDimension ( iGridWidth,
iGridHeight,
iGridDepth,
Vector3< T > *  lowPoint = NULL,
Vector3< T > *  highPoint = NULL 
)

template<typename T>
bool GridGenerator< T >::GenerateGridsWithDimension ( iGridWidth,
iGridHeight,
iGridDepth,
Vector3< T > *  lowPoint = NULL,
Vector3< T > *  highPoint = NULL 
) [inline]

Definition at line 114 of file TAPsGridGenerator.cpp.

00118 {
00119     if ( !m_pModel )    return false;
00120     //---------------------------------------------------------------
00121     //if (  iGridWidth  == m_atGridDimension[0]
00122     //  &&  iGridHeight == m_atGridDimension[1]
00123     //  &&  iGridDepth  == m_atGridDimension[2] )
00124     //{
00125     //  return false;
00126     //}
00127     //---------------------------------------------------------------
00128     DeleteGrids();
00129     //---------------------------------------------------------------
00130     // Set Dimension
00131     m_atGridDimension[0] = iGridWidth;
00132     m_atGridDimension[1] = iGridHeight;
00133     m_atGridDimension[2] = iGridDepth;
00134     //---------------------------------------------------------------
00135     // Set Size
00136     FindBoundingBoxDimension( lowPoint, highPoint );
00137     T xSize = ( m_tAABBMax[0] - m_tAABBMin[0] ) / m_atGridDimension[0];
00138     T ySize = ( m_tAABBMax[1] - m_tAABBMin[1] ) / m_atGridDimension[1];
00139     T zSize = ( m_tAABBMax[2] - m_tAABBMin[2] ) / m_atGridDimension[2];
00140     m_auiGridSize[0] = floor( xSize );
00141     m_auiGridSize[1] = floor( ySize );
00142     m_auiGridSize[2] = floor( zSize );
00143     if( xSize - m_auiGridSize[0] >= 0.5 )   ++m_auiGridSize[0];
00144     if( ySize - m_auiGridSize[1] >= 0.5 )   ++m_auiGridSize[1];
00145     if( zSize - m_auiGridSize[2] >= 0.5 )   ++m_auiGridSize[2];
00146     ++m_auiGridSize[0];
00147     ++m_auiGridSize[1];
00148     ++m_auiGridSize[2];
00149 
00150     // DEBUG
00151     //wxLogWarning( wxT( "  w/ left over: %g, %g, %g" ), 
00152     //  xSize - m_atGridDimension[0], 
00153     //  ySize - m_atGridDimension[1], 
00154     //  zSize - m_atGridDimension[2] );
00155     //---------------------------------------------------------------
00156     GenerateGrids();
00157     //---------------------------------------------------------------
00158 #ifdef TAPs_DEBUG_MODE
00159 #ifdef TAPs_USE_WXWIDGETS
00160     wxLogWarning( wxT( "Grid Generator:" ) );
00161     wxLogWarning( wxT( "  w/ size: %i, %i, %i" ), m_auiGridSize[0], m_auiGridSize[1], m_auiGridSize[2] );
00162     wxLogWarning( wxT( "  w/ dim: %g, %g, %g" ), m_atGridDimension[0], m_atGridDimension[1], m_atGridDimension[2] );
00163 #else
00164     //std::cerr << "Error: " << glewGetErrorString( err ) << std::endl;
00165 #endif
00166 #endif
00167     //---------------------------------------------------------------
00168     return true;
00169 }

template<typename T>
bool GridGenerator< T >::GenerateGridsWithSize ( int  iNumOfXSlices,
int  iNumOfYSlices,
int  iNumOfZSlices,
Vector3< T > *  lowPoint = NULL,
Vector3< T > *  highPoint = NULL 
)

template<typename T>
bool GridGenerator< T >::GenerateGridsWithSize ( int  iNumOfXSlices,
int  iNumOfYSlices,
int  iNumOfZSlices,
Vector3< T > *  lowPoint = NULL,
Vector3< T > *  highPoint = NULL 
) [inline]

Definition at line 173 of file TAPsGridGenerator.cpp.

00177 {
00178     if ( !m_pModel )    return false;
00179     //---------------------------------------------------------------
00180     //if (  iNumOfXSlices == m_auiGridSize[0]
00181     //  &&  iNumOfYSlices == m_auiGridSize[1]
00182     //  &&  iNumOfZSlices == m_auiGridSize[2] )
00183     //{
00184     //  return false;
00185     //}
00186     //---------------------------------------------------------------
00187     DeleteGrids();
00188     //---------------------------------------------------------------
00189     // Set Size
00190     m_auiGridSize[0] = iNumOfXSlices;
00191     m_auiGridSize[1] = iNumOfYSlices;
00192     m_auiGridSize[2] = iNumOfZSlices;
00193     //---------------------------------------------------------------
00194     //*
00195     // Set Dimension
00196     // without adjustment
00197     FindBoundingBoxDimension( lowPoint, highPoint );
00198     m_atGridDimension[0] = ( m_tAABBMax[0] - m_tAABBMin[0] ) / ( m_auiGridSize[0] - 1 );
00199     m_atGridDimension[1] = ( m_tAABBMax[1] - m_tAABBMin[1] ) / ( m_auiGridSize[1] - 1 );
00200     m_atGridDimension[2] = ( m_tAABBMax[2] - m_tAABBMin[2] ) / ( m_auiGridSize[2] - 1 );
00201     //*/
00202     //---------------------------------------------------------------
00203     /*
00204     //===============================================================
00205     // Set Dimension
00206     // with adjustment for expaning the AABB box 
00207     // so that all of the boundary elements are outside of the mesh
00208     //---------------------------------------------------------------
00209     FindBoundingBoxDimension( lowPoint, highPoint );
00210     m_atGridDimension[0] = ( m_tAABBMax[0] - m_tAABBMin[0] ) / ( m_auiGridSize[0] - 3 );
00211     m_atGridDimension[1] = ( m_tAABBMax[1] - m_tAABBMin[1] ) / ( m_auiGridSize[1] - 3 );
00212     m_atGridDimension[2] = ( m_tAABBMax[2] - m_tAABBMin[2] ) / ( m_auiGridSize[2] - 3 );
00213     //-------------------------------------------
00214     // Adjust Mins and Maxs of AABB
00215     m_tAABBMin[0] -= m_atGridDimension[0];
00216     m_tAABBMin[1] -= m_atGridDimension[1];
00217     m_tAABBMin[2] -= m_atGridDimension[2];
00218     m_tAABBMax[0] += m_atGridDimension[0];
00219     m_tAABBMax[1] += m_atGridDimension[1];
00220     m_tAABBMax[2] += m_atGridDimension[2];
00221     //---------------------------------------------------------------
00222     //===============================================================
00223     //*/
00224     //---------------------------------------------------------------
00225     GenerateGrids();
00226     //---------------------------------------------------------------
00227 #ifdef TAPs_DEBUG_MODE
00228 #ifdef TAPs_USE_WXWIDGETS
00229     wxLogWarning( wxT( "Grid Generator:" ) );
00230     wxLogWarning( wxT( "  w/ size: %i, %i, %i" ), m_auiGridSize[0], m_auiGridSize[1], m_auiGridSize[2] );
00231     wxLogWarning( wxT( "  w/ dim: %g, %g, %g" ), m_atGridDimension[0], m_atGridDimension[1], m_atGridDimension[2] );
00232 #else
00233     //std::cerr << "Error: " << glewGetErrorString( err ) << std::endl;
00234 #endif
00235 #endif
00236     //---------------------------------------------------------------
00237     return true;
00238 }

template<typename T>
Vector3<T> GridGenerator< T >::GetAABBMaxPt (  )  const [inline]

Definition at line 93 of file TAPsGridGenerator_BAK.hpp.

00093 { return Vector3<T>( m_tAABBMax ); }

template<typename T>
Vector3<T> GridGenerator< T >::GetAABBMaxPt (  )  const [inline]

Definition at line 104 of file TAPsGridGenerator.hpp.

00104 { return Vector3<T>( m_tAABBMax ); }

template<typename T>
Vector3<T> GridGenerator< T >::GetAABBMinPt (  )  const [inline]

Definition at line 92 of file TAPsGridGenerator_BAK.hpp.

00092 { return Vector3<T>( m_tAABBMin ); }

template<typename T>
Vector3<T> GridGenerator< T >::GetAABBMinPt (  )  const [inline]

Definition at line 103 of file TAPsGridGenerator.hpp.

00103 { return Vector3<T>( m_tAABBMin ); }

template<typename T>
void GridGenerator< T >::GetDefaultIntpVal (  )  const [inline]

Definition at line 136 of file TAPsGridGenerator_BAK.hpp.

00136 { return m_tDefaultIntpVal; }

template<typename T>
void GridGenerator< T >::GetDefaultIntpVal (  )  const [inline]

Definition at line 147 of file TAPsGridGenerator.hpp.

00147 { return m_tDefaultIntpVal; }

template<typename T>
T GridGenerator< T >::GetGridDimensionX (  )  const [inline]

Definition at line 86 of file TAPsGridGenerator_BAK.hpp.

00086 { return m_atGridDimension[0]; }

template<typename T>
T GridGenerator< T >::GetGridDimensionX (  )  const [inline]

Definition at line 97 of file TAPsGridGenerator.hpp.

00097 { return m_atGridDimension[0]; }

template<typename T>
T GridGenerator< T >::GetGridDimensionY (  )  const [inline]

Definition at line 87 of file TAPsGridGenerator_BAK.hpp.

00087 { return m_atGridDimension[1]; }

template<typename T>
T GridGenerator< T >::GetGridDimensionY (  )  const [inline]

Definition at line 98 of file TAPsGridGenerator.hpp.

00098 { return m_atGridDimension[1]; }

template<typename T>
T GridGenerator< T >::GetGridDimensionZ (  )  const [inline]

Definition at line 88 of file TAPsGridGenerator_BAK.hpp.

00088 { return m_atGridDimension[2]; }

template<typename T>
T GridGenerator< T >::GetGridDimensionZ (  )  const [inline]

Definition at line 99 of file TAPsGridGenerator.hpp.

00099 { return m_atGridDimension[2]; }

template<typename T>
int GridGenerator< T >::GetGridSizeX (  )  const [inline]

Definition at line 89 of file TAPsGridGenerator_BAK.hpp.

00089 { return m_auiGridSize[0]; }

template<typename T>
int GridGenerator< T >::GetGridSizeX (  )  const [inline]

Definition at line 100 of file TAPsGridGenerator.hpp.

00100 { return m_auiGridSize[0]; }

template<typename T>
int GridGenerator< T >::GetGridSizeY (  )  const [inline]

Definition at line 90 of file TAPsGridGenerator_BAK.hpp.

00090 { return m_auiGridSize[1]; }

template<typename T>
int GridGenerator< T >::GetGridSizeY (  )  const [inline]

Definition at line 101 of file TAPsGridGenerator.hpp.

00101 { return m_auiGridSize[1]; }

template<typename T>
int GridGenerator< T >::GetGridSizeZ (  )  const [inline]

Definition at line 91 of file TAPsGridGenerator_BAK.hpp.

00091 { return m_auiGridSize[2]; }

template<typename T>
int GridGenerator< T >::GetGridSizeZ (  )  const [inline]

Definition at line 102 of file TAPsGridGenerator.hpp.

00102 { return m_auiGridSize[2]; }

template<typename T>
OpenGL::Model<T>* GridGenerator< T >::GetModelUseToGenGrid (  )  const [inline]

Definition at line 142 of file TAPsGridGenerator_BAK.hpp.

00142 { return m_pModel; }

template<typename T>
OpenGL::Model<T>* GridGenerator< T >::GetModelUseToGenGrid (  )  const [inline]

Definition at line 153 of file TAPsGridGenerator.hpp.

00153 { return m_pModel; }

template<typename T>
void GridGenerator< T >::InverseInsideOutside (  )  [private]

template<typename T>
void GridGenerator< T >::InverseInsideOutside (  )  [inline, private]

Definition at line 1782 of file TAPsGridGenerator.cpp.

01783 {
01784     //===============================================================
01785     // All elements not on bounding box's boundary
01786     //---------------------------------------------------------------
01787     for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
01788         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
01789             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
01790                 if      ( m_abVertexFlag1[i][j][k] == UNSET )                   m_abVertexFlag1[i][j][k] = INSIDE_MODEL;
01791                 else if ( m_abVertexFlag1[i][j][k] == OUTSIDE_MODEL )           m_abVertexFlag1[i][j][k] = INSIDE_MODEL;
01792                 //else if   ( m_abVertexFlag1[i][j][k] == ON_BOUNDARY )         m_abVertexFlag1[i][j][k] = ON_BOUNDARY;
01793                 else if ( m_abVertexFlag1[i][j][k] == RIGHT_OUTSIDE_BOUNDARY )  m_abVertexFlag1[i][j][k] = RIGHT_INSIDE_BOUNDARY;
01794                 else if ( m_abVertexFlag1[i][j][k] == RIGHT_INSIDE_BOUNDARY )   m_abVertexFlag1[i][j][k] = RIGHT_OUTSIDE_BOUNDARY;
01795                 else if ( m_abVertexFlag1[i][j][k] == INSIDE_MODEL )            m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
01796             }
01797         }
01798     }
01799 }

template<typename T>
bool GridGenerator< T >::IsGridGenerated (  )  [inline]

Definition at line 153 of file TAPsGridGenerator_BAK.hpp.

00153 { return m_atVertexPosition != NULL; }

template<typename T>
bool GridGenerator< T >::IsGridGenerated (  )  [inline]

Definition at line 164 of file TAPsGridGenerator.hpp.

00164 { return m_atVertexPosition != NULL; }

template<typename T>
bool GridGenerator< T >::ReGenerateGrids (  ) 

template<typename T>
bool GridGenerator< T >::ReGenerateGrids (  )  [inline]

Definition at line 73 of file TAPsGridGenerator.cpp.

00074 {
00075     if ( !m_pModel )                    return false;
00076     if ( m_atGridDimension[0] == 0 )    return false;
00077     if ( !IsGridGenerated() )           return false;
00078     //---------------------------------------------------------------
00079     // Generate Grids
00080 #ifdef TAPs_GRID_GENERATOR_BY_SOFTWARE
00081     if ( m_bUseSoftwareToGenGrid ) {
00082         SetGridPointsToInsideOutsideModelBoundary_SW();
00083         SetAllGridPointsToInsideOutsideModel_SW();
00084     }
00085 #endif
00086 #ifdef TAPs_GRID_GENERATOR_BY_HARDWARE
00087     if ( !m_bUseSoftwareToGenGrid ) {
00088         SetAllGridPointsToInsideOutsideModel_HW();
00089     }
00090 #endif
00091     //---------------------------------------------------------------
00092     ClearExtraRightOutsidePoints();
00093     if ( m_bGenGridInversely ) {
00094         InverseInsideOutside();
00095         ClearExtraRightOutsidePoints();
00096     }
00097     SetVertexInterpolationData( 0.5 );
00098     //---------------------------------------------------------------
00099 #ifdef TAPs_DEBUG_MODE
00100 #ifdef TAPs_USE_WXWIDGETS
00101     wxLogWarning( wxT( "Regenerated Grids:" ) );
00102     wxLogWarning( wxT( "  w/ size: %i, %i, %i" ), m_auiGridSize[0], m_auiGridSize[1], m_auiGridSize[2] );
00103     wxLogWarning( wxT( "  w/ dim: %g, %g, %g" ), m_atGridDimension[0], m_atGridDimension[1], m_atGridDimension[2] );
00104 #else
00105     //std::cerr << "Error: " << glewGetErrorString( err ) << std::endl;
00106 #endif
00107 #endif
00108     //---------------------------------------------------------------
00109     return true;
00110 }

template<typename T>
VertexFlag const*** const GridGenerator< T >::ReturnPtrToVertexFlagData (  )  const [inline]

Definition at line 181 of file TAPsGridGenerator_BAK.hpp.

00181 { return m_abVertexFlag1; }

template<typename T>
VertexFlag*** const GridGenerator< T >::ReturnPtrToVertexFlagData (  )  [inline]

Return a const pointer to the grid flag data (enum in 3D array).

Definition at line 180 of file TAPsGridGenerator_BAK.hpp.

00180 { return m_abVertexFlag1; }

template<typename T>
VertexFlag const*** const GridGenerator< T >::ReturnPtrToVertexFlagData (  )  const [inline]

Definition at line 192 of file TAPsGridGenerator.hpp.

00192 { return m_abVertexFlag1; }

template<typename T>
VertexFlag*** const GridGenerator< T >::ReturnPtrToVertexFlagData (  )  [inline]

Return a const pointer to the grid flag data (enum in 3D array).

Definition at line 191 of file TAPsGridGenerator.hpp.

00191 { return m_abVertexFlag1; }

template<typename T>
T const**** const GridGenerator< T >::ReturnPtrToVertexInterpolationData (  )  const [inline]

Definition at line 186 of file TAPsGridGenerator_BAK.hpp.

00186 { return m_atVertexInterpolation; }

template<typename T>
T**** const GridGenerator< T >::ReturnPtrToVertexInterpolationData (  )  [inline]

Return a const pointer to the grid (vertex) interpolation data (xyz in 4D array).

Definition at line 185 of file TAPsGridGenerator_BAK.hpp.

00185 { return m_atVertexInterpolation; }

template<typename T>
T const**** const GridGenerator< T >::ReturnPtrToVertexInterpolationData (  )  const [inline]

Definition at line 197 of file TAPsGridGenerator.hpp.

00197 { return m_atVertexInterpolation; }

template<typename T>
T**** const GridGenerator< T >::ReturnPtrToVertexInterpolationData (  )  [inline]

Return a const pointer to the grid (vertex) interpolation data (xyz in 4D array).

Definition at line 196 of file TAPsGridGenerator.hpp.

00196 { return m_atVertexInterpolation; }

template<typename T>
T const**** const GridGenerator< T >::ReturnPtrToVertexNormalData (  )  const [inline]

Definition at line 176 of file TAPsGridGenerator_BAK.hpp.

00176 { return m_atVertexNormal; }

template<typename T>
T**** const GridGenerator< T >::ReturnPtrToVertexNormalData (  )  [inline]

Return a const pointer to the grid vertex normal (xyz in 4D array).

Definition at line 175 of file TAPsGridGenerator_BAK.hpp.

00175 { return m_atVertexNormal; }

template<typename T>
T const**** const GridGenerator< T >::ReturnPtrToVertexNormalData (  )  const [inline]

Definition at line 187 of file TAPsGridGenerator.hpp.

00187 { return m_atVertexNormal; }

template<typename T>
T**** const GridGenerator< T >::ReturnPtrToVertexNormalData (  )  [inline]

Return a const pointer to the grid vertex normal (xyz in 4D array).

Definition at line 186 of file TAPsGridGenerator.hpp.

00186 { return m_atVertexNormal; }

template<typename T>
T const**** const GridGenerator< T >::ReturnPtrToVertexPositionData (  )  const [inline]

Definition at line 171 of file TAPsGridGenerator_BAK.hpp.

00171 { return m_atVertexPosition; }

template<typename T>
T**** const GridGenerator< T >::ReturnPtrToVertexPositionData (  )  [inline]

Return a const pointer to the grid vertex position (xyz in 4D array).

Definition at line 170 of file TAPsGridGenerator_BAK.hpp.

00170 { return m_atVertexPosition; }

template<typename T>
T const**** const GridGenerator< T >::ReturnPtrToVertexPositionData (  )  const [inline]

Definition at line 182 of file TAPsGridGenerator.hpp.

00182 { return m_atVertexPosition; }

template<typename T>
T**** const GridGenerator< T >::ReturnPtrToVertexPositionData (  )  [inline]

Return a const pointer to the grid vertex position (xyz in 4D array).

Definition at line 181 of file TAPsGridGenerator.hpp.

00181 { return m_atVertexPosition; }

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW ( OpenGL::HalfEdgeModel< T > *  pHEModel  )  [private]

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW ( OpenGL::XPolygonalModel< T > *  pXPModel  )  [private]

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW ( OpenGL::PolygonalModel< T > *  pPModel  )  [private]

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW (  )  [private]

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW ( OpenGL::HalfEdgeModel< T > *  pHEModel  )  [inline, private]

Definition at line 1209 of file TAPsGridGenerator.cpp.

01211 {
01212     assert( false );
01213     // Find two vertices; (-x,0,0) and (x,0,0)
01214     // and faces that contain them
01215 }

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW ( OpenGL::XPolygonalModel< T > *  pXPModel  )  [inline, private]

Definition at line 1019 of file TAPsGridGenerator.cpp.

01021 {
01022     //---------------------------------------------------------------
01023     XVertex<T> * vertex = pXPModel->GetVertexList();
01024     Face<T> * face = pXPModel->GetFaceList();
01025     int NumFaces = pXPModel->GetNoFaces();
01026     //---------------------------------------------------------------
01027     // Check draw framebuffer size
01028     GLint bitSize[4];
01029     glGetIntegerv( GL_RED_BITS,   &bitSize[0] );
01030     glGetIntegerv( GL_GREEN_BITS, &bitSize[1] );
01031     glGetIntegerv( GL_BLUE_BITS,  &bitSize[2] );
01032     glGetIntegerv( GL_ALPHA_BITS, &bitSize[3] );
01033     //std::cout << "GL_RED_BITS:   " << bitSize[0] << "\n";
01034     //std::cout << "GL_GREEN_BITS: " << bitSize[1] << "\n";
01035     //std::cout << "GL_BLUE_BITS:  " << bitSize[2] << "\n";
01036     //std::cout << "GL_ALPHA_BITS: " << bitSize[3] << "\n";
01037     GLenum pixelFormat;
01038     GLfloat * drawData;
01039     GLint pixelSize;
01040     if ( bitSize[3] == 0 ) {    // No alpha channel
01041         pixelFormat = GL_RGB;
01042         pixelSize = 3;
01043     }
01044     else {
01045         pixelFormat = GL_RGBA;
01046         pixelSize = 4;
01047     }
01048     GLint startX = 0;
01049     GLint startY = 0;
01050     GLint width  = m_auiGridSize[0];
01051     GLint height = m_auiGridSize[1];
01052     GLenum dataType  = GL_FLOAT;
01053     drawData = new GLfloat[ width * height * pixelSize ];
01054     assert( drawData );
01055 
01056     // DEBUG
01057     //for ( int i = 0; i < width * height * pixelSize; ++i ) {
01058     //  drawData[i] = 1;
01059     //}
01060 
01061     // For each (Z) slice, create a clipping plane with the same 
01062     // position and orientation as the slice.
01063     glPushAttrib( GL_ALL_ATTRIB_BITS );
01064     glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
01065     GLdouble zPlane[4] = { 0.0, 0.0, -1.0, m_tAABBMin[2] };
01066     //-------------------------------------------
01067     // Set drawing area
01068     glMatrixMode( GL_PROJECTION );
01069     glPushMatrix();
01070     glLoadIdentity();
01071     //-------------------------------------------
01073     // Since the sampling position is at the center of the pixel
01074     //
01075     // +--------------------------+
01076     // | 0 | 1 | 2 | 3 | .... |n-1|
01077     // | 0 | 1 | 2 | 3 | .... |n-1|
01078     // | ........................ |
01079     // | ........................ |
01080     // | ........................ |
01081     // | 0 | 1 | 2 | 3 | .... |n-1|
01082     // +--------------------------+
01083     // ^ ^ ^   ^                ^ ^
01084     // | | |   |                | |
01085     // | | --h--                | |
01086     // | ---min & Max of model--- |
01087     // ---min & Max of ortho view--
01088     // h = ((Max - min) of model) / (n-1)
01089     // min of ortho view = min of model - h/2
01090     // Max of ortho view = Max of model + h/2
01092     T h_half[3];
01093     T orthoMin[3], orthoMax[3];
01094     for ( int i = 0; i < 3; ++i ) {
01095         int steps = m_auiGridSize[i] - 1;
01096         if ( steps >= 0 ) {
01097             h_half[i] = ( m_tAABBMax[i] - m_tAABBMin[i] ) / static_cast<T>(steps) / 2.0;
01098         }
01099         else {
01100             h_half[i] = 0;
01101         }
01102         orthoMin[i] = m_tAABBMin[i] - h_half[i];
01103         orthoMax[i] = m_tAABBMax[i] + h_half[i];
01104     }
01106     //glOrtho( m_tAABBMin[0], m_tAABBMax[0], 
01107     //       m_tAABBMin[1], m_tAABBMax[1], 
01108     //       m_tAABBMin[2]-100, m_tAABBMax[2]+100 );
01110     //glOrtho( 
01111     //  orthoMin[0], orthoMax[0], 
01112     //  orthoMin[1], orthoMax[1], 
01113     //  orthoMin[2]-100, orthoMax[2]+100 
01114     //);
01116     T orthoAdjustZ = ( orthoMax[2] - orthoMin[2] );
01117     glOrtho( 
01118         orthoMin[0], orthoMax[0], 
01119         orthoMin[1], orthoMax[1], 
01120         orthoMin[2] - orthoAdjustZ, orthoMax[2] + orthoAdjustZ 
01121     );
01122     TAPs::OpenGL::Fn::CHECK_GL_ERROR();
01124     glMatrixMode( GL_MODELVIEW );
01125     glPushMatrix();
01126     glLoadIdentity();
01127     TAPs::OpenGL::Fn::CHECK_GL_ERROR();
01128     //-------------------------------------------
01129     glViewport( 0, 0, width, height );
01130     TAPs::OpenGL::Fn::CHECK_GL_ERROR();
01131     //glDisable( GL_TEXTURE_1D );
01132     //glDisable( GL_TEXTURE_2D );
01133     //glDisable( GL_TEXTURE_3D );
01134     //glDisable( GL_BLEND );
01135     glDisable( GL_LIGHTING );
01136     glDisable( GL_DEPTH_TEST );
01137     glDrawBuffer( GL_BACK );
01138     glReadBuffer( GL_BACK );
01139     //-------------------------------------------
01140     for ( int z = 0; z < m_auiGridSize[2]; ++z )
01141     {
01142         //---------------------------------------
01143         // Setup clipping plane for the slice
01144         glClipPlane( GL_CLIP_PLANE0, zPlane );
01145         glEnable( GL_CLIP_PLANE0 );
01146         //---------------------------------------
01147         // Clear the slice with a background color
01148         glClearColor( 0.0, 0.0, 0.0, 0.0 );
01149         glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
01150         //---------------------------------------
01151         // Render the back faces of the model in the foreground color
01152         glColor3f( 1.0, 0.0, 0.0 );
01153         glCullFace( GL_FRONT );
01154         glEnable( GL_CULL_FACE );
01155         for ( int i = 0; i < NumFaces; ++i ) {
01156             glBegin( GL_POLYGON );
01157             for ( int n = 0; n < face[i].GetNoVertices(); ++n ) {
01158                 Vector3<T> vPos = vertex[ face[i].GetVertexNo(n) ].GetPosition();
01159                 glVertex3d( vPos[0], vPos[1], vPos[2] );
01160             }
01161             glEnd();
01162         }
01163         //---------------------------------------
01164         // Render the back faces of the model in the background color
01165         glColor3f( 0.0, 0.0, 0.0 );
01166         glCullFace( GL_BACK );
01167         glEnable( GL_CULL_FACE );
01168         for ( int i = 0; i < NumFaces; ++i ) {
01169             glBegin( GL_POLYGON );
01170             for ( int n = 0; n < face[i].GetNoVertices(); ++n ) {
01171                 Vector3<T> vPos = vertex[ face[i].GetVertexNo(n) ].GetPosition();
01172                 glVertex3d( vPos[0], vPos[1], vPos[2] );
01173             }
01174             glEnd();
01175         }
01176         //---------------------------------------
01177         glDisable( GL_CLIP_PLANE0 );
01178         //---------------------------------------
01179         // Copy the data to m_abVertexFlag1
01180         glReadPixels( startX, startY, width, height, pixelFormat, dataType, drawData );
01181         int idx = 0;
01182         for ( int h = 0; h < height; ++h ) {
01183             for ( int w = 0; w < width; ++w ) {
01184                 if ( drawData[idx] > 0.01 ) {
01185                     m_abVertexFlag1[w][h][z] = RIGHT_INSIDE_BOUNDARY;
01186                 }
01187                 else {
01188                     m_abVertexFlag1[w][h][z] = RIGHT_OUTSIDE_BOUNDARY;
01189                 }
01190                 idx += pixelSize;
01191             }
01192         }
01193         //-----------------------------
01194         // Update the clip plane equation
01195         zPlane[3] += m_atGridDimension[2];
01196     } // end of for loop
01197     glPopMatrix();
01198     glMatrixMode( GL_PROJECTION );
01199     glPopMatrix();
01200     glMatrixMode( GL_MODELVIEW );
01201     glPopAttrib();
01202     delete [] drawData;
01203     //---------------------------------------------------------------
01204 }

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW ( OpenGL::PolygonalModel< T > *  pPModel  )  [inline, private]

Definition at line 1008 of file TAPsGridGenerator.cpp.

01010 {
01011     Vertex<T> * vertexList = pPModel->GetVertexList();
01012     assert( false );
01013     // Find two vertices; (-x,0,0) and (x,0,0)
01014     // and faces that contain them
01015 }

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_HW (  )  [inline, private]

Definition at line 977 of file TAPsGridGenerator.cpp.

00978 {
00979     if ( !m_pModel )    return;
00980     //---------------------------------------------------------------
00981     OpenGL::PolygonalModel<T> *     pPologonalModel 
00982             = dynamic_cast< OpenGL::PolygonalModel<T> * >( m_pModel );
00983     OpenGL::XPolygonalModel<T> *    pXPologonalModel 
00984             = dynamic_cast< OpenGL::XPolygonalModel<T> * >( m_pModel );
00985     OpenGL::HalfEdgeModel<T> *      pHalfEdgeModel 
00986             = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( m_pModel );
00987     //---------------------------------------------------------------
00988     // For PolygonalModel
00989     if ( pPologonalModel ) {
00990         SetAllGridPointsToInsideOutsideModel_HW( pPologonalModel );
00991     }
00992     //---------------------------------------------------------------
00993     // For XPolygonalModel
00994     if ( pXPologonalModel ) {
00995         SetAllGridPointsToInsideOutsideModel_HW( pXPologonalModel );
00996     }
00997     //---------------------------------------------------------------
00998     // For HalfEdgeModel
00999     if ( pHalfEdgeModel ) {
01000         SetAllGridPointsToInsideOutsideModel_HW( pHalfEdgeModel );
01001     }
01002     //---------------------------------------------------------------
01003 }

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_SW (  )  [private]

template<typename T>
void GridGenerator< T >::SetAllGridPointsToInsideOutsideModel_SW (  )  [inline, private]

Definition at line 934 of file TAPsGridGenerator.cpp.

00935 {
00936     //*
00937     int val = 0;
00938     for ( int i = 1; i < m_auiGridSize[0]-1; ++i ) {
00939         for ( int j = 1; j < m_auiGridSize[1]-1; ++j ) {
00940             for ( int k = 1; k < m_auiGridSize[2]-1; ++k ) {
00941                 val = 0;
00942                 if ( m_abVertexFlag1[i][j][k] == UNSET ) {
00943                     if      ( m_abVertexFlag1[i+1][j][k] == RIGHT_OUTSIDE_BOUNDARY )    --val;
00944                     else if ( m_abVertexFlag1[i+1][j][k]  > RIGHT_OUTSIDE_BOUNDARY )    ++val;
00945                     if      ( m_abVertexFlag1[i-1][j][k] == RIGHT_OUTSIDE_BOUNDARY )    --val;
00946                     else if ( m_abVertexFlag1[i-1][j][k]  > RIGHT_OUTSIDE_BOUNDARY )    ++val;
00947                     if      ( m_abVertexFlag1[i][j+1][k] == RIGHT_OUTSIDE_BOUNDARY )    --val;
00948                     else if ( m_abVertexFlag1[i][j+1][k]  > RIGHT_OUTSIDE_BOUNDARY )    ++val;
00949                     if      ( m_abVertexFlag1[i][j-1][k] == RIGHT_OUTSIDE_BOUNDARY )    --val;
00950                     else if ( m_abVertexFlag1[i][j-1][k]  > RIGHT_OUTSIDE_BOUNDARY )    ++val;
00951                     if      ( m_abVertexFlag1[i][j][k+1] == RIGHT_OUTSIDE_BOUNDARY )    --val;
00952                     else if ( m_abVertexFlag1[i][j][k+1]  > RIGHT_OUTSIDE_BOUNDARY )    ++val;
00953                     if      ( m_abVertexFlag1[i][j][k-1] == RIGHT_OUTSIDE_BOUNDARY )    --val;
00954                     else if ( m_abVertexFlag1[i][j][k-1]  > RIGHT_OUTSIDE_BOUNDARY )    ++val;
00955                     if ( val > 0 ) {
00956                         m_abVertexFlag1[i][j][k] = INSIDE_MODEL;
00957                     }
00958                     else {
00959                         m_abVertexFlag1[i][j][k] = OUTSIDE_MODEL;
00960                     }
00961                 }
00962             }
00963         }
00964     }
00965     //*/
00966 }

template<typename T>
void GridGenerator< T >::SetDefaultIntpVal ( val  )  [inline]

Definition at line 137 of file TAPsGridGenerator_BAK.hpp.

00137 { m_tDefaultIntpVal = val; }

template<typename T>
void GridGenerator< T >::SetDefaultIntpVal ( val  )  [inline]

Definition at line 148 of file TAPsGridGenerator.hpp.

00148 { m_tDefaultIntpVal = val; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToGenerateGridInversely (  )  [inline]

Definition at line 113 of file TAPsGridGenerator_BAK.hpp.

00113 { m_bGenGridInversely = true; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToGenerateGridInversely (  )  [inline]

Definition at line 124 of file TAPsGridGenerator.hpp.

00124 { m_bGenGridInversely = true; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToGenerateGridNormally (  )  [inline]

Definition at line 114 of file TAPsGridGenerator_BAK.hpp.

00114 { m_bGenGridInversely = false; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToGenerateGridNormally (  )  [inline]

Definition at line 125 of file TAPsGridGenerator.hpp.

00125 { m_bGenGridInversely = false; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToUseHardware (  )  [inline]

Definition at line 109 of file TAPsGridGenerator_BAK.hpp.

00109 { m_bUseSoftwareToGenGrid = false; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToUseHardware (  )  [inline]

Definition at line 120 of file TAPsGridGenerator.hpp.

00120 { m_bUseSoftwareToGenGrid = false; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToUseSoftware (  )  [inline]

Definition at line 108 of file TAPsGridGenerator_BAK.hpp.

00108 { m_bUseSoftwareToGenGrid = true; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorToUseSoftware (  )  [inline]

Definition at line 119 of file TAPsGridGenerator.hpp.

00119 { m_bUseSoftwareToGenGrid = true; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorUseDefaultIntpVal (  )  [inline]

Definition at line 134 of file TAPsGridGenerator_BAK.hpp.

00134 { m_bUseDefaultIntpVal = true; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorUseDefaultIntpVal (  )  [inline]

Definition at line 145 of file TAPsGridGenerator.hpp.

00145 { m_bUseDefaultIntpVal = true; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorUseMeshOffsetForIntpVal (  )  [inline]

Definition at line 135 of file TAPsGridGenerator_BAK.hpp.

00135 { m_bUseDefaultIntpVal = false; }

template<typename T>
void GridGenerator< T >::SetGridGeneratorUseMeshOffsetForIntpVal (  )  [inline]

Definition at line 146 of file TAPsGridGenerator.hpp.

00146 { m_bUseDefaultIntpVal = false; }

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::HalfEdgeModel< T > *  pHEModel  )  [private]

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::XPolygonalModel< T > *  pXPModel  )  [private]

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::PolygonalModel< T > *  pPModel  )  [private]

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW (  )  [private]

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::HalfEdgeModel< T > *  pHEModel  )  [inline, private]

Definition at line 924 of file TAPsGridGenerator.cpp.

00926 {
00927     assert( false );
00928     // Find two vertices; (-x,0,0) and (x,0,0)
00929     // and faces that contain them
00930 }

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::XPolygonalModel< T > *  pXPModel  )  [inline, private]

Definition at line 795 of file TAPsGridGenerator.cpp.

00797 {
00798     //---------------------------------------------------------------
00799     XVertex<T> * vertex = pXPModel->GetVertexList();
00800     Face<T> * face = pXPModel->GetFaceList();
00801     int NumFaces = pXPModel->GetNoFaces();
00802     //---------------------------------------------------------------
00803     // Generate Grid by a Software Algorithm
00804     //-----------------------------------------------------
00805     Vector3<T> vMin, vMax, vPos, vAverage;
00806     //-----------------------------------------------------
00807     // For Each Face
00808     for ( int i = 0; i < NumFaces; ++i ) {
00809         //---------------------------------------
00810         // Find a box that contain this face
00811         vAverage = vMin = vMax = vertex[ face[i].GetVertexNo(0) ].GetPosition();
00812         for ( int n = 1; n < face[i].GetNoVertices(); ++n ) {
00813             vPos = vertex[ face[i].GetVertexNo(n) ].GetPosition();
00814             vAverage += vPos;
00815             for ( int d = 0; d < 3; ++d ) {
00816                 if      ( vMin[d] > vPos[d] )   vMin[d] = vPos[d];
00817                 else if ( vMax[d] < vPos[d] )   vMax[d] = vPos[d];
00818             }
00819         }
00820         //assert( vMin[0] <= vMax[0] );
00821         //assert( vMin[1] <= vMax[1] );
00822         //assert( vMin[2] <= vMax[2] );
00823         //---------------------------------------
00824         // Find a box of grids that contain this face
00825         // i.e. a bigger box that contain the face box
00826         int gMinNum[3], gMaxNum[3];
00827         T gMin, gMax;
00828         for ( int d = 0; d < 3; ++d ) {
00829             int step = m_auiGridSize[d] / 2;
00830             gMinNum[d] = gMaxNum[d] = step;
00831             gMin = m_tAABBMin[d] + gMinNum[d] * m_atGridDimension[d];
00832             T minOffset = vMin[d] - m_atGridDimension[d] / 2;
00833             T maxOffset = vMax[d] + m_atGridDimension[d] / 2;
00834             //T minOffset = vMin[d];
00835             //T maxOffset = vMax[d];
00836             //-------------------------
00837             // Find a box of this current face
00838             while ( ( gMin < minOffset || maxOffset < gMin ) && step > 1 ) {
00839                 step /= 2;
00840                 if ( gMin < minOffset ) {
00841                     gMinNum[d] += step;
00842                 }
00843                 else {
00844                     gMinNum[d] -= step;
00845                 }
00846                 gMin = m_tAABBMin[d] + gMinNum[d] * m_atGridDimension[d];
00847             }
00848             gMax = gMin;
00849             gMaxNum[d] = gMinNum[d];
00850 
00851             // DEBUG
00852             //gridBoxCenterPt[d] = gMinNum[d];
00853 
00854             //-------------------------
00855             // Find a grid box that covers the box of this current face
00856             //minMoveStep[d] = maxMoveStep[d] = 0;      // DEBUG
00857             //-------------------------
00858             // Find the low
00859             while ( vMin[d] < gMin ) {
00860             //while ( minOffset < gMin ) {
00861                 //--minMoveStep[d];     // DEBUG
00862                 --gMinNum[d];
00863                 gMin -= m_atGridDimension[d];
00864             }
00865             if ( gMinNum[d] < 0 ) {
00866                 gMinNum[d] = 0;
00867             }
00868             //-------------------------
00869             // Find the high
00870             while ( gMax < vMax[d] ) {
00871             //while ( gMax < maxOffset ) {
00872                 //++maxMoveStep[d];     // DEBUG
00873                 ++gMaxNum[d];
00874                 gMax += m_atGridDimension[d];
00875             }
00876             if ( gMaxNum[d] >= m_auiGridSize[d] ) {
00877                 gMaxNum[d] = m_auiGridSize[d] - 1;
00878             }
00879             //-----------------------------------
00880             //assert( gMinNum[d] <= gMaxNum[d] );
00881             //assert( 0 <= gMinNum[d] && gMinNum[d] < m_auiGridSize[d] );
00882             //assert( 0 <= gMaxNum[d] && gMaxNum[d] < m_auiGridSize[d] );
00883         }
00884         //-------------------------------------------------
00885         // Set Inside / Outside
00886         //vPos = vertex[ face[i].GetVertexNo(0) ].GetPosition();
00887         vAverage /= face[i].GetNoVertices();
00888         Vector3<T> normal = face[i].GetNormal();
00889         Vector3<T> direction;
00890         for ( int x = gMinNum[0]; x <= gMaxNum[0]; ++x ) {
00891             for ( int y = gMinNum[1]; y <= gMaxNum[1]; ++y ) {
00892                 for ( int z = gMinNum[2]; z <= gMaxNum[2]; ++z ) {
00893                     direction.SetXYZ( 
00894                         m_atVertexPosition[x][y][z][0] - vAverage[0],
00895                         m_atVertexPosition[x][y][z][1] - vAverage[1],
00896                         m_atVertexPosition[x][y][z][2] - vAverage[2]
00897                     );
00898                     //---------------------------
00899                     // If just outside boundary
00900                     if ( m_abVertexFlag1[x][y][z] == RIGHT_OUTSIDE_BOUNDARY ) continue;
00901                     //---------------------------
00902                     // The point is inside, on, or outside the boundary.
00903                     if ( normal * direction < 0.0 ) {
00904                         m_abVertexFlag1[x][y][z] = RIGHT_INSIDE_BOUNDARY;
00905                     }
00906                     else if ( normal * direction == 0.0 ) {
00907                         m_abVertexFlag1[x][y][z] = ON_BOUNDARY;
00908                     }
00909                     else {
00910                         m_abVertexFlag1[x][y][z] = RIGHT_OUTSIDE_BOUNDARY;
00911                     }
00912                 }
00913             }
00914         }
00915         //-------------------------------------------------
00916     }
00917     //---------------------------------------------------------------
00918     // End of Generating Grid by a Software Algorithm
00919 }

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW ( OpenGL::PolygonalModel< T > *  pPModel  )  [inline, private]

Definition at line 784 of file TAPsGridGenerator.cpp.

00786 {
00787     Vertex<T> * vertexList = pPModel->GetVertexList();
00788     assert( false );
00789     // Find two vertices; (-x,0,0) and (x,0,0)
00790     // and faces that contain them
00791 }

template<typename T>
void GridGenerator< T >::SetGridPointsToInsideOutsideModelBoundary_SW (  )  [inline, private]

Definition at line 754 of file TAPsGridGenerator.cpp.

00755 {
00756     if ( !m_pModel )    return;
00757     //---------------------------------------------------------------
00758     OpenGL::PolygonalModel<T> *     pPologonalModel 
00759             = dynamic_cast< OpenGL::PolygonalModel<T> * >( m_pModel );
00760     OpenGL::XPolygonalModel<T> *    pXPologonalModel 
00761             = dynamic_cast< OpenGL::XPolygonalModel<T> * >( m_pModel );
00762     OpenGL::HalfEdgeModel<T> *      pHalfEdgeModel 
00763             = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( m_pModel );
00764     //---------------------------------------------------------------
00765     // For PolygonalModel
00766     if ( pPologonalModel ) {
00767         SetGridPointsToInsideOutsideModelBoundary_SW( pPologonalModel );
00768     }
00769     //---------------------------------------------------------------
00770     // For XPolygonalModel
00771     if ( pXPologonalModel ) {
00772         SetGridPointsToInsideOutsideModelBoundary_SW( pXPologonalModel );
00773     }
00774     //---------------------------------------------------------------
00775     // For HalfEdgeModel
00776     if ( pHalfEdgeModel ) {
00777         SetGridPointsToInsideOutsideModelBoundary_SW( pHalfEdgeModel );
00778     }
00779     //---------------------------------------------------------------
00780 }

template<typename T>
void GridGenerator< T >::SetModelUseToGenGrid ( OpenGL::Model< T > *  pModel  )  [inline]

Definition at line 143 of file TAPsGridGenerator_BAK.hpp.

00143                                                           {
00144         if ( m_pModel != pModel ) {
00145             DeleteGrids();
00146             m_atGridDimension[0] = m_atGridDimension[1] = m_atGridDimension[2] = 0;
00147             m_auiGridSize[0] = m_auiGridSize[1] = m_auiGridSize[2] = 0;
00148         }
00149     }

template<typename T>
void GridGenerator< T >::SetModelUseToGenGrid ( OpenGL::Model< T > *  pModel  )  [inline]

Definition at line 154 of file TAPsGridGenerator.hpp.

00154                                                           {
00155         if ( m_pModel != pModel ) {
00156             DeleteGrids();
00157             m_atGridDimension[0] = m_atGridDimension[1] = m_atGridDimension[2] = 0;
00158             m_auiGridSize[0] = m_auiGridSize[1] = m_auiGridSize[2] = 0;
00159         }
00160     }

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( OpenGL::HalfEdgeModel< T > *  pHEModel  )  [private]

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( OpenGL::XPolygonalModel< T > *  pXPModel  )  [private]

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( OpenGL::PolygonalModel< T > *  pPModel  )  [private]

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData (  )  [private]

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( OpenGL::HalfEdgeModel< T > *  pHEModel  )  [inline, private]

Definition at line 2188 of file TAPsGridGenerator.cpp.

02190 {
02191     assert( false );
02192     // Find two vertices; (-x,0,0) and (x,0,0)
02193     // and faces that contain them
02194 }

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( OpenGL::XPolygonalModel< T > *  pXPModel  )  [inline, private]

First set all of interpolation data to 0.5 (the middle value).

Next if m_bUseDefaultIntpVal is false, then for each (triangle) face find the pair of right inside and right outside points that intersect the face and set the interpolation data of the right outside point to the offset distance from the right outside point to the face.

Definition at line 1886 of file TAPsGridGenerator.cpp.

01888 {
01899     //---------------------------------------------------------------
01900     // Check if "use default interpolation value" is set
01901     if ( m_bUseDefaultIntpVal ) {
01902         // Set all interpolation data to m_tDefaultIntpVal
01903         for ( int x = 0; x < m_auiGridSize[0]; ++x ) {
01904             for ( int y = 0; y < m_auiGridSize[1]; ++y ) {
01905                 for ( int z = 0; z < m_auiGridSize[2]; ++z ) {
01906                     m_atVertexInterpolation[x][y][z][0] = 
01907                     m_atVertexInterpolation[x][y][z][1] = 
01908                     m_atVertexInterpolation[x][y][z][2] = m_tDefaultIntpVal;
01909                 }
01910             }
01911         }
01912         return;
01913     }
01914     else {
01915         // Set all interpolation data to random values
01916         srand( time(NULL) );
01917         for ( int x = 0; x < m_auiGridSize[0]; ++x ) {
01918             for ( int y = 0; y < m_auiGridSize[1]; ++y ) {
01919                 for ( int z = 0; z < m_auiGridSize[2]; ++z ) {
01920                     m_atVertexInterpolation[x][y][z][0] = 
01921                     m_atVertexInterpolation[x][y][z][1] = 
01922                     m_atVertexInterpolation[x][y][z][2] = 0.49;
01923 
01924                         //0.25 + static_cast<T>( rand() / static_cast<T>( RAND_MAX * 2 ) ); // range of [0.25-0.75]
01925 
01926                         //static_cast<T>( rand() / static_cast<T>( RAND_MAX ) );            // range of [0.00-0.99]
01927                 }
01928             }
01929         }
01930     }
01931 
01932     // DEBUG
01933     //return;       // No finding interpolation values for the surface
01934 
01935     //---------------------------------------------------------------
01936     XVertex<T> * vertex = pXPModel->GetVertexList();
01937     Face<T> * face = pXPModel->GetFaceList();
01938     int NumFaces = pXPModel->GetNoFaces();
01939     //---------------------------------------------------------------
01940     // Find interpolation values for the surface by a Software Algorithm
01941     //-----------------------------------------------------
01942     Vector3<T> vMin, vMax, vPos, vAverage;
01943     //-----------------------------------------------------
01944     // For Each Face
01945     for ( int i = 0; i < NumFaces; ++i ) {
01946         //---------------------------------------
01947         // Find a box that contain this face
01948         vAverage = vMin = vMax = vertex[ face[i].GetVertexNo(0) ].GetPosition();
01949         for ( int n = 1; n < face[i].GetNoVertices(); ++n ) {
01950             vPos = vertex[ face[i].GetVertexNo(n) ].GetPosition();
01951             vAverage += vPos;
01952             for ( int d = 0; d < 3; ++d ) {
01953                 if      ( vMin[d] > vPos[d] )   vMin[d] = vPos[d];
01954                 else if ( vMax[d] < vPos[d] )   vMax[d] = vPos[d];
01955             }
01956         }
01957         //assert( vMin[0] <= vMax[0] );
01958         //assert( vMin[1] <= vMax[1] );
01959         //assert( vMin[2] <= vMax[2] );
01960         //---------------------------------------
01961         // Find a box of grids that contain this face
01962         // i.e. a bigger box that contain the face box
01963         int gMinNum[3], gMaxNum[3];
01964         T gMin, gMax;
01965         for ( int d = 0; d < 3; ++d ) {
01966             int step = m_auiGridSize[d] / 2;
01967             gMinNum[d] = gMaxNum[d] = step;
01968             gMin = m_tAABBMin[d] + gMinNum[d] * m_atGridDimension[d];
01969             T minOffset = vMin[d] - m_atGridDimension[d] / 2;
01970             T maxOffset = vMax[d] + m_atGridDimension[d] / 2;
01971             //T minOffset = vMin[d];
01972             //T maxOffset = vMax[d];
01973             //-------------------------
01974             // Find a box of this current face
01975             while ( ( gMin < minOffset || maxOffset < gMin ) && step > 1 ) {
01976                 step /= 2;
01977                 if ( gMin < minOffset ) {
01978                     gMinNum[d] += step;
01979                 }
01980                 else {
01981                     gMinNum[d] -= step;
01982                 }
01983                 gMin = m_tAABBMin[d] + gMinNum[d] * m_atGridDimension[d];
01984             }
01985             gMax = gMin;
01986             gMaxNum[d] = gMinNum[d];
01987 
01988             // DEBUG
01989             //gridBoxCenterPt[d] = gMinNum[d];
01990 
01991             //-------------------------
01992             // Find a grid box that covers the box of this current face
01993             //minMoveStep[d] = maxMoveStep[d] = 0;      // DEBUG
01994             //-------------------------
01995             // Find the low
01996             while ( vMin[d] < gMin ) {
01997             //while ( minOffset < gMin ) {
01998                 //--minMoveStep[d];     // DEBUG
01999                 --gMinNum[d];
02000                 gMin -= m_atGridDimension[d];
02001             }
02002             if ( gMinNum[d] < 0 ) {
02003                 gMinNum[d] = 0;
02004             }
02005             //-------------------------
02006             // Find the high
02007             while ( gMax < vMax[d] ) {
02008             //while ( gMax < maxOffset ) {
02009                 //++maxMoveStep[d];     // DEBUG
02010                 ++gMaxNum[d];
02011                 gMax += m_atGridDimension[d];
02012             }
02013             if ( gMaxNum[d] >= m_auiGridSize[d] ) {
02014                 gMaxNum[d] = m_auiGridSize[d] - 1;
02015             }
02016             //-----------------------------------
02017             //assert( gMinNum[d] <= gMaxNum[d] );
02018             //assert( 0 <= gMinNum[d] && gMinNum[d] < m_auiGridSize[d] );
02019             //assert( 0 <= gMaxNum[d] && gMaxNum[d] < m_auiGridSize[d] );
02020         }
02021         //-------------------------------------------------
02022         // Set Inside / Outside
02023         //vPos = vertex[ face[i].GetVertexNo(0) ].GetPosition();
02024         vAverage /= face[i].GetNoVertices();
02025         Vector3<T> normal = face[i].GetNormal();
02026         Vector3<T> direction;
02027         for ( int x = gMinNum[0]; x <= gMaxNum[0]; ++x ) {
02028             for ( int y = gMinNum[1]; y <= gMaxNum[1]; ++y ) {
02029                 for ( int z = gMinNum[2]; z <= gMaxNum[2]; ++z ) {
02030 
02031                     /*
02032                     // RANDOM VALUES
02033                     T interpolationVal = static_cast<T>( rand() / static_cast<T>( RAND_MAX ) );
02034                     m_atVertexInterpolation[x][y][z][0] = ( interpolationVal - 0.5 ) / 2.0 + 0.5;
02035                     interpolationVal = static_cast<T>( rand() / static_cast<T>( RAND_MAX ) );
02036                     m_atVertexInterpolation[x][y][z][1] = ( interpolationVal - 0.5 ) / 2.0 + 0.5;
02037                     interpolationVal = static_cast<T>( rand() / static_cast<T>( RAND_MAX ) );
02038                     m_atVertexInterpolation[x][y][z][2] = ( interpolationVal - 0.5 ) / 2.0 + 0.5;
02039                     //*/
02040 
02041 
02042                     //*
02043                     // OFFSET FROM TRIANGLE SURFACE
02044                     if ( m_abVertexFlag1[x][y][z] > RIGHT_OUTSIDE_BOUNDARY ) {
02045                         T ratio;
02046                         Vector3<T> projPt;
02047                         //---------------------------------
02048                         // x-direction
02049                         bool result = false;
02050                         if ( x >= 0 ) { 
02051                             if ( m_abVertexFlag1[x+1][y][z] == RIGHT_OUTSIDE_BOUNDARY ) {
02052                                 result = CGMath<T>::FindIntersectionLineSegmentTriangle( 
02053                                             m_atVertexPosition[x][y][z], 
02054                                             m_atVertexPosition[x+1][y][z], 
02055                                             vertex[ face[i].GetVertexNo(0) ].GetPosition(), 
02056                                             vertex[ face[i].GetVertexNo(1) ].GetPosition(), 
02057                                             vertex[ face[i].GetVertexNo(2) ].GetPosition(), 
02058                                             ratio, projPt                           // O/P:
02059                                         );
02060                             }
02061                             if ( result ) {
02062                                 m_atVertexInterpolation[x][y][z][0]   = ratio;
02063                                 //m_atVertexInterpolation[x+1][y][z][0] = 1.0 - ratio;
02064                             }
02065                         }
02066                         if ( x < m_auiGridSize[0] ) {
02067                             if ( m_abVertexFlag1[x-1][y][z] == RIGHT_OUTSIDE_BOUNDARY ) {
02068                                 result = CGMath<T>::FindIntersectionLineSegmentTriangle( 
02069                                             m_atVertexPosition[x][y][z], 
02070                                             m_atVertexPosition[x-1][y][z], 
02071                                             vertex[ face[i].GetVertexNo(0) ].GetPosition(), 
02072                                             vertex[ face[i].GetVertexNo(1) ].GetPosition(), 
02073                                             vertex[ face[i].GetVertexNo(2) ].GetPosition(), 
02074                                             ratio, projPt                           // O/P:
02075                                         );
02076                             }
02077                             if ( result ) {
02078                                 m_atVertexInterpolation[x][y][z][0]   = ratio;
02079                                 //m_atVertexInterpolation[x-1][y][z][0] = 1.0 - ratio;
02080                             }
02081                         }
02082                         //---------------------------------
02083                         // y-direction
02084                         result = false;
02085                         if ( y >= 0 ) { 
02086                             if ( m_abVertexFlag1[x][y+1][z] == RIGHT_OUTSIDE_BOUNDARY ) {
02087                                 result = CGMath<T>::FindIntersectionLineSegmentTriangle( 
02088                                             m_atVertexPosition[x][y][z], 
02089                                             m_atVertexPosition[x][y+1][z], 
02090                                             vertex[ face[i].GetVertexNo(0) ].GetPosition(), 
02091                                             vertex[ face[i].GetVertexNo(1) ].GetPosition(), 
02092                                             vertex[ face[i].GetVertexNo(2) ].GetPosition(), 
02093                                             ratio, projPt                           // O/P:
02094                                         );
02095                             }
02096                             if ( result ) {
02097                                 m_atVertexInterpolation[x][y][z][1]   = ratio;
02098                                 //m_atVertexInterpolation[x][y+1][z][1] = 1.0 - ratio;
02099                             }
02100                         }
02101                         if ( y < m_auiGridSize[1] ) {
02102                             if ( m_abVertexFlag1[x][y-1][z] == RIGHT_OUTSIDE_BOUNDARY ) {
02103                                 result = CGMath<T>::FindIntersectionLineSegmentTriangle( 
02104                                             m_atVertexPosition[x][y][z], 
02105                                             m_atVertexPosition[x][y-1][z], 
02106                                             vertex[ face[i].GetVertexNo(0) ].GetPosition(), 
02107                                             vertex[ face[i].GetVertexNo(1) ].GetPosition(), 
02108                                             vertex[ face[i].GetVertexNo(2) ].GetPosition(), 
02109                                             ratio, projPt                           // O/P:
02110                                         );
02111                             }
02112                             if ( result ) {
02113                                 m_atVertexInterpolation[x][y][z][1]   = ratio;
02114                                 //m_atVertexInterpolation[x][y-1][z][1] = 1.0 - ratio;
02115                             }
02116                         }
02117                         //---------------------------------
02118                         // z-direction
02119                         result = false;
02120                         if ( z >= 0 ) { 
02121                             if ( m_abVertexFlag1[x][y][z+1] == RIGHT_OUTSIDE_BOUNDARY ) {
02122                                 result = CGMath<T>::FindIntersectionLineSegmentTriangle( 
02123                                             m_atVertexPosition[x][y][z], 
02124                                             m_atVertexPosition[x][y][z+1], 
02125                                             vertex[ face[i].GetVertexNo(0) ].GetPosition(), 
02126                                             vertex[ face[i].GetVertexNo(1) ].GetPosition(), 
02127                                             vertex[ face[i].GetVertexNo(2) ].GetPosition(), 
02128                                             ratio, projPt                           // O/P:
02129                                         );
02130                             }
02131                             if ( result ) {
02132                                 m_atVertexInterpolation[x][y][z][2]   = ratio;
02133                                 //m_atVertexInterpolation[x][y][z+1][2] = 1.0 - ratio;
02134                             }
02135                         }
02136                         if ( z < m_auiGridSize[2] ) {
02137                             if ( m_abVertexFlag1[x][y][z-1] == RIGHT_OUTSIDE_BOUNDARY ) {
02138                                 result = CGMath<T>::FindIntersectionLineSegmentTriangle( 
02139                                             m_atVertexPosition[x][y][z], 
02140                                             m_atVertexPosition[x][y][z-1], 
02141                                             vertex[ face[i].GetVertexNo(0) ].GetPosition(), 
02142                                             vertex[ face[i].GetVertexNo(1) ].GetPosition(), 
02143                                             vertex[ face[i].GetVertexNo(2) ].GetPosition(), 
02144                                             ratio, projPt                           // O/P:
02145                                         );
02146                             }
02147                             if ( result ) {
02148                                 m_atVertexInterpolation[x][y][z][2]   = ratio;
02149                                 //m_atVertexInterpolation[x][y][z-1][2] = 1.0 - ratio;
02150                             }
02151                         }
02152                         //---------------------------------
02153                     }
02154                     //*/
02155 
02156                     /*
02157                     direction.SetXYZ( 
02158                         m_atVertexPosition[x][y][z][0] - vAverage[0],
02159                         m_atVertexPosition[x][y][z][1] - vAverage[1],
02160                         m_atVertexPosition[x][y][z][2] - vAverage[2]
02161                     );
02162                     //---------------------------
02163                     // If just outside boundary
02164                     if ( m_abVertexFlag1[x][y][z] == RIGHT_OUTSIDE_BOUNDARY ) continue;
02165                     //---------------------------
02166                     // The point is inside, on, or outside the boundary.
02167                     if ( normal * direction < 0.0 ) {
02168                         m_abVertexFlag1[x][y][z] = RIGHT_INSIDE_BOUNDARY;
02169                     }
02170                     else if ( normal * direction == 0.0 ) {
02171                         m_abVertexFlag1[x][y][z] = ON_BOUNDARY;
02172                     }
02173                     else {
02174                         m_abVertexFlag1[x][y][z] = RIGHT_OUTSIDE_BOUNDARY;
02175                     }
02176                     //*/
02177                 }
02178             }
02179         }
02180         //-------------------------------------------------
02181     }
02182     //---------------------------------------------------------------
02183 }

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( OpenGL::PolygonalModel< T > *  pPModel  )  [inline, private]

Definition at line 1875 of file TAPsGridGenerator.cpp.

01877 {
01878     Vertex<T> * vertexList = pPModel->GetVertexList();
01879     assert( false );
01880     // Find two vertices; (-x,0,0) and (x,0,0)
01881     // and faces that contain them
01882 }

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData (  )  [inline, private]

Definition at line 1845 of file TAPsGridGenerator.cpp.

01846 {
01847     if ( !m_pModel )    return;
01848     //---------------------------------------------------------------
01849     OpenGL::PolygonalModel<T> *     pPologonalModel 
01850             = dynamic_cast< OpenGL::PolygonalModel<T> * >( m_pModel );
01851     OpenGL::XPolygonalModel<T> *    pXPologonalModel 
01852             = dynamic_cast< OpenGL::XPolygonalModel<T> * >( m_pModel );
01853     OpenGL::HalfEdgeModel<T> *      pHalfEdgeModel 
01854             = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( m_pModel );
01855     //---------------------------------------------------------------
01856     // For PolygonalModel
01857     if ( pPologonalModel ) {
01858         SetVertexInterpolationData( pPologonalModel );
01859     }
01860     //---------------------------------------------------------------
01861     // For XPolygonalModel
01862     if ( pXPologonalModel ) {
01863         SetVertexInterpolationData( pXPologonalModel );
01864     }
01865     //---------------------------------------------------------------
01866     // For HalfEdgeModel
01867     if ( pHalfEdgeModel ) {
01868         SetVertexInterpolationData( pHalfEdgeModel );
01869     }
01870     //---------------------------------------------------------------
01871 }

template<typename T>
void GridGenerator< T >::SetVertexInterpolationData ( tDefaultVal  )  [inline, private]

Definition at line 1808 of file TAPsGridGenerator.cpp.

01809 {
01810     if ( !m_pModel )    return;
01811     //---------------------------------------------------------------
01812     // Set global default interpolation value
01813     m_bUseDefaultIntpVal = true;
01814     m_tDefaultIntpVal = tDefaultVal;
01815     //---------------------------------------------------------------
01816     OpenGL::PolygonalModel<T> *     pPologonalModel 
01817             = dynamic_cast< OpenGL::PolygonalModel<T> * >( m_pModel );
01818     OpenGL::XPolygonalModel<T> *    pXPologonalModel 
01819             = dynamic_cast< OpenGL::XPolygonalModel<T> * >( m_pModel );
01820     OpenGL::HalfEdgeModel<T> *      pHalfEdgeModel 
01821             = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( m_pModel );
01822     //---------------------------------------------------------------
01823     // For PolygonalModel
01824     if ( pPologonalModel ) {
01825         SetVertexInterpolationData( pPologonalModel );
01826     }
01827     //---------------------------------------------------------------
01828     // For XPolygonalModel
01829     if ( pXPologonalModel ) {
01830         SetVertexInterpolationData( pXPologonalModel );
01831     }
01832     //---------------------------------------------------------------
01833     // For HalfEdgeModel
01834     if ( pHalfEdgeModel ) {
01835         SetVertexInterpolationData( pHalfEdgeModel );
01836     }
01837     //---------------------------------------------------------------
01838 }


Member Data Documentation

template<typename T>
VertexFlag *** GridGenerator< T >::m_abVertexFlag1 [private]

Definition at line 344 of file TAPsGridGenerator.hpp.

template<typename T>
T GridGenerator< T >::m_atGridDimension [private]

8 points defined the bounding box.

Definition at line 315 of file TAPsGridGenerator.hpp.

template<typename T>
T **** GridGenerator< T >::m_atVertexInterpolation [private]

The interpolation data below are for interpolation value from a point inside the boundary to a point outside the boundary.

It is 4-dim of [x][y][z][3].

Where [x][y][z] is the point (Cartesian integer) location in the data structure, and [3] is for x, y, and z interpolation directions.

Definition at line 355 of file TAPsGridGenerator.hpp.

template<typename T>
T **** GridGenerator< T >::m_atVertexNormal [private]

Definition at line 343 of file TAPsGridGenerator.hpp.

template<typename T>
T **** GridGenerator< T >::m_atVertexPosition [private]

Data is ordered in x, y, and z.

Definition at line 342 of file TAPsGridGenerator.hpp.

template<typename T>
int GridGenerator< T >::m_auiGridSize [private]

Definition at line 316 of file TAPsGridGenerator.hpp.

template<typename T>
bool GridGenerator< T >::m_bGenGridInversely [private]

Definition at line 322 of file TAPsGridGenerator.hpp.

template<typename T>
bool GridGenerator< T >::m_bUseDefaultIntpVal [private]

Definition at line 326 of file TAPsGridGenerator.hpp.

template<typename T>
bool GridGenerator< T >::m_bUseSoftwareToGenGrid [private]

Definition at line 321 of file TAPsGridGenerator.hpp.

template<typename T>
OpenGL::Model< T > * GridGenerator< T >::m_pModel [private]

Definition at line 333 of file TAPsGridGenerator.hpp.

template<typename T>
T GridGenerator< T >::m_tAABBMax [private]

Definition at line 292 of file TAPsGridGenerator.hpp.

template<typename T>
T GridGenerator< T >::m_tAABBMin [private]

Definition at line 291 of file TAPsGridGenerator.hpp.

template<typename T>
T GridGenerator< T >::m_tDefaultIntpVal [private]

Definition at line 327 of file TAPsGridGenerator.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:44:54 2008 for TAPs by  doxygen 1.5.6