コード例 #1
0
 internal Raster(Chassis chassis, Func <float, float> Hermite)
 {
     this.Hermite = Hermite;
     foreach (Bezite bridge in chassis.bridges)
     {
         bezite = bridge;
         new Linker <Vector3Int>(InitBridgeNode, Eval);
     }
     foreach (HashSet <Bezite> branchSet in chassis.branchSets)
     {
         foreach (Bezite branch in branchSet)
         {
             bezite = branch;
             new Linker <Vector3Int>(InitPathNode, Eval);
         }
     }
     while (!oldPositions.SetEquals(positions))
     {
         oldPositions = new HashSet <Vector2Int>(positions);
         positions.Clear();
         foreach (Vector2Int tile in oldPositions)
         {
             Smooth(tile);
         }
     }
 }
コード例 #2
0
 void Eval(float angle)
 {
     foreach (HullNode node in graph.nodes)
     {
         if (angle <= node.Arc)
         {
             angle += node.linkAngle;
             Vector2 end    = node.nextPivot + graph.radius.Rotate(angle);
             Bezite  bezite = Spawn(node.nextPivot, end);
             branchSets[graph.pivots.IndexOf(node.nextPivot)].Add(bezite);
             return;
         }
         else
         {
             angle -= node.Arc;
         }
     }
 }