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

        private static bool IsSameEdge(this RHG.Curve curve, RHG.BrepEdge edge)
        {
            double tolerance = BHG.Tolerance.Distance;

            RHG.Curve edgeCurve = edge.DuplicateCurve();
            edgeCurve.Reverse();

            RHG.BoundingBox bb1 = curve.GetBoundingBox(false);
            RHG.BoundingBox bb2 = edgeCurve.GetBoundingBox(false);
            if (bb1.Min.DistanceTo(bb2.Min) > tolerance || bb1.Max.DistanceTo(bb2.Max) > tolerance)
            {
                return(false);
            }

            int frameCount = 100;

            RHG.Point3d[] frames1, frames2;
            curve.DivideByCount(frameCount, false, out frames1);
            edgeCurve.DivideByCount(frameCount, false, out frames2);

            return(Enumerable.Range(0, frameCount - 1).All(i => frames1[i].DistanceTo(frames2[i]) <= tolerance));
        }