Browse Source

add a fudge to side length

main
Colin McMillen 4 years ago
parent
commit
7358bc0b24
  1. 9
      Shared/TreeScene.cs

9
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);

Loading…
Cancel
Save