Esempio n. 1
0
        /***************************************************/

        public static double ParameterAtPoint(this PolyCurve curve, Point point, double tolerance = Tolerance.Distance)
        {
            double sqTol  = tolerance * tolerance;
            double length = 0;

            foreach (ICurve c in curve.SubParts())
            {
                if (c.IClosestPoint(point).SquareDistance(point) <= sqTol)
                {
                    return((length + c.IParameterAtPoint(point, tolerance) * c.ILength()) / curve.ILength());
                }
                else
                {
                    length += c.ILength();
                }
            }

            return(-1);
        }