public int getTriHypotenuse(CNAVICELL.CADJ_TRI[] arrAdjTri, List <CTRI> listTris, int iSeqTri) { if (arrAdjTri.Length < 1 || iSeqTri < 0) { return(-1); } CNAVICELL.CADJ_TRI tri_Adj = arrAdjTri[iSeqTri]; CTRI tri = listTris[iSeqTri]; int iEdge_Hyptenuse = tri.GetHypotenuseEdge(); if (CTRI.NULL_TRI_EDGE == iEdge_Hyptenuse) { return(-1); } int iTri_Hypotenuse = tri_Adj._arrTrisAdjacent[iEdge_Hyptenuse]; if (iTri_Hypotenuse == CNAVICELL.NULL_CELL) { return(-1); } return(iTri_Hypotenuse); }
//@ Collect All BaseTower List which calculated Perfect Square. static public bool CollectAll_perfectSqre_exceptGoalTri(CNAVICELL[] arrNavicells, CTriCollector tricollector, ref List <CBASE__> listBase) { int iCntNaviCell = arrNavicells.Length; if (iCntNaviCell < 1) { Debug.Log("if(iCntNaviCell < 1)"); return(false); } List <int> listIdxTrisGoal = tricollector.m_listTris_naviGoal; List <int> listIdxTrisStart = tricollector.m_listTris_naviStart; List <int> listTriIR = new List <int>(); CNAVICELL.CADJ_TRI[] arrAdjs_ = tricollector.arrayAllTriAdjacent; tricollector.collectAll_IsoscellesRightTriangles(ref listTriIR); List <int> listTri_Instant__ = new List <int>(); bool bValidatedBase_perfectSquare = false; foreach (int iIdxTri in listTriIR) { CNAVICELL.CADJ_TRI adjTri = arrAdjs_[iIdxTri]; CTRI triCurr = tricollector.getTri(iIdxTri); bValidatedBase_perfectSquare = false; //@ process skip if (true == triCurr.inclinedPlane()) { continue; } if (-1 < listIdxTrisGoal.BinarySearch(iIdxTri)) { continue; } if (-1 < listIdxTrisStart.BinarySearch(iIdxTri)) { continue; } int iEdge_Hyptenuse = triCurr.GetHypotenuseEdge(); if (CTRI.NULL_TRI_EDGE == iEdge_Hyptenuse) { continue; } int iTri_Hypotenuse = adjTri._arrTrisAdjacent[iEdge_Hyptenuse]; if (iTri_Hypotenuse == CNAVICELL.NULL_CELL) { continue; } CTRI triHyptenuse = tricollector.getTri(iTri_Hypotenuse); if (triHyptenuse.IsisoscelesRightAngle() == true) { bValidatedBase_perfectSquare = true; listTri_Instant__.Add(iIdxTri); listTri_Instant__.Add(iTri_Hypotenuse); } if (true == bValidatedBase_perfectSquare) { CBASE__ base__New = new CBASE__(); for (int iTri_ = 0; iTri_ < listTri_Instant__.Count; ++iTri_) { int iSeqTri_ = listTri_Instant__[iTri_]; CTRI triPicked = tricollector.getTri(iSeqTri_); base__New.InsertNewTri(iSeqTri_, triPicked, false); } bool bAlreadyExisted = false; foreach (CBASE__ base__Sub in listBase) { if (true == base__Sub.IsSimilar(base__New)) { bAlreadyExisted = true; break; } } if (false == bAlreadyExisted) { base__New.CalculateBase__(iIdxTri); listBase.Add(base__New); } listTri_Instant__.Clear(); } // if(true==bValidatedBase_perfectSquare) } // foreach(int iIdxTri in listTriIR) return(true); } // static public bool CollectAll_perfectSqre_exceptGoalTri()