public static bool AuxIntersectBB(DegenD degen, SegD seg, InfoConnect icAB, InfoConnect icBA, ListInfoInters linters) { if (linters == null) { throw new ExceptionGMath("Intersect", "AuxIntersectBB(degen,seg)", "Null argument"); } // no reduction bool connectAB = ((icAB != null) && (icAB.IsConnect)); if (connectAB) { return(true); } Param param; VecD pnt; degen.Cp.Project(seg, out param, out pnt); if (degen.Cp.Dist(pnt) < MConsts.EPS_DEC) { IntersD0 inters = new IntersD0(Param.Degen, param, pnt, false); linters.Add(inters); } return(true); }
/* * INTERSECTIONS: (BCurve,LCurve) * - lcurve is required non-degenerated * * NOTES: - Curves are maximally reduced in AuxIntersectBL * - Self/intersecting Bezier is NOT a reduction * from bezier */ public static bool AuxIntersectBL(DegenD degen, LCurve lrs, ListInfoInters linters) { // IMPORTANT (TODO): // such intersection is NOT VALID for computation of ray's parity if (linters == null) { throw new ExceptionGMath("Intersect", "AuxIntersectBL(degen,lrs)", "Null argument"); } if (lrs.IsDegen) { throw new ExceptionGMath("Intersect", "AuxIntersectBL(degen,lrs)", null); } if (lrs is SegD) { return(Inters.AuxIntersectBB(degen, lrs as SegD, null, null, linters)); } LineD line = new LineD(lrs); Param param; VecD pnt; if (!degen.Cp.Project(line, out param, out pnt)) { return(false); } if (degen.Cp.Dist(pnt) < MConsts.EPS_DEC) { if (lrs.IsEvaluableStrict(param)) { IntersD0 inters = new IntersD0(Param.Degen, param, pnt, false); linters.Add(inters); } } return(true); }
public void Subdivide(Param par, out BCurve curveS, out BCurve curveE) { /* * ASSUMPTION: par should be in the range [0,1] */ curveS = null; curveE = null; if (!this.IsEvaluableStrict(par)) { return; } curveS = new DegenD(this.cp); curveE = new DegenD(this.cp); }
public static bool AuxIntersectBB(DegenD degen, Bez2D bez, InfoConnect icAB, InfoConnect icBA, ListInfoInters linters) { if (linters == null) { throw new ExceptionGMath("Intersect", "AuxIntersectBB(degen,bez)", "Null argument"); } // no reduction !! bool connectAB = ((icAB != null) && (icAB.IsConnect)); bool connectBA = ((icBA != null) && (icBA.IsConnect)); bool connect = connectAB || connectBA; if (connect) { return(true); } // bbox check if (!bez.BBox.Contains(degen.Cp)) { return(true); } Param[] pars; VecD pnt; if (!degen.Cp.ProjectGeneral(bez, out pars, out pnt)) { return(false); } if (degen.Cp.Dist(pnt) < MConsts.EPS_DEC) { Param parM; bool isSelfInters = bez.IsSelfInters(out parM); for (int iPar = 0; iPar < pars.Length; iPar++) { IntersD0 inters = new IntersD0(Param.Degen, pars[iPar], pnt, isSelfInters); linters.Add(inters); } } return(true); }
/* * INTERSECTIONS: (BCurve,BCurve) * - ORDER is IMPORTANT * order: if infoConnect are not nulls, => * it is supposed that curveA(1)=curveB(0) * * NOTES: - InfoConnect are supposed to be CORRECT * - Curves are maximally reduced in AuxIntersectBB * - Self/intersecting Bezier is NOT a reduction * from bezier */ public static bool AuxIntersectBB(DegenD degenA, DegenD degenB, InfoConnect icAB, InfoConnect icBA, ListInfoInters linters) { if (linters==null) { throw new ExceptionGMath("Intersect","AuxIntersectBB(degen,degen)","Null argument"); } bool connectAB = ((icAB!=null)&&(icAB.IsConnect)); bool connectBA = ((icBA!=null)&&(icBA.IsConnect)); bool connect = connectAB||connectBA; if (connect) // connect,=> no "real" intersections { return true; } if (degenA.Cp==degenB.Cp) // coincide but are not known to be connected { IntersD0 inters=new IntersD0(Param.Degen,Param.Degen, 0.5*(degenA.Cp+degenB.Cp),false); linters.Add(inters); } return true; }
public static bool AuxIntersectBB(DegenD degen, Bez2D bez, InfoConnect icAB, InfoConnect icBA, ListInfoInters linters) { if (linters==null) { throw new ExceptionGMath("Intersect","AuxIntersectBB(degen,bez)","Null argument"); } // no reduction !! bool connectAB = ((icAB!=null)&&(icAB.IsConnect)); bool connectBA = ((icBA!=null)&&(icBA.IsConnect)); bool connect=connectAB||connectBA; if (connect) { return true; } // bbox check if (!bez.BBox.Contains(degen.Cp)) return true; Param[] pars; VecD pnt; if (!degen.Cp.ProjectGeneral(bez,out pars, out pnt)) return false; if (degen.Cp.Dist(pnt)<MConsts.EPS_DEC) { Param parM; bool isSelfInters=bez.IsSelfInters(out parM); for (int iPar=0; iPar<pars.Length; iPar++) { IntersD0 inters=new IntersD0(Param.Degen,pars[iPar],pnt,isSelfInters); linters.Add(inters); } } return true; }
/* * INTERSECTIONS: (BCurve,BCurve) * - ORDER is IMPORTANT * order: if infoConnect are not nulls, => * it is supposed that curveA(1)=curveB(0) * * NOTES: - InfoConnect are supposed to be CORRECT * - Curves are maximally reduced in AuxIntersectBB * - Self/intersecting Bezier is NOT a reduction * from bezier */ public static bool AuxIntersectBB(DegenD degenA, DegenD degenB, InfoConnect icAB, InfoConnect icBA, ListInfoInters linters) { if (linters == null) { throw new ExceptionGMath("Intersect", "AuxIntersectBB(degen,degen)", "Null argument"); } bool connectAB = ((icAB != null) && (icAB.IsConnect)); bool connectBA = ((icBA != null) && (icBA.IsConnect)); bool connect = connectAB || connectBA; if (connect) // connect,=> no "real" intersections { return(true); } if (degenA.Cp == degenB.Cp) // coincide but are not known to be connected { IntersD0 inters = new IntersD0(Param.Degen, Param.Degen, 0.5 * (degenA.Cp + degenB.Cp), false); linters.Add(inters); } return(true); }
public static bool AuxIntersectBB(DegenD degen, SegD seg, InfoConnect icAB, InfoConnect icBA, ListInfoInters linters) { if (linters==null) { throw new ExceptionGMath("Intersect","AuxIntersectBB(degen,seg)","Null argument"); } // no reduction bool connectAB = ((icAB!=null)&&(icAB.IsConnect)); if (connectAB) { return true; } Param param; VecD pnt; degen.Cp.Project(seg,out param, out pnt); if (degen.Cp.Dist(pnt)<MConsts.EPS_DEC) { IntersD0 inters=new IntersD0(Param.Degen,param,pnt,false); linters.Add(inters); } return true; }
public DegenD(DegenD degen) : this() { this.cp.From(degen.Cp); }
public void Subdivide(Param par, out BCurve curveS, out BCurve curveE) { /* * ASSUMPTION: par should be in the range [0,1] */ curveS=null; curveE=null; if (!this.IsEvaluableStrict(par)) return; curveS=new DegenD(this.cp); curveE=new DegenD(this.cp); }
/* * INTERSECTIONS: (BCurve,LCurve) * - lcurve is required non-degenerated * * NOTES: - Curves are maximally reduced in AuxIntersectBL * - Self/intersecting Bezier is NOT a reduction * from bezier */ public static bool AuxIntersectBL(DegenD degen, LCurve lrs, ListInfoInters linters) { // IMPORTANT (TODO): // such intersection is NOT VALID for computation of ray's parity if (linters==null) { throw new ExceptionGMath("Intersect","AuxIntersectBL(degen,lrs)","Null argument"); } if (lrs.IsDegen) { throw new ExceptionGMath("Intersect","AuxIntersectBL(degen,lrs)",null); } if (lrs is SegD) { return Inters.AuxIntersectBB(degen, lrs as SegD, null, null, linters); } LineD line=new LineD(lrs); Param param; VecD pnt; if (!degen.Cp.Project(line,out param,out pnt)) return false; if (degen.Cp.Dist(pnt)<MConsts.EPS_DEC) { if (lrs.IsEvaluableStrict(param)) { IntersD0 inters=new IntersD0(Param.Degen, param, pnt, false); linters.Add(inters); } } return true; }