2 using System.Collections.Generic;
18 public StraightLane(Point startPoint, Point endPoint) : base(startPoint, endPoint) { }
25 internal override IEnumerable<Point> LanePoints(
double lanePointsMaxDistance)
28 Vector startToEndVector = endNode.Location - startNode.Location;
30 Vector cellStartToEndVector = startToEndVector;
31 cellStartToEndVector.Normalize();
32 cellStartToEndVector *= lanePointsMaxDistance;
34 int lanePointsCount = (int)(startToEndVector.Length / cellStartToEndVector.Length) + 1;
36 Point currentPoint = startNode.Location;
37 for (
int i = 0; i < lanePointsCount; i++)
39 yield
return currentPoint;
40 currentPoint += cellStartToEndVector;
43 if (currentPoint != endNode.Location)
45 yield
return endNode.Location;
Represents single straight lane.
StraightLane(Point startPoint, Point endPoint)
Constructor of straight lane.