Exemplo n.º 1
0
        /***************************************************/

        public static bool IsEqual(this BHG.PolyCurve bhCurve, RHG.PolyCurve rhCurve, double tolerance = BHG.Tolerance.Distance)
        {
            if (bhCurve == null & rhCurve == null)
            {
                return(true);
            }

            bool equal = true;
            List <BHG.ICurve> bhCurves = bhCurve.Curves;

            rhCurve.RemoveNesting();
            RHG.Curve[] rhCurves = rhCurve.Explode();

            if (bhCurves.Count != rhCurves.Length)
            {
                return(false);
            }

            for (int i = 0; i < bhCurves.Count; i++)
            {
                equal &= bhCurves[i].IIsEqual(rhCurves[i], tolerance);
            }

            return(equal);
        }
Exemplo n.º 2
0
        /***************************************************/

        public static BHG.ICurve FromRhino(this RHG.PolyCurve polyCurve)
        {
            if (polyCurve == null)
            {
                return(null);
            }

            polyCurve.RemoveNesting();
            if (polyCurve.IsPolyline())
            {
                RHG.Polyline polyline;
                polyCurve.TryGetPolyline(out polyline);
                return(polyline.FromRhino());
            }
            else
            {
                return new BHG.PolyCurve {
                           Curves = polyCurve.Explode().Select(x => x.FromRhino()).ToList()
                }
            };
        }