diff --git a/BepuPhysics/Collidables/ConvexHullHelper.cs b/BepuPhysics/Collidables/ConvexHullHelper.cs index e29bb961..6831ab14 100644 --- a/BepuPhysics/Collidables/ConvexHullHelper.cs +++ b/BepuPhysics/Collidables/ConvexHullHelper.cs @@ -592,70 +592,70 @@ static void AddIfNotPresent(ref QuickList list, int value, BufferPool pool) list.Allocate(pool) = value; } - public struct DebugStep - { - public EdgeEndpoints SourceEdge; - public List Raw; - public List Reduced; - public bool[] AllowVertex; - public Vector3 FaceNormal; - public Vector3 BasisX; - public Vector3 BasisY; - public List FaceStarts; - public List FaceIndices; - public bool[] FaceDeleted; - public int[] MergedFaceIndices; - public int FaceIndex; - public Vector3[] FaceNormals; - - internal DebugStep(EdgeEndpoints sourceEdge, ref QuickList raw, Vector3 faceNormal, Vector3 basisX, Vector3 basisY, ref QuickList reduced, ref Buffer allowVertex, ref QuickList faces, Span mergedFaceIndices, int faceIndex) - { - SourceEdge = sourceEdge; - FaceNormal = faceNormal; - BasisX = basisX; - BasisY = basisY; - Raw = new List(); - for (int i = 0; i < raw.Count; ++i) - { - Raw.Add(raw[i]); - } - Reduced = new List(); - for (int i = 0; i < reduced.Count; ++i) - { - Reduced.Add(reduced[i]); - } - AllowVertex = new bool[allowVertex.Length]; - for (int i = 0; i < allowVertex.Length; ++i) - { - AllowVertex[i] = allowVertex[i] != 0; - } - FaceStarts = new List(faces.Count); - FaceIndices = new List(); - FaceDeleted = new bool[faces.Count]; - FaceNormals = new Vector3[faces.Count]; - for (int i = 0; i < faces.Count; ++i) - { - ref var face = ref faces[i]; - FaceStarts.Add(FaceIndices.Count); - for (int j = 0; j < face.VertexIndices.Count; ++j) - FaceIndices.Add(face.VertexIndices[j]); - FaceDeleted[i] = face.Deleted; - FaceNormals[i] = face.Normal; - } - MergedFaceIndices = mergedFaceIndices.ToArray(); - FaceIndex = faceIndex; - } - } - /// - /// Computes the convex hull of a set of points. - /// - /// Point set to compute the convex hull of. - /// Buffer pool to pull memory from when creating the hull. - /// Convex hull of the input point set. - public static void ComputeHull(Span points, BufferPool pool, out HullData hullData) - { - ComputeHull(points, pool, out hullData, out _); - } + //public struct DebugStep + //{ + // public EdgeEndpoints SourceEdge; + // public List Raw; + // public List Reduced; + // public bool[] AllowVertex; + // public Vector3 FaceNormal; + // public Vector3 BasisX; + // public Vector3 BasisY; + // public List FaceStarts; + // public List FaceIndices; + // public bool[] FaceDeleted; + // public int[] MergedFaceIndices; + // public int FaceIndex; + // public Vector3[] FaceNormals; + + // internal DebugStep(EdgeEndpoints sourceEdge, ref QuickList raw, Vector3 faceNormal, Vector3 basisX, Vector3 basisY, ref QuickList reduced, ref Buffer allowVertex, ref QuickList faces, Span mergedFaceIndices, int faceIndex) + // { + // SourceEdge = sourceEdge; + // FaceNormal = faceNormal; + // BasisX = basisX; + // BasisY = basisY; + // Raw = new List(); + // for (int i = 0; i < raw.Count; ++i) + // { + // Raw.Add(raw[i]); + // } + // Reduced = new List(); + // for (int i = 0; i < reduced.Count; ++i) + // { + // Reduced.Add(reduced[i]); + // } + // AllowVertex = new bool[allowVertex.Length]; + // for (int i = 0; i < allowVertex.Length; ++i) + // { + // AllowVertex[i] = allowVertex[i] != 0; + // } + // FaceStarts = new List(faces.Count); + // FaceIndices = new List(); + // FaceDeleted = new bool[faces.Count]; + // FaceNormals = new Vector3[faces.Count]; + // for (int i = 0; i < faces.Count; ++i) + // { + // ref var face = ref faces[i]; + // FaceStarts.Add(FaceIndices.Count); + // for (int j = 0; j < face.VertexIndices.Count; ++j) + // FaceIndices.Add(face.VertexIndices[j]); + // FaceDeleted[i] = face.Deleted; + // FaceNormals[i] = face.Normal; + // } + // MergedFaceIndices = mergedFaceIndices.ToArray(); + // FaceIndex = faceIndex; + // } + //} + ///// + ///// Computes the convex hull of a set of points. + ///// + ///// Point set to compute the convex hull of. + ///// Buffer pool to pull memory from when creating the hull. + ///// Convex hull of the input point set. + //public static void ComputeHull(Span points, BufferPool pool, out HullData hullData) + //{ + // ComputeHull(points, pool, out hullData, out _); + //} /// @@ -664,9 +664,9 @@ public static void ComputeHull(Span points, BufferPool pool, out HullDa /// Point set to compute the convex hull of. /// Buffer pool to pull memory from when creating the hull. /// Convex hull of the input point set. - public static void ComputeHull(Span points, BufferPool pool, out HullData hullData, out List steps) + public static void ComputeHull(Span points, BufferPool pool, out HullData hullData)//, out List steps) { - steps = new List(); + //steps = new List(); if (points.Length <= 0) { hullData = default; @@ -825,7 +825,7 @@ public static void ComputeHull(Span points, BufferPool pool, out HullDa } Vector3Wide.ReadFirst(initialBasisX, out var debugInitialBasisX); Vector3Wide.ReadFirst(initialBasisY, out var debugInitialBasisY); - steps.Add(new DebugStep(initialSourceEdge, ref rawFaceVertexIndices, initialFaceNormal, debugInitialBasisX, debugInitialBasisY, ref reducedFaceIndices, ref allowVertices, ref faces, default, reducedFaceIndices.Count >= 3 ? 0 : -1)); + //steps.Add(new DebugStep(initialSourceEdge, ref rawFaceVertexIndices, initialFaceNormal, debugInitialBasisX, debugInitialBasisY, ref reducedFaceIndices, ref allowVertices, ref faces, default, reducedFaceIndices.Count >= 3 ? 0 : -1)); int facesDeletedCount = 0; @@ -858,7 +858,7 @@ public static void ComputeHull(Span points, BufferPool pool, out HullDa if (reducedFaceIndices.Count < 3) { - steps.Add(new DebugStep(edgeToTest.Endpoints, ref rawFaceVertexIndices, faceNormal, basisX, basisY, ref reducedFaceIndices, ref allowVertices, ref faces, default, -1)); + //steps.Add(new DebugStep(edgeToTest.Endpoints, ref rawFaceVertexIndices, faceNormal, basisX, basisY, ref reducedFaceIndices, ref allowVertices, ref faces, default, -1)); //Degenerate face found; don't bother creating work for it. continue; } @@ -984,7 +984,7 @@ public static void ComputeHull(Span points, BufferPool pool, out HullDa AddFace(ref faces, pool, faceNormal, reducedFaceIndices); AddFaceToEdgesAndTestList(pool, ref reducedFaceIndices, ref edgesToTest, ref facesForEdges, faceNormal, faceCountPriorToAdd); - steps.Add(new DebugStep(edgeToTest.Endpoints, ref rawFaceVertexIndices, faceNormal, basisX, basisY, ref reducedFaceIndices, ref allowVertices, ref faces, facesNeedingMerge, faceCountPriorToAdd)); + //steps.Add(new DebugStep(edgeToTest.Endpoints, ref rawFaceVertexIndices, faceNormal, basisX, basisY, ref reducedFaceIndices, ref allowVertices, ref faces, facesNeedingMerge, faceCountPriorToAdd)); break; } }