2021-05-11 06:26:18 -04:00
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
<script src="N.js"></script>
|
|
|
|
<script src="Pivot.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<script>
|
2021-05-29 11:33:14 -04:00
|
|
|
let root = N.Create("root");
|
2021-05-29 12:28:46 -04:00
|
|
|
var context = {};
|
2021-05-29 11:33:14 -04:00
|
|
|
let recurse = (node, depth) =>
|
|
|
|
{
|
|
|
|
// create a set of new nodes off of the input node
|
2021-05-29 12:28:46 -04:00
|
|
|
let c1 = N.Create(node.Meta+"-c1");
|
|
|
|
let c2 = N.Create(node.Meta+"-c2");
|
2021-05-29 11:33:14 -04:00
|
|
|
N.Connect(node, c1, "parent");
|
|
|
|
N.Connect(node, c2, "parent");
|
|
|
|
|
|
|
|
var iterator;
|
2021-05-29 12:28:46 -04:00
|
|
|
if(depth < 1)
|
2021-05-29 11:33:14 -04:00
|
|
|
{
|
2021-05-29 12:28:46 -04:00
|
|
|
N.Walk((child) =>
|
2021-05-29 11:33:14 -04:00
|
|
|
{
|
2021-05-29 12:28:46 -04:00
|
|
|
console.log(`subdividing ${child.Meta}`);
|
|
|
|
context = [child, depth+1];
|
2021-05-29 11:33:14 -04:00
|
|
|
recurse(child, depth+1);
|
2021-05-29 12:28:46 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
, node, "parent");
|
2021-05-29 11:33:14 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-29 12:28:46 -04:00
|
|
|
|
|
|
|
N.Walk((child) =>
|
2021-05-29 11:33:14 -04:00
|
|
|
{
|
2021-05-29 11:58:03 -04:00
|
|
|
/*
|
|
|
|
issue: why does incrementing walk id cause an infinite loop
|
|
|
|
*/
|
|
|
|
N.ID.Walk++;
|
2021-05-29 12:28:46 -04:00
|
|
|
console.log(`changing walk ID ${child.Meta}`);
|
|
|
|
if(N.ID.Walk > 20)
|
2021-05-29 11:58:03 -04:00
|
|
|
{
|
|
|
|
console.log("big problems");
|
|
|
|
throw new Error("holy crap");
|
|
|
|
}
|
2021-05-29 12:28:46 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
, node, "parent");
|
2021-05-29 11:33:14 -04:00
|
|
|
}
|
|
|
|
}
|
2021-05-29 11:58:03 -04:00
|
|
|
N.ID.Walk++;
|
2021-05-29 12:28:46 -04:00
|
|
|
context = [root, 0];
|
2021-05-29 11:33:14 -04:00
|
|
|
recurse(root, 0);
|
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
</script>
|
2021-05-29 11:33:14 -04:00
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
</body>
|
2021-05-28 19:11:15 -04:00
|
|
|
|
2021-05-29 11:20:11 -04:00
|
|
|
</html>
|