示例#1
0
        private float CalculateCellWeight(List <Vector3D> importantPositions, Vector3I cellPos)
        {
            Vector3D vectord;
            Vector3I geometryCellCoord = cellPos;

            MyVoxelCoordSystems.GeometryCellCenterCoordToWorldPos(this.m_voxelMap.PositionLeftBottomCorner, ref geometryCellCoord, out vectord);
            float positiveInfinity = float.PositiveInfinity;

            using (List <Vector3D> .Enumerator enumerator = importantPositions.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    float num2 = Vector3.RectangularDistance(enumerator.Current, (Vector3)vectord);
                    if (num2 < positiveInfinity)
                    {
                        positiveInfinity = num2;
                    }
                }
            }
            if (this.m_cellsOnWayCoords.Contains(MyCellCoord.PackId64Static(0, cellPos)))
            {
                positiveInfinity -= 8f;
            }
            return(GetWeight(positiveInfinity));
        }