Exemple #1
0
        /// <summary>
        /// 直接根据单元格的标号,生成投影到TriFace上的Rect
        /// </summary>
        /// <param name="xIdxCell"></param>
        /// <param name="zIdxCell"></param>
        /// <returns></returns>
        Vector3d[] CreateFloorGridCellProjectionRect(int xIdxCell, int zIdxCell)
        {
            Vector3d[] cellRect           = voxSpace.GetFloorGridCellRect(xIdxCell, zIdxCell);
            Vector3d[] cellProjectionRect = new Vector3d[4];

            for (int i = 0; i < cellRect.Length; i++)
            {
                geoAlgo.SolveCrossPoint(cellRect[i], floorGridNormal, vertexs[0], triFaceNormal, out cellProjectionRect[i]);
            }

            return(cellProjectionRect);
        }
        public void _CreateSpaceSpanGroup(SolidSpanGroup solidSpanGroup)
        {
            Dictionary <int, LinkedList <SolidSpan> > soildSpanDict = solidSpanGroup.soildSpanDict;
            LinkedList <SolidSpan> solidSpanList;
            SpaceSpan spaceSpan;

            int[]            cellIdxs;
            Vector3d[]       voxRect;
            CellSpaceSpans   cellSpaceSpans;
            List <SpaceSpan> spaceSpanList;
            double           startpos;
            double           endpos;

            foreach (var item in soildSpanDict)
            {
                cellIdxs = solidSpanGroup.GetCellIdxs(item.Key);
                voxRect  = voxSpace.GetFloorGridCellRect(cellIdxs[0], cellIdxs[1]);

                solidSpanList = item.Value;
                var node = solidSpanList.First;

                cellSpaceSpans = new CellSpaceSpans();
                spaceSpanList  = new List <SpaceSpan>();
                cellSpaceSpans.spaceSpanList = spaceSpanList;
                cellSpaceSpans.rect          = voxRect;

                for (; node != null; node = node.Next)
                {
                    startpos = node.Value.endPos;
                    if (node.Next != null)
                    {
                        endpos = node.Next.Value.startPos;
                    }
                    else
                    {
                        endpos = startpos + 1000000;
                    }

                    if (endpos - startpos >= minWalkHeight)
                    {
                        spaceSpan                = new SpaceSpan();
                        spaceSpan.startPos       = startpos;
                        spaceSpan.endPos         = endpos;
                        spaceSpan.cellSpaceSpans = cellSpaceSpans;
                        spaceSpan.connectSpan    = new SpaceSpan[] { null, null, null, null };
                        spaceSpanList.Add(spaceSpan);
                    }
                }

                spaceSpanDict[item.Key] = cellSpaceSpans;
            }
        }