예제 #1
0
        /// <summary>
        /// Removes redundant points.  Two points are redundant if they occupy the same hash grid cell.
        /// </summary>
        /// <param name="points">List of points to prune.</param>
        /// <param name="cellSize">Size of cells to determine redundancy.</param>
        public static void RemoveRedundantPoints(RawList <Vector3> points, double cellSize)
        {
            var set = BlockedCellSets.Take();

            for (int i = points.Count - 1; i >= 0; --i)
            {
                var element = points.Elements[i];
                var cell    = new BlockedCell
                {
                    X = (int)Math.Floor(element.X / cellSize),
                    Y = (int)Math.Floor(element.Y / cellSize),
                    Z = (int)Math.Floor(element.Z / cellSize)
                };
                if (set.Contains(cell))
                {
                    points.FastRemoveAt(i);
                }
                else
                {
                    set.Add(cell);
                    //TODO: Consider adding adjacent cells to guarantee that a point on the border between two cells will still detect the presence
                    //of a point on the opposite side of that border.
                }
            }
            set.Clear();
            BlockedCellSets.GiveBack(set);
        }
 protected override void GiveBackTester(TrianglePairTester tester)
 {
     testerPool.GiveBack((TriangleConvexPairTester)tester);
 }
예제 #3
0
 private void ReturnPair(GeneralConvexPairTester pair)
 {
     pair.CleanUp();
     testerPool.GiveBack(pair);
 }
예제 #4
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="list">List to return.</param>
 public static void GiveBack(RawList <Collidable> list)
 {
     list.Clear();
     SubPoolCollidableList.GiveBack(list);
 }
예제 #5
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="list">List to return.</param>
 public static void GiveBack(RawList <RayCastResult> list)
 {
     list.Clear();
     SubPoolRayCastResultList.GiveBack(list);
 }
예제 #6
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="list">List to return.</param>
 public static void GiveBack(RawList <BroadPhaseEntry> list)
 {
     list.Clear();
     SubPoolBroadPhaseEntryList.GiveBack(list);
 }
예제 #7
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="triangle">Triangle collidable to return.</param>
 public static void GiveBack(TriangleCollidable triangle)
 {
     triangle.CleanUp();
     SubPoolTriangleCollidables.GiveBack(triangle);
 }
예제 #8
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="connection">Connection to return.</param>
 public static void GiveBack(SimulationIslandConnection connection)
 {
     connection.CleanUp();
     SimulationIslandConnections.GiveBack(connection);
 }
예제 #9
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="list">List to return.</param>
 public static void GiveBack(RawList <Entity> list)
 {
     list.Clear();
     SubPoolEntityRawList.GiveBack(list);
 }
예제 #10
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="list">List to return.</param>
 public static void GiveBack(RawList <CompoundChild> list)
 {
     list.Clear();
     SubPoolCompoundChildList.GiveBack(list);
 }
 private void ReturnPair(GeneralConvexPairTester pair)
 {
     boxCollidablePool.GiveBack((ReusableBoxCollidable)pair.CollidableB);
     pair.CleanUp();
     testerPool.GiveBack(pair);
 }
예제 #12
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="triangleIndices">TriangleIndices list to return.</param>
 public static void GiveBack(RawList <TriangleMeshConvexContactManifold.TriangleIndices> triangleIndices)
 {
     triangleIndices.Clear();
     SubPoolTriangleIndicesList.GiveBack(triangleIndices);
 }
예제 #13
0
 /// <summary>
 /// Returns a resource to the pool.
 /// </summary>
 /// <param name="triangle">Triangle to return.</param>
 public static void GiveBack(TriangleShape triangle)
 {
     triangle.collisionMargin = 0;
     triangle.sidedness       = TriangleSidedness.DoubleSided;
     SubPoolTriangleShape.GiveBack(triangle);
 }