/// <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); }
private void ReturnPair(GeneralConvexPairTester pair) { pair.CleanUp(); testerPool.GiveBack(pair); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }