It works better, as expected.

Small changes, so the Triangle looks in the expected direction.
This commit is contained in:
MarcUs7i 2024-10-01 17:46:27 +02:00
parent facbfc3593
commit 32da01bf3b

View file

@ -49,7 +49,7 @@ public static class TurtlePath
{
DrawOctagon(turtle, 5, 5);
DrawRhombus(turtle, 20, 5);
DrawTriangle(turtle, 35, 5);
DrawTriangle(turtle, 40, 5);
}
/// <summary>
@ -100,7 +100,7 @@ public static class TurtlePath
const double ShortSide = 6.0D;
const double LongSide = 8.0D;
DrawTriangle(turtle, startX, startY, LongSide, ShortSide);
DrawTriangle(turtle, startX - Offset, startY - Offset*2, LongSide + Offset*(LongSide/2), ShortSide + Offset*(ShortSide/2));
DrawTriangle(turtle, startX + Offset, startY - Offset*2, LongSide + Offset*(LongSide/2), ShortSide + Offset*(ShortSide/2));
}
/// <summary>
@ -117,11 +117,11 @@ public static class TurtlePath
turtle.Teleport(startX, startY);
double angle = ConvertToDegrees(Math.Asin(shortSide / longSide)); // Corrected to arcsin
DrawLine(turtle, longSide, 180 - angle); // Long side
DrawLine(turtle, longSide, 180 + angle); // Long side
DrawLine(turtle, shortSide, 0);
turtle.Teleport(startX, startY);
turtle.Turn(angle);
turtle.Turn(-angle);
DrawLine(turtle, shortSide, 0);
}