4d225c65f2
- Barotrauma's projects are in the Barotrauma directory - All libraries are in the Libraries directory - MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?) - NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred - Removed Content/effects.mgfx as it didn't seem to be used anywhere - Removed some references to Subsurface directory - Renamed Launcher2 to Launcher
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace FarseerPhysics.Common.Decomposition.Seidel
|
|
{
|
|
// Node for a Directed Acyclic graph (DAG)
|
|
internal abstract class Node
|
|
{
|
|
protected Node LeftChild;
|
|
public List<Node> ParentList;
|
|
protected Node RightChild;
|
|
|
|
protected Node(Node left, Node right)
|
|
{
|
|
ParentList = new List<Node>();
|
|
LeftChild = left;
|
|
RightChild = right;
|
|
|
|
if (left != null)
|
|
left.ParentList.Add(this);
|
|
if (right != null)
|
|
right.ParentList.Add(this);
|
|
}
|
|
|
|
public abstract Sink Locate(Edge s);
|
|
|
|
// Replace a node in the graph with this node
|
|
// Make sure parent pointers are updated
|
|
public void Replace(Node node)
|
|
{
|
|
foreach (Node parent in node.ParentList)
|
|
{
|
|
// Select the correct node to replace (left or right child)
|
|
if (parent.LeftChild == node)
|
|
parent.LeftChild = this;
|
|
else
|
|
parent.RightChild = this;
|
|
}
|
|
ParentList.AddRange(node.ParentList);
|
|
}
|
|
}
|
|
}
|