added recursive function
This commit is contained in:
parent
55e38d49f4
commit
f316a9b3ec
1 changed files with 20 additions and 2 deletions
|
|
@ -23,13 +23,31 @@ public static class PinwheelTilingPath
|
|||
|
||||
const double sideA = 40.0D;
|
||||
const double sideB = 80.0D;
|
||||
double sideC = CalculateHyptonuse(sideA, sideB);
|
||||
const int depth = 1;
|
||||
|
||||
_endPoint = new Point(_startPoint.X + sideB, _startPoint.Y + sideA);
|
||||
Triangle triangle = MakeTriangle(_startPoint, _endPoint);
|
||||
Triangle[] subdivision = GetSubdivision(triangle);
|
||||
/*Triangle[] subdivision = GetSubdivision(triangle);
|
||||
DrawSubdivision(turtle, subdivision);*/
|
||||
|
||||
MakeRecursiveTriangle(turtle, triangle, depth);
|
||||
}
|
||||
|
||||
private static void MakeRecursiveTriangle(SmartTurtle turtle, Triangle triangle, int depth = 0)
|
||||
{
|
||||
if (depth == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
depth--;
|
||||
Triangle[] subdivision = GetSubdivision(triangle);
|
||||
DrawSubdivision(turtle, subdivision);
|
||||
|
||||
for (int i = 0; i < subdivision.Length; i++)
|
||||
{
|
||||
MakeRecursiveTriangle(turtle, subdivision[i], depth);
|
||||
}
|
||||
}
|
||||
|
||||
private static Triangle MakeTriangle(Point startingPoint,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue