/// <summary> /// a segment of one track /// </summary> /// <param name="previousTrackSegment">the previous segment of the track</param> /// <param name="trackWidthEnd">the width of the Tracksegment where it ends</param> /// <param name="endPoint">the point where the segment ends</param> /// <param name="endDirection">the direction of the segment where it ends</param> protected TrackSegment(TrackSegment previousTrackSegment, float trackWidthEnd, Vector2 endPoint, Vector2 endDirection) { _previousTrackSegment = previousTrackSegment; if (_previousTrackSegment != null) { _previousTrackSegment.TrackSegmentChanged += PreviousTrackSegmentChanged; } TrackWidthEnd = trackWidthEnd; _endDirection = endDirection; _endPoint = endPoint; }
/// <summary> /// The start/FinishLine of a Track /// </summary> /// <param name="previousTrackSegment">the previous segment of the track</param> /// <param name="trackWidthEnd">the width of the Tracksegment where it ends</param> /// <param name="endPoint">the point where the segment ends</param> /// <param name="endDirection">the direction of the segment where it ends</param> public StartLine(TrackSegment previousTrackSegment, float trackWidthEnd, Vector2 endPoint, Vector2 endDirection) : base(previousTrackSegment, trackWidthEnd, endPoint, endDirection) { }
private float _startingAngle; //the angle of the direction vector at the beginning of the curve in polar coordinates to the middlePoint /// <summary> /// a corner of a track /// </summary> /// <param name="previousTrackSegment">the previous TrackSegment. Must not be null</param> /// <param name="trackWidthEnd">the width of the Curve</param> /// <param name="endPoint">The Point where the corner ends</param> public Curve([NotNull] TrackSegment previousTrackSegment, float trackWidthEnd, Vector2 endPoint) : base(previousTrackSegment, trackWidthEnd, endPoint, null) { CalculateDerivedValues(); _endDirection = GetDirectionAtAngle(_angle); }
/// <summary> /// a straight segment of a track /// </summary> /// <param name="previousTrackSegment">the previous segment of the track</param> /// <param name="trackWidthEnd">the width of the Tracksegment where it ends</param> /// <param name="length">the length of the straight</param> public Straight(TrackSegment previousTrackSegment, float trackWidthEnd, float length) : base(previousTrackSegment, trackWidthEnd, previousTrackSegment.EndDirection.Normalize() * length, previousTrackSegment.EndDirection) { _lenght = length; }