Exemplo n.º 1
0
        private static IEnumerable <HullLine> GetLineHullParts(Lin2D lin, SegmentHull hull)
        {
            Pnt leftOffset = hull.LeftOffset * lin.LNormal;

            yield return(new HullLineSimple
            {
                Lin = lin.GetParallel(leftOffset), CutPart = CutPart.LeftSide
            });

            Pnt rightOffset = -hull.RightOffset * lin.LNormal;

            yield return(new HullLineSimple
            {
                Lin = lin.GetParallel(rightOffset), CutPart = CutPart.RightSide
            }
                         );

            double meanOffset = (hull.LeftOffset + hull.RightOffset) / 2;
            Pnt    capOffset  = (hull.LeftOffset - hull.RightOffset) / 2 * lin.LNormal;
            Lin2D  centerLin  = lin.GetParallel(capOffset);

            foreach (HullLine startPart in hull.StartCap.GetHullLines(
                         centerLin, meanOffset, atEnd: false))
            {
                startPart.CutPart = CutPart.StartCap;
                yield return(startPart);
            }

            foreach (HullLine endPart in hull.EndCap.GetHullLines(centerLin, meanOffset,
                                                                  atEnd: true))
            {
                endPart.CutPart = CutPart.EndCap;
                yield return(endPart);
            }
        }
Exemplo n.º 2
0
 protected SegmentPair([NotNull] SegmentHull hull,
                       [NotNull] SegmentHull neighbor,
                       bool is3D)
 {
     _hull     = hull;
     _neighbor = neighbor;
     _is3D     = is3D;
 }
Exemplo n.º 3
0
        public static SegmentPair Create([NotNull] SegmentHull hull,
                                         [NotNull] SegmentHull neighbor,
                                         bool is3D)
        {
            SegmentPair created = is3D
                                                      ? (SegmentPair) new SegmentPair3D(hull, neighbor)
                                                      : new SegmentPair2D(hull, neighbor);

            return(created);
        }
Exemplo n.º 4
0
        private static IEnumerable <IHullPart> GetNeighborHullParts(Lin2D lin, SegmentHull hull)
        {
            Pnt leftOffset = hull.LeftOffset * lin.LNormal;

            yield return
                (new LineHullPart(lin.Ps + leftOffset, lin.Pe + leftOffset)
            {
                CutPart = CutPart.LeftSide
            });

            Pnt rightOffset = -hull.RightOffset * lin.LNormal;

            yield return
                (new LineHullPart(lin.Ps + rightOffset, lin.Pe + rightOffset)
            {
                CutPart = CutPart.RightSide
            });

            Pnt capOffset = (hull.LeftOffset - hull.RightOffset) / 2 * lin.LNormal;
            Pnt pCapS     = lin.Ps + capOffset;
            Pnt pCapE     = lin.Pe + capOffset;

            double meanOffset = (hull.LeftOffset + hull.RightOffset) / 2;

            foreach (IHullPart startPart in hull.StartCap.GetInflatedHullParts(
                         pCapS, pCapE, meanOffset, 0))
            {
                startPart.CutPart = CutPart.StartCap;
                yield return(startPart);
            }

            foreach (IHullPart endPart in hull.EndCap.GetInflatedHullParts(
                         pCapE, pCapS, meanOffset, 0))
            {
                endPart.CutPart = CutPart.EndCap;
                yield return(endPart);
            }
        }
Exemplo n.º 5
0
 public SegmentPair3D([NotNull] SegmentHull segmentProxy,
                      [NotNull] SegmentHull hullSegmentProxy) :
     base(segmentProxy, hullSegmentProxy, is3D: true)
 {
 }
Exemplo n.º 6
0
 public SegmentPair2D([NotNull] SegmentHull segmentProxy,
                      [NotNull] SegmentHull hullSegmentProxy) :
     base(segmentProxy, hullSegmentProxy, is3D: false)
 {
 }