Example #1
0
        public void FixOuterEdge(int edgeIndex, bool firstPoint, Vector3 currentPosition)
        {
            OuterEdgePoint point1 = new OuterEdgePoint(edgeIndex, firstPoint);

            MyVector3Grid <OuterEdgePoint> .SphereQuery query = this.m_outerEdgePoints.QueryPointsSphere(ref currentPosition, OUTER_EDGE_EPSILON * 3f);
            while (query.MoveNext())
            {
                if (query.Current.EdgeIndex != edgeIndex)
                {
                    continue;
                }
                if (query.Current.FirstPoint == firstPoint)
                {
                    this.m_outerEdgePoints.MovePoint(query.StorageIndex, ref currentPosition);
                }
            }
        }
Example #2
0
 public bool TryRemoveOuterEdge(ref Vector3 posv0, ref Vector3 posv1, ref int edgeIndex)
 {
     if (edgeIndex == -1)
     {
         MyVector3Grid <OuterEdgePoint> .SphereQuery query = this.m_outerEdgePoints.QueryPointsSphere(ref posv0, OUTER_EDGE_EPSILON);
         while (true)
         {
             if (!query.MoveNext())
             {
                 edgeIndex = -1;
                 break;
             }
             MyVector3Grid <OuterEdgePoint> .SphereQuery query2 = this.m_outerEdgePoints.QueryPointsSphere(ref posv1, OUTER_EDGE_EPSILON);
             while (query2.MoveNext())
             {
                 OuterEdgePoint current = query.Current;
                 OuterEdgePoint point2  = query2.Current;
                 if ((current.EdgeIndex == point2.EdgeIndex) && (current.FirstPoint && !point2.FirstPoint))
                 {
                     edgeIndex = current.EdgeIndex;
                     this.m_outerEdgePoints.RemoveTwo(ref query, ref query2);
                     return(true);
                 }
             }
         }
     }
     else
     {
         int num = 0;
         MyVector3Grid <OuterEdgePoint> .SphereQuery query3 = this.m_outerEdgePoints.QueryPointsSphere(ref posv0, OUTER_EDGE_EPSILON);
         while (true)
         {
             if (query3.MoveNext())
             {
                 if (query3.Current.EdgeIndex != edgeIndex)
                 {
                     continue;
                 }
                 if (!query3.Current.FirstPoint)
                 {
                     continue;
                 }
                 num++;
             }
             MyVector3Grid <OuterEdgePoint> .SphereQuery query4 = this.m_outerEdgePoints.QueryPointsSphere(ref posv1, OUTER_EDGE_EPSILON);
             while (true)
             {
                 if (query4.MoveNext())
                 {
                     if (query4.Current.EdgeIndex != edgeIndex)
                     {
                         continue;
                     }
                     if (query4.Current.FirstPoint)
                     {
                         continue;
                     }
                     num++;
                 }
                 if (num != 2)
                 {
                     edgeIndex = -1;
                     break;
                 }
                 this.m_outerEdgePoints.RemoveTwo(ref query3, ref query4);
                 return(true);
             }
             break;
         }
     }
     return(false);
 }