Exemple #1
0
        /***************************************************/

        public static bool IsContaining(this PolyCurve curve1, ICurve curve2, bool acceptOnEdge = true, double tolerance = Tolerance.Distance)
        {
            if (!curve1.IsClosed(tolerance))
            {
                return(false);
            }

            List <Point> iPts = curve1.ICurvePlanarIntersections(curve2, tolerance);

            if (!acceptOnEdge && iPts.Count > 0)
            {
                return(false);
            }

            List <double> cParams = new List <double> {
                0, 1
            };

            foreach (Point iPt in iPts)
            {
                cParams.Add(curve2.IParameterAtPoint(iPt, tolerance));
            }
            cParams.Sort();

            for (int i = 0; i < cParams.Count - 1; i++)
            {
                iPts.Add(curve2.IPointAtParameter((cParams[i] + cParams[i + 1]) * 0.5));
            }
            return(curve1.IsContaining(iPts, acceptOnEdge, tolerance));
        }