|
@ -121,6 +121,7 @@ namespace SemiColinGames { |
|
|
|
|
|
|
|
|
// We want a trapezoid with 4 points. A is the in position, B is the out position.
|
|
|
// 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.
|
|
|
// 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
|
|
|
// 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.
|
|
|
// by its orientation, and translate the result to A's actual position.
|
|
|
//
|
|
|
//
|
|
@ -129,11 +130,15 @@ namespace SemiColinGames { |
|
|
// / | \
|
|
|
// / | \
|
|
|
// 1------A------2 <-- length = inWidth
|
|
|
// 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(); |
|
|
Trapezoid t = new Trapezoid(); |
|
|
t.p1 = new Vector2(-parent.InWidth, 0); |
|
|
t.p1 = new Vector2(-parent.InWidth, 0); |
|
|
t.p2 = 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.Rotate(parent.Orientation); |
|
|
t.Translate(parent.Position); |
|
|
t.Translate(parent.Position); |
|
|
|
|
|
|
|
|