void SCurve::BuildEdgeSources( MSCloud &es_cloud, GridDensity* grid_den ) { // Tesselate curve using baseline density. TessIntegrate(); SmoothTess(); UWTess(); vec3d uw = m_UWTess[0]; vec3d p0 = m_Surf->CompPnt( uw.x(), uw.y() ); vec3d p1; for ( int i = 1 ; i < (int)m_UTess.size() ; i++ ) { uw = m_UWTess[i]; p1 = m_Surf->CompPnt( uw.x(), uw.y() ); double d = dist( p0, p1 ); vec3d p = ( p1 + p0 ) * 0.5; double *strptr = new double; *strptr = d; MapSource es = MapSource( p, strptr ); es_cloud.sources.push_back( es ); p0 = p1; } m_UTess.clear(); m_UWTess.clear(); }
void Surf::BuildTargetMap( vector< MapSource* > &sources, int sid ) { int npatchu = ( m_NumU - 1 ) / 3; int npatchw = ( m_NumW - 1 ) / 3; int nmapu = npatchu * ( m_NumMap - 1 ) + 1; int nmapw = npatchw * ( m_NumMap - 1 ) + 1; // Initialize map matrix dimensions m_SrcMap.resize( nmapu ); for( int i = 0; i < nmapu ; i++ ) { m_SrcMap[i].resize( nmapw ); } // Loop over surface evaluating source strength and curvature for( int i = 0; i < nmapu ; i++ ) { double u = ( 1.0 * i ) / ( m_NumMap - 1 ); for( int j = 0; j < nmapw ; j++ ) { double w = ( 1.0 * j ) / ( m_NumMap - 1 ); double len = numeric_limits<double>::max( ); // apply curvature based limits double curv_len = TargetLen( u, w, m_GridDensityPtr->GetMaxGap(), m_GridDensityPtr->GetRadFrac()); len = min( len, curv_len ); // apply minimum edge length as safety on curvature len = max( len, m_GridDensityPtr->GetMinLen() ); // apply sources vec3d p = CompPnt( u, w ); double grid_len = m_GridDensityPtr->GetTargetLen( p ); len = min( len, grid_len ); // finally check max size len = min( len, m_GridDensityPtr->GetBaseLen() ); MapSource ms = MapSource( p, len, sid ); m_SrcMap[i][j] = ms; sources.push_back( &( m_SrcMap[i][j] ) ); } } }
void Surf::BuildTargetMap( vector< MapSource* > &sources, int sid ) { int npatchu = m_SurfCore.GetNumUPatches(); int npatchw = m_SurfCore.GetNumWPatches(); int nmapu = npatchu * ( m_NumMap - 1 ) + 1; int nmapw = npatchw * ( m_NumMap - 1 ) + 1; double umin = m_SurfCore.GetMinU(); double du = m_SurfCore.GetMaxU() - umin; double wmin = m_SurfCore.GetMinW(); double dw = m_SurfCore.GetMaxW() - wmin; // Initialize map matrix dimensions m_SrcMap.resize( nmapu ); for( int i = 0; i < nmapu ; i++ ) { m_SrcMap[i].resize( nmapw ); } bool limitFlag = false; if ( m_FarFlag ) { limitFlag = true; } if ( m_SymPlaneFlag ) { limitFlag = true; } // Loop over surface evaluating source strength and curvature for( int i = 0; i < nmapu ; i++ ) { double u = umin + du * ( 1.0 * i ) / ( nmapu - 1 ); for( int j = 0; j < nmapw ; j++ ) { double w = wmin + dw * ( 1.0 * j ) / ( nmapw - 1 ); double len = numeric_limits<double>::max( ); // apply curvature based limits double curv_len = TargetLen( u, w, m_GridDensityPtr->GetMaxGap( limitFlag ), m_GridDensityPtr->GetRadFrac( limitFlag ) ); len = min( len, curv_len ); // apply minimum edge length as safety on curvature len = max( len, m_GridDensityPtr->m_MinLen() ); // apply sources vec3d p = m_SurfCore.CompPnt( u, w ); double grid_len = m_GridDensityPtr->GetTargetLen( p, limitFlag ); len = min( len, grid_len ); // finally check max size len = min( len, m_GridDensityPtr->GetBaseLen( limitFlag ) ); MapSource ms = MapSource( p, len, sid ); m_SrcMap[i][j] = ms; sources.push_back( &( m_SrcMap[i][j] ) ); } } }