Exemple #1
0
        public static int BufferedPairSortPredicate(BufferedPair pair1, BufferedPair pair2)
        {
            int result;

            if (pair1.ProxyId1 > pair2.ProxyId1)
            {
                result = 1;
            }
            else
            {
                if (pair1.ProxyId1 < pair2.ProxyId1)
                {
                    result = -1;
                }
                else
                {
                    if (pair1.ProxyId2 > pair2.ProxyId2)
                    {
                        result = 1;
                    }
                    else
                    {
                        if (pair1.ProxyId2 < pair2.ProxyId2)
                        {
                            result = -1;
                        }
                        else
                        {
                            result = 0;
                        }
                    }
                }
            }
            return(result);
        }
Exemple #2
0
        private void ValidateBuffer()
        {
#if DEBUG
            Box2DXDebug.Assert(_pairBufferCount <= _pairCount);

            //std::sort(m_pairBuffer, m_pairBuffer + m_pairBufferCount);
            BufferedPair[] tmp = new BufferedPair[_pairBufferCount];
            Array.Copy(_pairBuffer, 0, tmp, 0, _pairBufferCount);
            Array.Sort <BufferedPair>(tmp, BufferedPairSortPredicate);
            Array.Copy(tmp, 0, _pairBuffer, 0, _pairBufferCount);

            for (int i = 0; i < _pairBufferCount; ++i)
            {
                if (i > 0)
                {
                    Box2DXDebug.Assert(Equals(_pairBuffer[i], _pairBuffer[i - 1]) == false);
                }

                Pair pair = Find(_pairBuffer[i].ProxyId1, _pairBuffer[i].ProxyId2);
                Box2DXDebug.Assert(pair.IsBuffered());

                Box2DXDebug.Assert(pair.ProxyId1 != pair.ProxyId2);
                Box2DXDebug.Assert(pair.ProxyId1 < Settings.MaxProxies);
                Box2DXDebug.Assert(pair.ProxyId2 < Settings.MaxProxies);

                Proxy proxy1 = _broadPhase._proxyPool[pair.ProxyId1];
                Proxy proxy2 = _broadPhase._proxyPool[pair.ProxyId2];

                Box2DXDebug.Assert(proxy1.IsValid == true);
                Box2DXDebug.Assert(proxy2.IsValid == true);
            }
#endif
        }
Exemple #3
0
 public static int BufferedPairSortPredicate(BufferedPair pair1, BufferedPair pair2)
 {
     int result;
     if (pair1.ProxyId1 > pair2.ProxyId1)
     {
         result = 1;
     }
     else
     {
         if (pair1.ProxyId1 < pair2.ProxyId1)
         {
             result = -1;
         }
         else
         {
             if (pair1.ProxyId2 > pair2.ProxyId2)
             {
                 result = 1;
             }
             else
             {
                 if (pair1.ProxyId2 < pair2.ProxyId2)
                 {
                     result = -1;
                 }
                 else
                 {
                     result = 0;
                 }
             }
         }
     }
     return result;
 }
Exemple #4
0
 private void ValidateBuffer()
 {
     Box2DXDebug.Assert(this._pairBufferCount <= this._pairCount);
     BufferedPair[] array = new BufferedPair[this._pairBufferCount];
     Array.Copy(this._pairBuffer, 0, array, 0, this._pairBufferCount);
     Array.Sort <BufferedPair>(array, new Comparison <BufferedPair>(PairManager.BufferedPairSortPredicate));
     Array.Copy(array, 0, this._pairBuffer, 0, this._pairBufferCount);
     for (int i = 0; i < this._pairBufferCount; i++)
     {
         if (i > 0)
         {
             Box2DXDebug.Assert(!object.Equals(this._pairBuffer[i], this._pairBuffer[i - 1]));
         }
         Pair pair = this.Find((int)this._pairBuffer[i].ProxyId1, (int)this._pairBuffer[i].ProxyId2);
         Box2DXDebug.Assert(pair.IsBuffered());
         Box2DXDebug.Assert(pair.ProxyId1 != pair.ProxyId2);
         Box2DXDebug.Assert((int)pair.ProxyId1 < Settings.MaxProxies);
         Box2DXDebug.Assert((int)pair.ProxyId2 < Settings.MaxProxies);
         Proxy proxy  = this._broadPhase._proxyPool[(int)pair.ProxyId1];
         Proxy proxy2 = this._broadPhase._proxyPool[(int)pair.ProxyId2];
         Box2DXDebug.Assert(proxy.IsValid);
         Box2DXDebug.Assert(proxy2.IsValid);
     }
 }
