示例#1
0
        protected override bool CutLineHull(
            double centerOffset,
            double r2, double tolerance,
            out double tMin, out double tMax,
            out NearSegment hullStartNear,
            out NearSegment hullEndNear,
            out bool coincident)
        {
            coincident = IsCoincident(tolerance, out hullStartNear, out hullEndNear);
            if (!coincident)
            {
                Pnt offset = P0s;
                if (centerOffset != 0)
                {
                    offset = P0s + centerOffset * L0Normal;
                }

                bool cut = CutLineHull2D(offset, L0, P1s, L1, r2, out tMin, out tMax,
                                         out hullStartNear, out hullEndNear);

                return(cut);
            }

            tMin = -Math.Sqrt(r2 / L0.OrigDist2());
            tMax = 1 - tMin;
            return(true);
        }
示例#2
0
        protected override bool CutLineHull(
            double centerOffset, double r2, double tolerance,
            out double tMin, out double tMax,
            out NearSegment hullStartNear, out NearSegment hullEndNear, out bool coincident)
        {
            if (centerOffset != 0)
            {
                throw new NotImplementedException("Not yet implemented for centerOffset > 0");
            }

            if (GeomUtils.Equals3D((Pnt3D)P0s, (Pnt3D)P1s, tolerance) &&
                GeomUtils.Equals3D((Pnt3D)P0e, (Pnt3D)P1e, tolerance))
            {
                hullStartNear = NearSegment.NearStart;
                hullEndNear   = NearSegment.NearEnd;
            }
            else if (GeomUtils.Equals3D((Pnt3D)P0s, (Pnt3D)P1e, tolerance) &&
                     GeomUtils.Equals3D((Pnt3D)P0e, (Pnt3D)P1s, tolerance))
            {
                hullStartNear = NearSegment.NearEnd;
                hullEndNear   = NearSegment.NearStart;
            }
            else
            {
                coincident = false;

                bool cut = CutLineHull3D((Pnt3D)P0s, (Pnt3D)L0, (Pnt3D)P1s, (Pnt3D)L1,
                                         r2, out tMin, out tMax,
                                         out hullStartNear, out hullEndNear);

                return(cut);
            }

            coincident = true;
            tMin       = -Math.Sqrt(r2 / L0.OrigDist2());
            tMax       = 1 - tMin;

            return(true);
        }