Example #1
0
 protected virtual void OverlayFn(LineSeg a,
                                  LineSeg b,
                                  double ang_tol,
                                  double distsqtol,
                                  out LineSeg before,
                                  out bool a_before,
                                  out LineSeg overlap,
                                  out LineSeg after,
                                  out bool a_after)
 {
     LineSeg.Overlay(a, b, Vector.GetParTolerance(ang_tol), distsqtol,
                     out before, out a_before, out overlap,
                     out after, out a_after);
 }
Example #2
0
        private bool insertFrag(T src,
                                LineSeg l,
                                IIndexedSeg cand,
                                Stack <IIndexedSeg> cand_remainders,
                                Stack <LineSeg> l_remainders)
        {
            Fragment frag = cand.Val as Fragment;

            LineSeg a, b, o; bool l_before, l_after;

            LineSeg.Overlay(l, frag.LineSeg, m_atol, m_dtolsq,
                            out b, out l_before, // leftover before
                            out o,
                            out a, out l_after); // leftover after

            if (o != null)                       // There was an overlay...
            // For partial overlays, manage any leftovers that are
            // already in the index.
            {
                if (b != null && !l_before)
                {
                    Fragment nfraga, nfragb;
                    frag.Split(out nfraga, b, out nfragb, o);
                    Pair <IIndexedSeg, IIndexedSeg> sp =
                        m_index.Split(cand, nfraga, nfragb);

                    // relable 'c' and 'frag' to point at the overlaping part.
                    cand_remainders.Push(sp.First);
                    cand = sp.Second;
                    frag = nfragb;
                }

                if (a != null && !l_after)
                {
                    Fragment nfraga, nfragb;
                    frag.Split(out nfraga, o, out nfragb, a);
                    Pair <IIndexedSeg, IIndexedSeg> sp =
                        m_index.Split(cand, nfraga, nfragb);

                    // relable 'c' and 'frag' to point at the overlaping part.
                    cand_remainders.Push(sp.Second);
                    cand = sp.First;
                    frag = nfraga;
                }

                // Attribute the overlapping portion w/ the source line.
                frag.Sources = frag.Sources.Cons(src);

                // And manage any leftovers that are -not- part of the index.
                if (b != null && l_before)
                {
                    l_remainders.Push(b);
                }
                if (a != null && l_after)
                {
                    l_remainders.Push(a);
                }

                return(true);
            }
            else
            {
                // No overlap so leftovers are complete.
                cand_remainders.Push(cand);
                return(false);
            }
        }