Skip to content

Commit

Permalink
Expose getFirstParent() as GetParent()
Browse files Browse the repository at this point in the history
  • Loading branch information
Majiir committed Sep 2, 2014
1 parent dba22af commit dce52c6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Plugin/GeodesicGrid/Cell.cs
Expand Up @@ -99,7 +99,7 @@ public Vector3 Position
for (uint j = 0; j < cache.Length; j++)
{
var cell = new Cell(count + j);
cache[j] = (cell.getFirstParent().Position + cell.getSecondParent().Position).normalized;
cache[j] = (cell.GetParent().Position + cell.getSecondParent().Position).normalized;
}

positionCache.Add(cache);
Expand Down Expand Up @@ -210,7 +210,7 @@ public Triangle GetParent(int level)
var cell = this.getRoot();
while (level < cell.Level)
{
cell = cell.getFirstParent();
cell = cell.GetParent();
}
return new Triangle(cell, this.getDirection());
}
Expand Down Expand Up @@ -488,7 +488,7 @@ private bool isPolar
get { return index < 2; }
}

private Cell getFirstParent()
public Cell GetParent()
{
if (Level == 0) { throw new InvalidOperationException("Cannot find parent of a top-level cell"); }
return new Cell(subindex / 3 + 2);
Expand All @@ -497,7 +497,7 @@ private Cell getFirstParent()
private Cell getSecondParent()
{
if (Level == 0) { throw new InvalidOperationException("Cannot find parent of a top-level cell"); }
return getFirstParent().getNeighbor(this.direction, Level - 1);
return GetParent().getNeighbor(this.direction, Level - 1);
}

private Cell getChild(ChildType direction)
Expand Down Expand Up @@ -575,7 +575,7 @@ private Cell getNeighbor(ChildType direction, int level)
var dir = (ChildType)k;

var thisDir = cell.direction;
var first = cell.getFirstParent();
var first = cell.GetParent();
if (thisDir == dir)
{
cache[j, k] = first.getNeighbor(dir, cacheLevel - 1);
Expand Down Expand Up @@ -617,7 +617,7 @@ private Cell getRoot()
var cell = this;
while (!cell.IsPentagon)
{
cell = cell.getFirstParent();
cell = cell.GetParent();
}
return cell;
}
Expand Down Expand Up @@ -650,7 +650,7 @@ private Cell getBackNeighbor(ChildType direction, int level)
{
var thisDir = this.direction;

var first = this.getFirstParent();
var first = this.GetParent();
if (level != thisLevel)
{
first = first.getChild(thisDir, thisLevel + 1).approach(thisDir, level - thisLevel - 1);
Expand All @@ -666,7 +666,7 @@ private Cell getBackNeighbor(ChildType direction, int level)
}
else
{
first = this.getFirstParent();
first = this.GetParent();

var other = thisDir.Flip();
var seam = this.isPolarSeam();
Expand Down Expand Up @@ -696,11 +696,11 @@ private bool isPolarSeam()
if (this.IsPentagon) { return this.isPolar; }

var dir = this.direction;
var cell = this.getFirstParent();
var cell = this.GetParent();
while (!cell.IsPentagon)
{
if (cell.direction != dir) { return false; }
cell = cell.getFirstParent();
cell = cell.GetParent();
}
return cell.getNeighbor(dir, 0).isPolar;
}
Expand Down

0 comments on commit dce52c6

Please sign in to comment.