From 7358bc0b2423f6c748c708ae6786ad1b78d4efea Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 21 Jul 2020 13:11:50 -0400 Subject: [PATCH] add a fudge to side length --- Shared/TreeScene.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Shared/TreeScene.cs b/Shared/TreeScene.cs index c9f6934..787f594 100644 --- a/Shared/TreeScene.cs +++ b/Shared/TreeScene.cs @@ -121,6 +121,7 @@ namespace SemiColinGames { // We want a trapezoid with 4 points. A is the in position, B is the out position. // The TreeNode.Length is the distance from A to B. + // // We come up with the points relative to A being the origin, then rotate the trapezoid // by its orientation, and translate the result to A's actual position. // @@ -129,11 +130,15 @@ namespace SemiColinGames { // / | \ // 1------A------2 <-- length = inWidth + // This fudge factor lengthens the sides a bit longer to prevent small discontinuities + // in the rendered result. + // TODO: remove this sideLengthFudge. + float sideLengthFudge = 1.05f; Trapezoid t = new Trapezoid(); t.p1 = new Vector2(-parent.InWidth, 0); t.p2 = new Vector2(parent.InWidth, 0); - t.p3 = new Vector2(-parent.OutWidth, parent.Length); - t.p4 = new Vector2(parent.OutWidth, parent.Length); + t.p3 = new Vector2(-parent.OutWidth, parent.Length * sideLengthFudge); + t.p4 = new Vector2(parent.OutWidth, parent.Length * sideLengthFudge); t.Rotate(parent.Orientation); t.Translate(parent.Position);