Ejemplo n.º 1
0
        /***************************************************/

        public static Vector TangentAtParameter(this PolyCurve curve, double parameter, double tolerance = Tolerance.Distance)
        {
            double length   = curve.Length();
            double paramTol = tolerance / length;

            if (parameter > 1 + paramTol || parameter < 0 - paramTol)
            {
                return(null);
            }

            double cLength = parameter * length;

            foreach (ICurve c in curve.SubParts())
            {
                double l = c.ILength();
                if (l >= cLength)
                {
                    return(c.ITangentAtParameter(cLength / l));
                }
                cLength -= l;
            }

            return(curve.EndDir());
        }