} // public bool setNewBase_fromListTris( List<CBASE__> listBase_ ) //@ Construct New Base__ protected int setNewBase_fromListTris(List <int> listTriIdx_Instant) { if (true == m_listTrisAll_copy.IsNullOrEmpty() || true == listTriIdx_Instant.IsNullOrEmpty()) { Debug.LogError("(true == m_listTrisAll_copy.IsNullOrEmpty() || true == listTriIdx_Instant.IsNullOrEmpty())"); return(-1); } int iFirstIdx = listTriIdx_Instant[0]; CBASE__ baseNew = new CBASE__(); for (int iTri_ = 0; iTri_ < listTriIdx_Instant.Count; ++iTri_) { int iSeqTri_ = listTriIdx_Instant[iTri_]; CTRI triPicked = m_listTrisAll_copy.GetSafe(iSeqTri_); if (null == triPicked) { Debug.LogError("(null == triPicked)/setNewBase_fromListTris"); continue; } baseNew.InsertNewTri(iSeqTri_, triPicked, false); } baseNew.CalculateBase__(iFirstIdx); m_listBase__.Add(baseNew); Clear_InstantTriangles_All(); return(m_listBase__.Count); }
//@ 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()