// this should make it easier to draw the road borders
        // by making it relative to a road secion
        public void AddLineNode(MglrRoadSection reference, int xOff, int yOff)
        {
            int newX = reference.x + xOff;
            int newY = reference.y + yOff;

            if (keyNodes.Count == 0)
            {
                keyNodes.Add(new MglrRoadBorderLine()
                {
                    x1 = newX, y1 = newY
                });
            }
            else
            {
                var lastLine = keyNodes.Last();
                lastLine.x2 = newX;
                lastLine.y2 = newY;
                keyNodes.Add(new MglrRoadBorderLine()
                {
                    x1 = newX, y1 = newY
                });
            }
        }
        private List <MglrRoadSection> InterpolateTwo(MglrRoadSection first, MglrRoadSection second)
        {
            List <MglrRoadSection> result = new List <MglrRoadSection>();
            int    dy   = second.y - first.y;
            int    dx   = second.x - first.x;
            double dist = Math.Sqrt(dy * dy + dx * dx);
            // assume the radius of the road-circle block is always non zero
            int width       = second.r * 2;
            int blockNumber = (int)Math.Ceiling(dist / width);

            for (int j = 0; j < blockNumber; j++)
            {
                double deltaX = (double)dx / blockNumber;
                double deltaY = (double)dy / blockNumber;
                result.Add(new MglrRoadSection()
                {
                    r = second.r,
                    x = (int)(first.x + deltaX * j),
                    y = (int)(first.y + deltaY * j)
                });
            }
            return(result);
        }