public void Add(FaceConnector element) { if (this.last != null) { this.last.Next = element; } element.Previous = this.last; this.last = element; this.first ??= element; }
public FaceConnector GetConnector() { if (ConnectorStack == null) { return(new FaceConnector(Dimension)); } FaceConnector connectorStack = ConnectorStack; ConnectorStack = ConnectorStack.Next; connectorStack.Next = null; return(connectorStack); }
public FaceConnector GetConnector() { if (this.ConnectorStack == null) { return(new FaceConnector(this.Dimension)); } FaceConnector connectorStack = this.ConnectorStack; this.ConnectorStack = this.ConnectorStack.Next; connectorStack.Next = null; return(connectorStack); }
private void CommitCone() { for (int i = 0; i < ConeFaceBuffer.Count; i++) { DeferredFace deferredFace = ConeFaceBuffer[i]; ConvexFaceInternal face = deferredFace.Face; ConvexFaceInternal pivot = deferredFace.Pivot; ConvexFaceInternal oldFace = deferredFace.OldFace; int faceIndex = deferredFace.FaceIndex; face.AdjacentFaces[faceIndex] = pivot.Index; pivot.AdjacentFaces[deferredFace.PivotIndex] = face.Index; for (int j = 0; j < NumOfDimensions; j++) { if (j != faceIndex) { FaceConnector connector = ObjectManager.GetConnector(); connector.Update(face, j, NumOfDimensions); ConnectFace(connector); } } if (pivot.VerticesBeyond.Count == 0) { FindBeyondVertices(face, oldFace.VerticesBeyond); } else if (pivot.VerticesBeyond.Count < oldFace.VerticesBeyond.Count) { FindBeyondVertices(face, pivot.VerticesBeyond, oldFace.VerticesBeyond); } else { FindBeyondVertices(face, oldFace.VerticesBeyond, pivot.VerticesBeyond); } if (face.VerticesBeyond.Count == 0) { ConvexFaces.Add(face.Index); UnprocessedFaces.Remove(face); ObjectManager.DepositVertexBuffer(face.VerticesBeyond); face.VerticesBeyond = EmptyBuffer; } else { UnprocessedFaces.Add(face); } ObjectManager.DepositDeferredFace(deferredFace); } for (int k = 0; k < AffectedFaceBuffer.Count; k++) { int num = AffectedFaceBuffer[k]; UnprocessedFaces.Remove(FacePool[num]); ObjectManager.DepositFace(num); } }
/// <summary> /// Store a face connector in the "embedded" linked list. /// </summary> /// <param name="connector"></param> public void DepositConnector(FaceConnector connector) { if (ConnectorStack == null) { connector.Next = null; ConnectorStack = connector; } else { connector.Next = ConnectorStack; ConnectorStack = connector; } }
/// <summary> /// Adds a face to the list. /// </summary> /// <param name="element"></param> public void Add(FaceConnector element) { if (this.last != null) { this.last.Next = element; } element.Previous = this.last; this.last = element; if (this.first == null) { this.first = element; } }
/// <summary> /// Adds a face to the list. /// </summary> /// <param name="element">The element.</param> public void Add(FaceConnector element) { if (last != null) { last.Next = element; } element.Previous = last; last = element; if (First == null) { First = element; } }
/// <summary> /// Store a face connector in the "embedded" linked list. /// </summary> /// <param name="connector">The connector.</param> public void DepositConnector(FaceConnector connector) { if (ConnectorStack == null) { connector.Next = null; ConnectorStack = connector; } else { connector.Next = ConnectorStack; ConnectorStack = connector; } }
/// <summary> /// Get an unused face connector. If none is available, create it. /// </summary> /// <returns>FaceConnector.</returns> public FaceConnector GetConnector() { if (ConnectorStack == null) { return(new FaceConnector(Dimension)); } var ret = ConnectorStack; ConnectorStack = ConnectorStack.Next; ret.Next = null; return(ret); }
public void DepositConnector(FaceConnector connector) { if (this.ConnectorStack == null) { connector.Next = null; this.ConnectorStack = connector; } else { connector.Next = this.ConnectorStack; this.ConnectorStack = connector; } }
public static bool AreConnectable(FaceConnector a, FaceConnector b, int dim) { if (a.HashCode != b.HashCode) { return(false); } int[] vertices = a.Vertices; int[] numArray2 = b.Vertices; for (int i = 0; i < vertices.Length; i++) { if (vertices[i] != numArray2[i]) { return(false); } } return(true); }
/// <summary> /// Can two faces be connected. /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public static bool AreConnectable(FaceConnector a, FaceConnector b) { if (a.HashCode != b.HashCode) { return(false); } var av = a.Vertices; var bv = b.Vertices; for (int i = 0; i < av.Length; i++) { if (av[i] != bv[i]) { return(false); } } return(true); }
private void ConnectFace(FaceConnector connector) { uint num = connector.HashCode % 2017u; ConnectorList connectorList = ConnectorTable[num]; for (FaceConnector faceConnector = connectorList.First; faceConnector != null; faceConnector = faceConnector.Next) { if (FaceConnector.AreConnectable(connector, faceConnector, NumOfDimensions)) { connectorList.Remove(faceConnector); FaceConnector.Connect(faceConnector, connector); faceConnector.Face = null; connector.Face = null; ObjectManager.DepositConnector(faceConnector); ObjectManager.DepositConnector(connector); return; } } connectorList.Add(connector); }
private void ConnectFace(FaceConnector connector) { uint index = connector.HashCode % 0x7e1; ConnectorList list = this.ConnectorTable[index]; for (FaceConnector connector2 = list.First; connector2 != null; connector2 = connector2.Next) { if (FaceConnector.AreConnectable(connector, connector2, this.Dimension)) { list.Remove(connector2); FaceConnector.Connect(connector2, connector); connector2.Face = null; connector.Face = null; this.ObjectManager.DepositConnector(connector2); this.ObjectManager.DepositConnector(connector); return; } } list.Add(connector); }
/// <summary> /// Connect faces using a connector. /// </summary> /// <param name="connector">The connector.</param> private void ConnectFace(FaceConnector connector) { var index = connector.HashCode % Constants.ConnectorTableSize; var list = ConnectorTable[index]; for (var current = list.First; current != null; current = current.Next) { if (FaceConnector.AreConnectable(connector, current, NumOfDimensions)) { list.Remove(current); FaceConnector.Connect(current, connector); current.Face = null; connector.Face = null; ObjectManager.DepositConnector(current); ObjectManager.DepositConnector(connector); return; } } list.Add(connector); }
/// <summary> /// Connect faces using a connector. /// </summary> /// <param name="connector"></param> void ConnectFace(FaceConnector connector) { var index = connector.HashCode % ConnectorTableSize; var list = ConnectorTable[index]; for (var current = list.First; current != null; current = current.Next) { if (FaceConnector.AreConnectable(connector, current, Dimension)) { list.Remove(current); FaceConnector.Connect(current, connector); current.Face = null; connector.Face = null; ConnectorStack.Push(current); ConnectorStack.Push(connector); return; } } list.Add(connector); }
public void Remove(FaceConnector connector) { if (connector.Previous != null) { connector.Previous.Next = connector.Next; } else if (connector.Previous == null) { this.first = connector.Next; } if (connector.Next != null) { connector.Next.Previous = connector.Previous; } else if (connector.Next == null) { this.last = connector.Previous; } connector.Next = null; connector.Previous = null; }
/// <summary> /// Removes the element from the list. /// </summary> /// <param name="connector"></param> public void Remove(FaceConnector connector) { if (connector.Previous != null) { connector.Previous.Next = connector.Next; } else if (/*first == face*/ connector.Previous == null) { this.first = connector.Next; } if (connector.Next != null) { connector.Next.Previous = connector.Previous; } else if (/*last == face*/ connector.Next == null) { this.last = connector.Previous; } connector.Next = null; connector.Previous = null; }
/// <summary> /// Removes the element from the list. /// </summary> /// <param name="connector">The connector.</param> public void Remove(FaceConnector connector) { if (connector.Previous != null) { connector.Previous.Next = connector.Next; } else if (/*first == face*/ connector.Previous == null) { First = connector.Next; } if (connector.Next != null) { connector.Next.Previous = connector.Previous; } else if (/*last == face*/ connector.Next == null) { last = connector.Previous; } connector.Next = null; connector.Previous = null; }
/// <summary> /// Can two faces be connected. /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="dim"></param> /// <returns></returns> public static bool AreConnectable(FaceConnector a, FaceConnector b, int dim) { if (a.HashCode != b.HashCode) return false; var n = dim - 1; var av = a.Vertices; var bv = b.Vertices; for (int i = 0; i < av.Length; i++) { if (av[i] != bv[i]) return false; } return true; }
public void DepositConnector(FaceConnector connector) { ConnectorStack.Push(connector); }
/// <summary> /// Adds the element to the beginning. /// </summary> /// <param name="connector"></param> void AddFirst(FaceConnector connector) { this.first.Previous = connector; connector.Next = this.first; this.first = connector; }
/// <summary> /// Adds the element to the beginning. /// </summary> /// <param name="connector">The connector.</param> private void AddFirst(FaceConnector connector) { First.Previous = connector; connector.Next = First; First = connector; }
/// <summary> /// Connect two faces. /// </summary> /// <param name="a"></param> /// <param name="b"></param> public static void Connect(FaceConnector a, FaceConnector b) { a.Face.AdjacentFaces[a.EdgeIndex] = b.Face.Index; b.Face.AdjacentFaces[b.EdgeIndex] = a.Face.Index; }
private void CommitCone() { int num = 0; while (num < this.ConeFaceBuffer.Count) { DeferredFace face = this.ConeFaceBuffer[num]; ConvexFaceInternal internal2 = face.Face; ConvexFaceInternal pivot = face.Pivot; ConvexFaceInternal oldFace = face.OldFace; int faceIndex = face.FaceIndex; internal2.AdjacentFaces[faceIndex] = pivot.Index; pivot.AdjacentFaces[face.PivotIndex] = internal2.Index; int edgeIndex = 0; while (true) { if (edgeIndex >= this.Dimension) { if (pivot.VerticesBeyond.Count == 0) { this.FindBeyondVertices(internal2, oldFace.VerticesBeyond); } else if (pivot.VerticesBeyond.Count < oldFace.VerticesBeyond.Count) { this.FindBeyondVertices(internal2, pivot.VerticesBeyond, oldFace.VerticesBeyond); } else { this.FindBeyondVertices(internal2, oldFace.VerticesBeyond, pivot.VerticesBeyond); } if (internal2.VerticesBeyond.Count != 0) { this.UnprocessedFaces.Add(internal2); } else { this.ConvexFaces.Add(internal2.Index); this.UnprocessedFaces.Remove(internal2); this.ObjectManager.DepositVertexBuffer(internal2.VerticesBeyond); internal2.VerticesBeyond = this.EmptyBuffer; } this.ObjectManager.DepositDeferredFace(face); num++; break; } if (edgeIndex != faceIndex) { FaceConnector connector = this.ObjectManager.GetConnector(); connector.Update(internal2, edgeIndex, this.Dimension); this.ConnectFace(connector); } edgeIndex++; } } for (int i = 0; i < this.AffectedFaceBuffer.Count; i++) { int index = this.AffectedFaceBuffer[i]; this.UnprocessedFaces.Remove(this.FacePool[index]); this.ObjectManager.DepositFace(index); } }
/// <summary> /// Connect two faces. /// </summary> /// <param name="a"></param> /// <param name="b"></param> public static void Connect(FaceConnector a, FaceConnector b) { a.Face.AdjacentFaces[a.EdgeIndex] = b.Face; b.Face.AdjacentFaces[b.EdgeIndex] = a.Face; }
/// <summary> /// Get an unused face connector. If none is available, create it. /// </summary> /// <returns></returns> public FaceConnector GetConnector() { if (ConnectorStack == null) return new FaceConnector(Dimension); var ret = ConnectorStack; ConnectorStack = ConnectorStack.Next; ret.Next = null; return ret; }