コード例 #1
0
void CXinWangImprovedCH::BuildSequenceTree()
{
	//m_InfoAtVertices[indexOfSourceVert].fParentIsPseudoSource;
	++m_InfoAtVertices[indexOfSourceVert].birthTime;
	//m_InfoAtVertices[indexOfSourceVert].indexOfParent;
	//m_InfoAtVertices[indexOfSourceVert].indexOfRootVertOfParent;
	m_InfoAtVertices[indexOfSourceVert].level = 0;
	m_InfoAtVertices[indexOfSourceVert].disUptodate = 0;
	//m_InfoAtVertices[indexOfSourceVert].entryProp;	
	ComputeChildrenOfSource();
	bool fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	while (!m_QueueForPseudoSources.empty() || !m_QueueForWindows.empty())
	{	
		if ((int)m_QueueForWindows.size() > nMaxLenOfWindowQueue)
			nMaxLenOfWindowQueue = (int)m_QueueForWindows.size();
		if (m_QueueForPseudoSources.size() > nMaxLenOfPseudoSources)
			nMaxLenOfPseudoSources = m_QueueForPseudoSources.size();
		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			int indexOfVert = m_QueueForPseudoSources.top().indexOfVert;
			m_QueueForPseudoSources.pop();			
			ComputeChildrenOfPseudoSource(indexOfVert);			
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			m_QueueForWindows.pop();
			ComputeChildrenOfWindow(quoteW);		
			delete quoteW.pWindow;
		}
		fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	}
}
コード例 #2
0
ファイル: PreviousCH.cpp プロジェクト: phg1024/Unfolding2
void CPreviousCH::BuildSequenceTree()
{
	ComputeChildrenOfSource();
	bool fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	while (depthOfResultingTree < model.GetNumOfFaces() && !(m_QueueForPseudoSources.empty() && m_QueueForWindows.empty()))
	{		
		if ((int)m_QueueForWindows.size() > nMaxLenOfWindowQueue)
			nMaxLenOfWindowQueue = (int)m_QueueForWindows.size();
		if (m_QueueForPseudoSources.size() > nMaxLenOfPseudoSources)
			nMaxLenOfPseudoSources = (int)m_QueueForPseudoSources.size();
		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			int indexOfVert = m_QueueForPseudoSources.front().indexOfVert;
			m_QueueForPseudoSources.pop();		
			if (!model.IsConvexVert(indexOfVert))
				ComputeChildrenOfPseudoSource(indexOfVert);	
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.front();
			m_QueueForWindows.pop();
			ComputeChildrenOfWindow(quoteW);		
			delete quoteW.pWindow;
		}
		fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	}
}
コード例 #3
0
//------------By YingXiang---------------
void CICHWithFurtherPriorityQueue::BuildSequenceTree_SVG(double distThrehold, set<int> &fixedDests, int max_covered_points )
{
	fixedDests.clear();
	fixedDests.insert(indexOfSourceVerts.begin(), indexOfSourceVerts.end());
	numDirectWindow = 0;
	ComputeChildrenOfSource();
	bool fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	while (!m_QueueForPseudoSources.empty() || !m_QueueForWindows.empty())
	{	
		if(numDirectWindow <= 0)break; // for SVG
        if(fixedDests.size() >= max_covered_points) break;
		if ((int)m_QueueForWindows.size() > nMaxLenOfWindowQueue)
			nMaxLenOfWindowQueue = (int)m_QueueForWindows.size();
		if (m_QueueForPseudoSources.size() > nMaxLenOfPseudoSources)
			nMaxLenOfPseudoSources = m_QueueForPseudoSources.size();
		double minCurrentDis = DBL_MAX;
		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			minCurrentDis = m_QueueForPseudoSources.top().disUptodate;
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			minCurrentDis = quoteW.disUptodate;
		}
		//fprintf(stderr, "numDirectWindow=%d, minCurrentDis=%g\n", numDirectWindow, minCurrentDis);

		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			int indexOfVert = m_QueueForPseudoSources.top().indexOfVert;
			m_QueueForPseudoSources.pop();	
			fixedDests.insert(indexOfVert);

			if (minCurrentDis > distThrehold)
			{
				return;
			}
			if (!model.IsConvexVert(indexOfVert))
				ComputeChildrenOfPseudoSource(indexOfVert);	
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			m_QueueForWindows.pop();
			if(quoteW.pWindow->indexOfRoot == indexOfSourceVerts[0]){
				numDirectWindow --;
			}
			ComputeChildrenOfWindow(quoteW);		
			delete quoteW.pWindow;
		}

		fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	}
}
コード例 #4
0
void CICHWithFurtherPriorityQueue::BuildSequenceTree()
{
	set<int> tmpDests(destinations);
	ComputeChildrenOfSource();
	bool fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	while (!m_QueueForPseudoSources.empty() || !m_QueueForWindows.empty())
	{	
		if (!destinations.empty() && tmpDests.empty())
			break;
		if ((int)m_QueueForWindows.size() > nMaxLenOfWindowQueue)
			nMaxLenOfWindowQueue = (int)m_QueueForWindows.size();
		if (m_QueueForPseudoSources.size() > nMaxLenOfPseudoSources)
			nMaxLenOfPseudoSources = m_QueueForPseudoSources.size();
		double minCurrentDis = DBL_MAX;
		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			minCurrentDis = m_QueueForPseudoSources.top().disUptodate;
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			minCurrentDis = quoteW.disUptodate;
		}
		vector<int> tobedeleted;
		for (set<int>::iterator it = tmpDests.begin(); it != tmpDests.end(); ++it)
		{
			if (m_InfoAtVertices[*it].disUptodate <= minCurrentDis)
				tobedeleted.push_back(*it);
		}
		for (int i = 0; i < (int)tobedeleted.size(); ++i)
		{
			tmpDests.erase(tobedeleted[i]);
		}
		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			int indexOfVert = m_QueueForPseudoSources.top().indexOfVert;
			m_QueueForPseudoSources.pop();	
			if (!model.IsConvexVert(indexOfVert))
				ComputeChildrenOfPseudoSource(indexOfVert);	
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			m_QueueForWindows.pop();
			ComputeChildrenOfWindow(quoteW);		
			delete quoteW.pWindow;
		}

		fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	}
}
コード例 #5
0
double CICHWithFurtherPriorityQueue::BuildSequenceTree_vertNum(int levelNum, set<int> &fixedDests)
{
	fixedDests.clear();
	fixedDests.insert(indexOfSourceVerts.begin(), indexOfSourceVerts.end());
	ComputeChildrenOfSource();
	bool fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();
	while (!m_QueueForPseudoSources.empty() || !m_QueueForWindows.empty())
	{	
		if ((int)m_QueueForWindows.size() > nMaxLenOfWindowQueue)
			nMaxLenOfWindowQueue = (int)m_QueueForWindows.size();
		if (m_QueueForPseudoSources.size() > nMaxLenOfPseudoSources)
			nMaxLenOfPseudoSources = m_QueueForPseudoSources.size();
		double minCurrentDis = DBL_MAX;
		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			minCurrentDis = m_QueueForPseudoSources.top().disUptodate;
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			minCurrentDis = quoteW.disUptodate;
		}

		if (fFromQueueOfPseudoSources) //pseudosource
		{				
			int indexOfVert = m_QueueForPseudoSources.top().indexOfVert;
			m_QueueForPseudoSources.pop();			
			fixedDests.insert(indexOfVert);
			if (fixedDests.size() > levelNum)
			{
				return minCurrentDis;
			}			
			if (!model.IsConvexVert(indexOfVert))
				ComputeChildrenOfPseudoSource(indexOfVert);				
		}
		else			
		{
			QuoteWindow quoteW = m_QueueForWindows.top();
			m_QueueForWindows.pop();
			ComputeChildrenOfWindow(quoteW);		
			delete quoteW.pWindow;
		}

		fFromQueueOfPseudoSources = UpdateTreeDepthBackWithChoice();		
	}
	return FLT_MAX;
}