// 1. Calculate max radius and then max displacement for each edge.
// 2. tmin=minimum of the maximum displacements.
// 3. Calculate radius from the tmin for each edge.
YSRESULT YsShellExt_RoundUtil3d::SetUpRoundVertex(const YsShell &shl,YSSIZE_T nVt,const YsShellVertexHandle vtHdArray[])
{
	const YsShellSearchTable *search=shl.GetSearchTable();
	if(NULL==search)
	{
		YsPrintf("%s\n",__FUNCTION__);
		YsPrintf("  This function requires a search table.\n");
		return YSERR;
	}

	CleanUp();
	for(YSSIZE_T vtIdx=0; vtIdx<nVt; ++vtIdx)
	{
		YsArray <YsShellVertexHandle> connVtHdArray;
		if(YSOK==search->GetConnectedVertexList(connVtHdArray,shl,vtHdArray[vtIdx]))
		{
			for(auto connVtHd : connVtHdArray)
			{
				cornerArray.Increment();
				cornerArray.Last().Initialize();
				cornerArray.Last().fromVtHd=vtHdArray[vtIdx];
				cornerArray.Last().toVtHd=connVtHd;
				cornerArray.Last().toPos=shl.GetVertexPosition(connVtHd);
			}
		}
	}

	if(YSOK!=CalculateRoundingDirectionAll(shl))
	{
		CleanUp();
		return YSERR;
	}

	return YSOK;
}
YSBOOL YsShellExt_RoundUtil3d::IsEdgeUsing(const YsShellVertexHandle edVtHd0,const YsShellVertexHandle edVtHd1,const YsShell &shl,const YsShellPolygonStore &polygonStore) const
{
	const YsShellSearchTable *search=shl.GetSearchTable();

	int nEdPl;
	const YsShellPolygonHandle *edPlHd;
	if(YSOK==search->FindPolygonListByEdge(nEdPl,edPlHd,shl,edVtHd0,edVtHd1))
	{
		for(int plIdx=0; plIdx<nEdPl; ++plIdx)
		{
			if(YSTRUE==polygonStore.IsIncluded(edPlHd[plIdx]))
			{
				return YSTRUE;
			}
		}
	}
	return YSFALSE;
}