private static IEnumerable <IEnumerable <Point2D> > CreateParameterAreas(IEnumerable <MacroStabilityInwardsSlice> slices,
                                                                                 Func <MacroStabilityInwardsSlice, RoundedDouble> getParameterFunc,
                                                                                 double scaleFactor)
        {
            if (slices == null || getParameterFunc == null)
            {
                return(Enumerable.Empty <Point2D[]>());
            }

            var areas = new List <Point2D[]>();

            foreach (MacroStabilityInwardsSlice slice in slices)
            {
                RoundedDouble value = getParameterFunc(slice);
                if (double.IsNaN(value))
                {
                    value = (RoundedDouble)0.0;
                }

                value = value.ClipValue((RoundedDouble)(-2000.0), (RoundedDouble)2000.0);

                double offset = value * scaleFactor;
                double deltaX = slice.BottomLeftPoint.X - slice.BottomRightPoint.X;
                double deltaY = slice.BottomLeftPoint.Y - slice.BottomRightPoint.Y;

                double length = Math.Sqrt(Math.Pow(deltaX, 2) +
                                          Math.Pow(deltaY, 2));

                areas.Add(new[]
                {
                    slice.BottomLeftPoint,
                    slice.BottomRightPoint,
                    new Point2D(slice.BottomRightPoint.X + offset * -deltaY / length,
                                slice.BottomRightPoint.Y + offset * deltaX / length),
                    new Point2D(slice.BottomLeftPoint.X + offset * -deltaY / length,
                                slice.BottomLeftPoint.Y + offset * deltaX / length)
                });
            }

            return(areas);
        }