-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transitioned to FastLinkedList for core BSP operations.
- Loading branch information
Showing
11 changed files
with
190 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
namespace CSG | ||
{ | ||
public class FastLinkedList<T> | ||
{ | ||
private Node _First; | ||
private Node _Last; | ||
|
||
public Node First | ||
{ | ||
get { return _First;} | ||
} | ||
|
||
public Node Last | ||
{ | ||
get { return _Last;} | ||
} | ||
|
||
public FastLinkedList() | ||
{ | ||
_First = null; | ||
_Last = null; | ||
} | ||
|
||
public Node AddLast(T value) | ||
{ | ||
Node newNode = new Node(value); | ||
|
||
if(_First == null) | ||
{ | ||
_First = _Last = newNode; | ||
} | ||
else | ||
{ | ||
_Last.Next = newNode; | ||
newNode.Previous = _Last; | ||
_Last = newNode; | ||
} | ||
|
||
return newNode; | ||
} | ||
|
||
public void AppendList(FastLinkedList<T> list) | ||
{ | ||
if(list == null)return; | ||
if(list._First == null)return; | ||
|
||
if(_First == null) | ||
{ | ||
_First = list._First; | ||
_Last = list._Last; | ||
} | ||
else | ||
{ | ||
Node temp = _Last; | ||
_Last.Next = list._First; | ||
_Last.Next.Previous = _Last; | ||
_Last = list._Last; | ||
if(_Last.Previous == null)_Last.Previous = temp; | ||
} | ||
} | ||
|
||
public void Clear() | ||
{ | ||
_First = null; | ||
_Last = null; | ||
} | ||
|
||
public class Node | ||
{ | ||
public T Value; | ||
public Node Next; | ||
public Node Previous; | ||
|
||
public Node(T value) | ||
{ | ||
Value = value; | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Unity/Assets/CSG-BSP/Scripts/Structure/FastLinkedList.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters