Ejemplo n.º 1
0
        /// <summary>
        /// Travels some distance on beizer and calculates the point and tangent at that distance.
        /// </summary>
        /// <param name="distance">distance to travel on the arc in meteres</param>
        /// <param name="tangent">normalized tangent on the curve toward the end of the beizer.</param>
        /// <returns>point on the curve at the given distance.</returns>
        public static Vector2 Travel2(this Bezier2 beizer, float distance, out Vector2 tangent)
        {
            if (beizer.IsStraight())
            {
                tangent = (beizer.d - beizer.a).normalized;
                return(beizer.TravelStraight(distance));
            }
            float t = beizer.Travel(0, distance);

            tangent = beizer.Tangent(t).normalized;
            return(beizer.Position(t));
        }