Ejemplo n.º 1
0
        /// <summary>
        /// Returns the list of Coords between this and the given Coord
        /// (inclusive (I assume)).
        /// </summary>
        /// <returns>The list of Coords</returns>
        /// <param name="b">The Coord to draw to.</param>
        public Queue <Coord> Linedraw(Coord b)
        {
            int           N       = DistanceTo(b);
            CoordDouble   a_nudge = new CoordDouble(Q + 0.000001, R + 0.000001, S - 0.000002);
            CoordDouble   b_nudge = new CoordDouble(b.Q + 0.000001, b.R + 0.000001, b.S - 0.000002);
            Queue <Coord> results = new Queue <Coord>();
            double        step    = 1.0 / Math.Max(N, 1);

            for (int i = 0; i <= N; i++)
            {
                results.Enqueue(a_nudge.Lerp(b_nudge, step * i).Round());
            }
            return(results);
        }
 /// <summary>
 /// Performs an linear interpolation to the given <see cref="CoordDouble"/>.
 /// </summary>
 /// <param name="b">The coordinate to interpolate to.</param>
 /// <param name="t">The percentage to interpolate.</param>
 /// <returns>
 /// The <see cref="CoordDouble"/> that is <c>t%</c> between the current coordinate and
 /// the given one.
 /// </returns>
 public CoordDouble Lerp(CoordDouble b, double t) => new CoordDouble(Lerp(Q, b.Q, t), Lerp(R, b.R, t));