Exemple #5
0
        public static int BufferedPairSortPredicate(BufferedPair pair1, BufferedPair pair2)
        {
            if (pair1.ProxyId1 > pair2.ProxyId1)
            {
                return(1);
            }
            else if (pair1.ProxyId1 < pair2.ProxyId1)
            {
                return(-1);
            }
            else
            {
                if (pair1.ProxyId2 > pair2.ProxyId2)
                {
                    return(1);
                }
                else if (pair1.ProxyId2 < pair2.ProxyId2)
                {
                    return(-1);
                }
            }

            return(0);
        }
Exemple #6
0
 private bool Equals(ref BufferedPair pair1, ref BufferedPair pair2)
 {
     return(pair1.ProxyId1 == pair2.ProxyId1 && pair1.ProxyId2 == pair2.ProxyId2);
 }
		public static int BufferedPairSortPredicate(BufferedPair pair1, BufferedPair pair2)
		{
			if (pair1.ProxyId1 > pair2.ProxyId1)
				return 1;
			else if (pair1.ProxyId1 < pair2.ProxyId1)
				return -1;
			else
			{
				if (pair1.ProxyId2 > pair2.ProxyId2)
					return 1;
				else if (pair1.ProxyId2 < pair2.ProxyId2)
					return -1;
			}

			return 0;
		}
		private bool Equals(ref BufferedPair pair1, ref BufferedPair pair2)
		{
			return pair1.ProxyId1 == pair2.ProxyId1 && pair1.ProxyId2 == pair2.ProxyId2;
		}
		private void ValidateBuffer()
		{
#if DEBUG
			Box2DXDebug.Assert(_pairBufferCount <= _pairCount);

			//std::sort(m_pairBuffer, m_pairBuffer + m_pairBufferCount);
			BufferedPair[] tmp = new BufferedPair[_pairBufferCount];
			Array.Copy(_pairBuffer, 0, tmp, 0, _pairBufferCount);
			Array.Sort<BufferedPair>(tmp, BufferedPairSortPredicate);
			Array.Copy(tmp, 0, _pairBuffer, 0, _pairBufferCount);

			for (int i = 0; i < _pairBufferCount; ++i)
			{
				if (i > 0)
				{
					Box2DXDebug.Assert(Equals(_pairBuffer[i], _pairBuffer[i - 1]) == false);
				}

				Pair pair = Find(_pairBuffer[i].ProxyId1, _pairBuffer[i].ProxyId2);
				Box2DXDebug.Assert(pair.IsBuffered());

				Box2DXDebug.Assert(pair.ProxyId1 != pair.ProxyId2);
				Box2DXDebug.Assert(pair.ProxyId1 < Settings.MaxProxies);
				Box2DXDebug.Assert(pair.ProxyId2 < Settings.MaxProxies);

				Proxy proxy1 = _broadPhase._proxyPool[pair.ProxyId1];
				Proxy proxy2 = _broadPhase._proxyPool[pair.ProxyId2];

				Box2DXDebug.Assert(proxy1.IsValid == true);
				Box2DXDebug.Assert(proxy2.IsValid == true);
			}
#endif
		}
Exemple #10
0
 private void ValidateBuffer()
 {
     Box2DXDebug.Assert(this._pairBufferCount <= this._pairCount);
     BufferedPair[] array = new BufferedPair[this._pairBufferCount];
     Array.Copy(this._pairBuffer, 0, array, 0, this._pairBufferCount);
     Array.Sort<BufferedPair>(array, new Comparison<BufferedPair>(PairManager.BufferedPairSortPredicate));
     Array.Copy(array, 0, this._pairBuffer, 0, this._pairBufferCount);
     for (int i = 0; i < this._pairBufferCount; i++)
     {
         if (i > 0)
         {
             Box2DXDebug.Assert(!object.Equals(this._pairBuffer[i], this._pairBuffer[i - 1]));
         }
         Pair pair = this.Find((int)this._pairBuffer[i].ProxyId1, (int)this._pairBuffer[i].ProxyId2);
         Box2DXDebug.Assert(pair.IsBuffered());
         Box2DXDebug.Assert(pair.ProxyId1 != pair.ProxyId2);
         Box2DXDebug.Assert((int)pair.ProxyId1 < Settings.MaxProxies);
         Box2DXDebug.Assert((int)pair.ProxyId2 < Settings.MaxProxies);
         Proxy proxy = this._broadPhase._proxyPool[(int)pair.ProxyId1];
         Proxy proxy2 = this._broadPhase._proxyPool[(int)pair.ProxyId2];
         Box2DXDebug.Assert(proxy.IsValid);
         Box2DXDebug.Assert(proxy2.IsValid);
     }
 }