public bool Intersect(ListInfoInters linters) { bool res = true; for (int pozA = 0; pozA < this.NumKnot - 1; pozA++) { BCurve curveA = this.CurveByPoz(pozA); if (curveA != null) { Knot knA = this.KnotByPoz(pozA); InfoInters inters; if (curveA.IsSelfInters(out inters)) { inters.ParamToCParam(knA, null); linters.Add(inters); } bool isDegenA = curveA.IsDegen; for (int pozB = pozA + 1; pozB < this.NumKnot; pozB++) { BCurve curveB = this.CurveByPoz(pozB); if (curveB != null) { bool isDegenB = curveB.IsDegen; if (isDegenA || isDegenB) { bool areConjAB, areConjBA; if ((!this.AreConjByPozPoz(pozA, pozB, out areConjAB)) || (!this.AreConjByPozPoz(pozB, pozA, out areConjBA))) { res = false; continue; } if (areConjAB || areConjBA) { continue; } } InfoConnect icAB, icBA; if ((!this.InfoConnectByPozPoz(pozA, pozB, out icAB)) || (!this.InfoConnectByPozPoz(pozB, pozA, out icBA))) { res = false; continue; } int numIntersBefore = linters.Count; Knot knB = this.KnotByPoz(pozB); Inters.IntersectBB(curveA, curveB, icAB, icBA, linters); linters.ParamToCParam(knA, knB, numIntersBefore); } } } } return(res); }
public bool Intersect(Contour cont, ListInfoInters linters) { Contour contA = this; Contour contB = cont; if (contA == contB) { return(this.Intersect(linters)); } BoxD bboxContA = contA.BBox; BoxD bboxContB = contB.BBox; if (!bboxContA.HasInters(bboxContB)) { return(true); } for (int pozA = 0; pozA < contA.NumKnot; pozA++) { Knot knA = contA.KnotByPoz(pozA); BCurve curveA = contA.CurveByPoz(pozA); if (curveA != null) { BoxD bboxCurveA = curveA.BBox; if (bboxCurveA.HasInters(bboxContB)) { for (int pozB = 0; pozB < contB.NumKnot; pozB++) { BCurve curveB = contB.CurveByPoz(pozB); if (curveB != null) { int numIntersBefore = linters.Count; Inters.IntersectBB(curveA, curveB, null, null, linters); Knot knB = contB.KnotByPoz(pozB); linters.ParamToCParam(knA, knB, numIntersBefore); } } } } } contA = null; contB = null; return(true); }
public bool Intersect(Contour cont, ListInfoInters linters) { Contour contA=this; Contour contB=cont; if (contA==contB) { return this.Intersect(linters); } BoxD bboxContA=contA.BBox; BoxD bboxContB=contB.BBox; if (!bboxContA.HasInters(bboxContB)) return true; for (int pozA=0; pozA<contA.NumKnot; pozA++) { Knot knA=contA.KnotByPoz(pozA); BCurve curveA=contA.CurveByPoz(pozA); if (curveA!=null) { BoxD bboxCurveA=curveA.BBox; if (bboxCurveA.HasInters(bboxContB)) { for (int pozB=0; pozB<contB.NumKnot; pozB++) { BCurve curveB=contB.CurveByPoz(pozB); if (curveB!=null) { int numIntersBefore=linters.Count; Inters.IntersectBB(curveA, curveB, null, null, linters); Knot knB=contB.KnotByPoz(pozB); linters.ParamToCParam(knA,knB,numIntersBefore); } } } } } contA=null; contB=null; return true; }
public bool Intersect(ListInfoInters linters) { bool res=true; for (int pozA=0; pozA<this.NumKnot-1; pozA++) { BCurve curveA=this.CurveByPoz(pozA); if (curveA!=null) { Knot knA=this.KnotByPoz(pozA); InfoInters inters; if (curveA.IsSelfInters(out inters)) { inters.ParamToCParam(knA,null); linters.Add(inters); } bool isDegenA=curveA.IsDegen; for (int pozB=pozA+1; pozB<this.NumKnot; pozB++) { BCurve curveB=this.CurveByPoz(pozB); if (curveB!=null) { bool isDegenB=curveB.IsDegen; if (isDegenA||isDegenB) { bool areConjAB, areConjBA; if ((!this.AreConjByPozPoz(pozA,pozB,out areConjAB))|| (!this.AreConjByPozPoz(pozB,pozA,out areConjBA))) { res=false; continue; } if (areConjAB||areConjBA) continue; } InfoConnect icAB, icBA; if ((!this.InfoConnectByPozPoz(pozA,pozB,out icAB))|| (!this.InfoConnectByPozPoz(pozB,pozA,out icBA))) { res=false; continue; } int numIntersBefore=linters.Count; Knot knB=this.KnotByPoz(pozB); Inters.IntersectBB(curveA, curveB, icAB, icBA, linters); linters.ParamToCParam(knA,knB,numIntersBefore); } } } } return res; }