public bool IsSelfInters(out InfoInters inters) { /* * RETURN VALUE: true if Self-Intersecting; false otherwise */ inters=null; Param parM; if (!IsSelfInters(out parM)) return false; if (parM.Val==Param.Infinity) { inters=new IntersD1(0,null,1,null,this,true); } else if (parM>1) { Param paramStart=1.0/(2.0*parM.Val-1.0); BCurve curveInters=this.SubCurve(paramStart,1); if (curveInters==null) { throw new ExceptionGMath("Bez2D","IsSelfInters",""); } inters=new IntersD1(paramStart,null,1.0,null,curveInters,true); } else if (parM<0) { Param paramEnd=(-2.0*parM.Val)/(1.0-2.0*parM.Val); BCurve curveInters=this.SubCurve(0,paramEnd); if (curveInters==null) { throw new ExceptionGMath("Bez2D","IsSelfInters",""); } inters=new IntersD1(0.0,null,paramEnd,null,curveInters,true); } return true; }
public void ParamToCParam(Knot kn0, Knot kn1, int pozStart) { for (int poz = pozStart; poz < this.linters.Count; poz++) { InfoInters inters = linters[poz] as InfoInters; inters.ParamToCParam(kn0, kn1); } }
public void ParamFromReduced(BCurve bcurve, int indCurve, int pozStart) { for (int poz = pozStart; poz < this.linters.Count; poz++) { InfoInters inters = linters[poz] as InfoInters; inters.ParamFromReduced(bcurve, indCurve); } }
public void ParamSwap(int pozStart) { for (int poz = pozStart; poz < this.linters.Count; poz++) { InfoInters inters = linters[poz] as InfoInters; inters.ParamSwap(); } }
public void ParamInvalidateBezSI(int pozStart) { for (int poz = pozStart; poz < this.linters.Count; poz++) { InfoInters inters = linters[poz] as InfoInters; inters.ParamInvalidateBezSI(); } }
public void ParamReverse(double valRev, int indCurve, int pozStart) { for (int poz = pozStart; poz < this.linters.Count; poz++) { InfoInters inters = linters[poz] as InfoInters; inters.ParamReverse(valRev, indCurve); } }
public bool IntersFromSupport(InfoInters intersSup, int indBez, out InfoInters[] intersBez) { /* * ASSUMPTION: works for D0 intersections ONLY!!! */ intersBez = null; if (intersSup == null) { return(true); } if (intersSup.Dim == InfoInters.TypeDim.Dim1) { throw new ExceptionGMath("Bez2D", "IntersFromSupport", "NOT IMPLEMENTED"); //return false; } InfoParamInters ipiSup = (intersSup as IntersD0).Ipi; Param[] parsBez; if (!this.ParamFromSupport(ipiSup.Par(indBez), out parsBez)) { return(false); } intersBez = new IntersD0[parsBez.Length]; for (int iPar = 0; iPar < parsBez.Length; iPar++) { if (indBez == 0) { intersBez[iPar] = new IntersD0(parsBez[iPar], ipiSup.Par(1), (intersSup as IntersD0).PntInters, true); } else { intersBez[iPar] = new IntersD0(ipiSup.Par(0), parsBez[iPar], (intersSup as IntersD0).PntInters, true); } } return(true); }
public bool IsSelfInters(out InfoInters inters) { /* * RETURN VALUE: true if Self-Intersecting; false otherwise */ inters = null; Param parM; if (!IsSelfInters(out parM)) { return(false); } if (parM.Val == Param.Infinity) { inters = new IntersD1(0, null, 1, null, this, true); } else if (parM > 1) { Param paramStart = 1.0 / (2.0 * parM.Val - 1.0); BCurve curveInters = this.SubCurve(paramStart, 1); if (curveInters == null) { throw new ExceptionGMath("Bez2D", "IsSelfInters", ""); } inters = new IntersD1(paramStart, null, 1.0, null, curveInters, true); } else if (parM < 0) { Param paramEnd = (-2.0 * parM.Val) / (1.0 - 2.0 * parM.Val); BCurve curveInters = this.SubCurve(0, paramEnd); if (curveInters == null) { throw new ExceptionGMath("Bez2D", "IsSelfInters", ""); } inters = new IntersD1(0.0, null, paramEnd, null, curveInters, true); } return(true); }
public bool IntersFromSupport(InfoInters intersSup, int indBez, out InfoInters[] intersBez) { /* * ASSUMPTION: works for D0 intersections ONLY!!! */ intersBez=null; if (intersSup==null) return true; if (intersSup.Dim==InfoInters.TypeDim.Dim1) { throw new ExceptionGMath("Bez2D","IntersFromSupport","NOT IMPLEMENTED"); //return false; } InfoParamInters ipiSup=(intersSup as IntersD0).Ipi; Param[] parsBez; if (!this.ParamFromSupport(ipiSup.Par(indBez), out parsBez)) return false; intersBez=new IntersD0[parsBez.Length]; for (int iPar=0; iPar<parsBez.Length; iPar++) { if (indBez==0) { intersBez[iPar]=new IntersD0(parsBez[iPar],ipiSup.Par(1), (intersSup as IntersD0).PntInters, true); } else { intersBez[iPar]=new IntersD0(ipiSup.Par(0),parsBez[iPar], (intersSup as IntersD0).PntInters, true); } } return true; }
/* * METHODS: GEOMETRICAL */ public bool IsSelfInters(out InfoInters inters) { inters=null; return false; }
public static bool RefineIntersLLD1(LCurve lrsA, LCurve lrsB, out InfoInters inters) { inters=null; if ((lrsA is SegD) && (lrsB is SegD)) { BCurve curveA=lrsA as BCurve; BCurve curveB=lrsB as BCurve; return Inters.RefineIntersBBD1(curveA, curveB, out inters); } if (lrsA.LComplexity>lrsB.LComplexity) { bool res=Inters.RefineIntersLLD1(lrsB,lrsA,out inters); if (inters!=null) { inters.ParamSwap(); } return res; } VecD a0=lrsA.Start; VecD a1=lrsA.End; VecD b0=lrsB.Start; VecD b1=lrsB.End; Param paramBInvA0, paramBInvA1; bool isOn; if ((!a0.InverseOn(lrsB, out isOn, out paramBInvA0))||(!isOn)) return false; if ((!a1.InverseOn(lrsB, out isOn, out paramBInvA1))||(!isOn)) return false; Param paramAInvB0, paramAInvB1; if ((!b0.InverseOn(lrsA, out isOn, out paramAInvB0))||(!isOn)) return false; if ((!b1.InverseOn(lrsA, out isOn, out paramAInvB1))||(!isOn)) return false; bool areCoDirected=(paramBInvA1.Val>=paramBInvA0.Val); if (!areCoDirected) { if (lrsA is LineD) { if (lrsB is LineD) { paramAInvB0=(areCoDirected)? -Param.Infinity: Param.Infinity; paramAInvB1=(areCoDirected)? Param.Infinity: -Param.Infinity; inters=new IntersD1(paramAInvB0,-Param.Infinity, paramAInvB1,Param.Infinity,lrsB,false); return true; } if (lrsB is RayD) { paramAInvB1=(areCoDirected)? Param.Infinity: -Param.Infinity; inters=new IntersD1(paramAInvB0,0, paramAInvB1,Param.Infinity,lrsB,false); return true; } if (lrsB is SegD) { inters=new IntersD1(paramAInvB0,0, paramAInvB1,1,lrsB,false); return true; } } if (lrsA is RayD) { if (lrsB is RayD) { if (areCoDirected) { if (paramAInvB0>0) { inters=new IntersD1(paramAInvB0,0, Param.Infinity,Param.Infinity,lrsB,false); return true; } else { inters=new IntersD1(0,paramBInvA0, Param.Infinity,Param.Infinity,lrsA,false); return true; } } else { if (paramAInvB0>0) { inters=new IntersD1(0,paramBInvA0, paramAInvB0,0,new SegD(a0,b0),false); return true; } } } if (lrsB is SegD) { // intersection is known to have dimension D1 !!! if ((paramBInvA0>=1)||(paramBInvA0<=0)) { inters=new IntersD1(paramAInvB0,0, paramAInvB1,1,new SegD(b0,b1),false); return true; } if ((0<paramBInvA0)&&(paramBInvA1<1)) { if (areCoDirected) { inters=new IntersD1(0,paramBInvA0, paramAInvB1,1,new SegD(a0,b1),false); return true; } else { inters=new IntersD1(0,paramBInvA0, paramAInvB0,0,new SegD(a0,b0),false); return true; } } } } } throw new ExceptionGMath("Intersect","RefineIntersLLD1",null); //return false; }
public static bool RefineIntersLLD1(LCurve lrsA, LCurve lrsB, out InfoInters inters) { inters = null; if ((lrsA is SegD) && (lrsB is SegD)) { BCurve curveA = lrsA as BCurve; BCurve curveB = lrsB as BCurve; return(Inters.RefineIntersBBD1(curveA, curveB, out inters)); } if (lrsA.LComplexity > lrsB.LComplexity) { bool res = Inters.RefineIntersLLD1(lrsB, lrsA, out inters); if (inters != null) { inters.ParamSwap(); } return(res); } VecD a0 = lrsA.Start; VecD a1 = lrsA.End; VecD b0 = lrsB.Start; VecD b1 = lrsB.End; Param paramBInvA0, paramBInvA1; bool isOn; if ((!a0.InverseOn(lrsB, out isOn, out paramBInvA0)) || (!isOn)) { return(false); } if ((!a1.InverseOn(lrsB, out isOn, out paramBInvA1)) || (!isOn)) { return(false); } Param paramAInvB0, paramAInvB1; if ((!b0.InverseOn(lrsA, out isOn, out paramAInvB0)) || (!isOn)) { return(false); } if ((!b1.InverseOn(lrsA, out isOn, out paramAInvB1)) || (!isOn)) { return(false); } bool areCoDirected = (paramBInvA1.Val >= paramBInvA0.Val); if (!areCoDirected) { if (lrsA is LineD) { if (lrsB is LineD) { paramAInvB0 = (areCoDirected)? -Param.Infinity: Param.Infinity; paramAInvB1 = (areCoDirected)? Param.Infinity: -Param.Infinity; inters = new IntersD1(paramAInvB0, -Param.Infinity, paramAInvB1, Param.Infinity, lrsB, false); return(true); } if (lrsB is RayD) { paramAInvB1 = (areCoDirected)? Param.Infinity: -Param.Infinity; inters = new IntersD1(paramAInvB0, 0, paramAInvB1, Param.Infinity, lrsB, false); return(true); } if (lrsB is SegD) { inters = new IntersD1(paramAInvB0, 0, paramAInvB1, 1, lrsB, false); return(true); } } if (lrsA is RayD) { if (lrsB is RayD) { if (areCoDirected) { if (paramAInvB0 > 0) { inters = new IntersD1(paramAInvB0, 0, Param.Infinity, Param.Infinity, lrsB, false); return(true); } else { inters = new IntersD1(0, paramBInvA0, Param.Infinity, Param.Infinity, lrsA, false); return(true); } } else { if (paramAInvB0 > 0) { inters = new IntersD1(0, paramBInvA0, paramAInvB0, 0, new SegD(a0, b0), false); return(true); } } } if (lrsB is SegD) { // intersection is known to have dimension D1 !!! if ((paramBInvA0 >= 1) || (paramBInvA0 <= 0)) { inters = new IntersD1(paramAInvB0, 0, paramAInvB1, 1, new SegD(b0, b1), false); return(true); } if ((0 < paramBInvA0) && (paramBInvA1 < 1)) { if (areCoDirected) { inters = new IntersD1(0, paramBInvA0, paramAInvB1, 1, new SegD(a0, b1), false); return(true); } else { inters = new IntersD1(0, paramBInvA0, paramAInvB0, 0, new SegD(a0, b0), false); return(true); } } } } } throw new ExceptionGMath("Intersect", "RefineIntersLLD1", null); //return false; }
/* * INTERSECT: (LCurve, LCurve) * - both curves are supposed to be NON-DEGENERATED */ public static bool IntersectLL(LCurve lrsA, LCurve lrsB, out InfoInters inters) { inters = null; if ((lrsA.IsDegen) || (lrsB.IsDegen)) { throw new ExceptionGMath("Intersect", "IntersectLL(lrs,lrs)", null); } VecD a0 = lrsA.Start; VecD a1 = lrsA.End; VecD b0 = lrsB.Start; VecD b1 = lrsB.End; VecD dirA = lrsA.DirTang; VecD dirB = lrsB.DirTang; double det = dirA.Cross(dirB); // lrsA and lrsB are not parallel if (Math.Abs(det) > MConsts.EPS_DEC) { double lenA = (a1 - a0).Norm; double lenB = (b1 - b0).Norm; VecD diff = b0 - a0; Param parA = (diff.Cross(dirB)) / (det * lenA); Param parB = (diff.Cross(dirA)) / (det * lenB); if (lrsA.IsEvaluableStrict(parA) && lrsB.IsEvaluableStrict(parB)) { VecD pnt = 0.5 * (lrsA.Evaluate(parA) + lrsB.Evaluate(parB)); inters = new IntersD0(parA, parB, pnt, false); } return(true); } // lrsA and lrsB are parallel LineD lineB = new LineD(lrsB); Param paramBInvA0, paramBInvA1; VecD pntProjA0, pntProjA1; a0.Project(lineB, out paramBInvA0, out pntProjA0); a1.Project(lineB, out paramBInvA1, out pntProjA1); double distA0 = a0.Dist(pntProjA0); double distA1 = a1.Dist(pntProjA1); if ((distA0 < MConsts.EPS_DEC) || (distA1 < MConsts.EPS_DEC)) { // lrsA and lrsB are colinear Param.TypeParam typeA0 = lrsB.ParamClassify(paramBInvA0); Param.TypeParam typeA1 = lrsB.ParamClassify(paramBInvA1); int mult = (int)typeA0 * (int)typeA1; if (mult == 4) { return(true); } else if (mult == 1) { throw new ExceptionGMath("Intersect", "IntersectLL(lrs,lrs)", null); // lrsA is degenerated //return false; } else if (mult == 2) { if ((typeA0 == Param.TypeParam.Start) && (typeA1 == Param.TypeParam.Before)) { inters = new IntersD0(0, 0, a0, false); } if ((typeA0 == Param.TypeParam.Before) && (typeA1 == Param.TypeParam.Start)) { inters = new IntersD0(1, 0, a1, false); } if ((typeA0 == Param.TypeParam.End) && (typeA1 == Param.TypeParam.After)) { inters = new IntersD0(0, 1, a0, false); } if ((typeA0 == Param.TypeParam.After) && (typeA1 == Param.TypeParam.End)) { inters = new IntersD0(1, 1, a1, false); } return(true); } else if (mult <= 0) { return(Inters.RefineIntersLLD1(lrsA, lrsB, out inters)); } } return(true); }
/* * REFINE INTERSECTION D1 */ public static bool RefineIntersBBD1(BCurve curveA, BCurve curveB, out InfoInters inters) { /* * ASSUMPTIONS: * - curveA & curveB are MAXIMALLY REDUCED * - intersection is KNOWN to have dimension D1 * - does not work in case of SI beziers * => OR: both curveA & curveB are SEGMENTS * OR: both curveA & curveB are BEZIER */ inters = null; InfoInters selfinters; if (curveA.IsSelfInters(out selfinters) || curveB.IsSelfInters(out selfinters)) { throw new ExceptionGMath("Intersect", "RefineIntersBBD1", null); //return false; } VecD a0 = curveA.Start; VecD a1 = curveA.End; Param paramBInvA0, paramBInvA1; bool isOn; if (!a0.InverseOn(curveB, out isOn, out paramBInvA0) || (!isOn)) { return(false); } if (!a1.InverseOn(curveB, out isOn, out paramBInvA1) || (!isOn)) { return(false); } paramBInvA0.Round(0, 1); paramBInvA1.Round(0, 1); bool areCoDirected = (paramBInvA1 >= paramBInvA0); if (!areCoDirected) { BCurve revB = curveB.Reversed as BCurve; if (!Inters.RefineIntersBBD1(curveA, revB, out inters)) { return(false); } if (inters != null) { inters.ParamReverse(1, 1); } return(true); } VecD b0 = curveB.Start; VecD b1 = curveB.End; Param paramAInvB0, paramAInvB1; if (!b0.InverseOn(curveA, out isOn, out paramAInvB0) || (!isOn)) { return(false); } if (!b1.InverseOn(curveA, out isOn, out paramAInvB1) || (!isOn)) { return(false); } paramAInvB0.Round(0, 1); paramAInvB1.Round(0, 1); Param paramInA = null, paramInB = null, paramOutA = null, paramOutB = null; VecD pntIn = null, pntOut = null; if (paramBInvA0 <= 0) // before or start { paramInA = paramAInvB0; paramInB = 0; pntIn = b0; } else if (paramBInvA0 < 1) // inner { paramInA = 0; paramInB = paramBInvA0; pntIn = a0; } if ((paramBInvA1 >= 0) && (paramBInvA1 <= 1)) // inner or end { paramOutA = 1; paramOutB = paramBInvA1; pntOut = a1; } else if (paramBInvA1 > 1) // after { paramOutA = paramAInvB1; paramOutB = 1; pntOut = b1; } if ((pntIn == null) || (pntOut == null)) { throw new ExceptionGMath("Intersect", "RefineIntersBBD1", null); //return false; } Curve curveInters = curveA.SubCurve(paramInA, paramOutA); inters = new IntersD1(paramInA, paramInB, paramOutA, paramOutB, curveInters, false); return(true); }
public void Add(InfoInters inters) { this.linters.Add(inters); }
/* * METHODS: GEOMETRICAL */ public bool IsSelfInters(out InfoInters inters) { inters = null; return(false); }
/* * REFINE INTERSECTION D1 */ public static bool RefineIntersBBD1(BCurve curveA, BCurve curveB, out InfoInters inters) { /* * ASSUMPTIONS: * - curveA & curveB are MAXIMALLY REDUCED * - intersection is KNOWN to have dimension D1 * - does not work in case of SI beziers * => OR: both curveA & curveB are SEGMENTS * OR: both curveA & curveB are BEZIER */ inters=null; InfoInters selfinters; if (curveA.IsSelfInters(out selfinters)||curveB.IsSelfInters(out selfinters)) { throw new ExceptionGMath("Intersect","RefineIntersBBD1",null); //return false; } VecD a0=curveA.Start; VecD a1=curveA.End; Param paramBInvA0, paramBInvA1; bool isOn; if (!a0.InverseOn(curveB, out isOn, out paramBInvA0)||(!isOn)) return false; if (!a1.InverseOn(curveB, out isOn, out paramBInvA1)||(!isOn)) return false; paramBInvA0.Round(0,1); paramBInvA1.Round(0,1); bool areCoDirected=(paramBInvA1>=paramBInvA0); if (!areCoDirected) { BCurve revB=curveB.Reversed as BCurve; if (!Inters.RefineIntersBBD1(curveA,revB,out inters)) return false; if (inters!=null) { inters.ParamReverse(1,1); } return true; } VecD b0=curveB.Start; VecD b1=curveB.End; Param paramAInvB0, paramAInvB1; if (!b0.InverseOn(curveA, out isOn, out paramAInvB0)||(!isOn)) return false; if (!b1.InverseOn(curveA, out isOn, out paramAInvB1)||(!isOn)) return false; paramAInvB0.Round(0,1); paramAInvB1.Round(0,1); Param paramInA=null, paramInB=null, paramOutA=null, paramOutB=null; VecD pntIn=null, pntOut=null; if (paramBInvA0<=0) // before or start { paramInA=paramAInvB0; paramInB=0; pntIn=b0; } else if (paramBInvA0<1) // inner { paramInA=0; paramInB=paramBInvA0; pntIn=a0; } if ((paramBInvA1>=0)&&(paramBInvA1<=1)) // inner or end { paramOutA=1; paramOutB=paramBInvA1; pntOut=a1; } else if (paramBInvA1>1) // after { paramOutA=paramAInvB1; paramOutB=1; pntOut=b1; } if ((pntIn==null)||(pntOut==null)) { throw new ExceptionGMath("Intersect","RefineIntersBBD1",null); //return false; } Curve curveInters=curveA.SubCurve(paramInA,paramOutA); inters=new IntersD1(paramInA,paramInB, paramOutA,paramOutB,curveInters,false); return true; }
/* * INTERSECT: (LCurve, LCurve) * - both curves are supposed to be NON-DEGENERATED */ public static bool IntersectLL(LCurve lrsA, LCurve lrsB, out InfoInters inters) { inters=null; if ((lrsA.IsDegen)||(lrsB.IsDegen)) { throw new ExceptionGMath("Intersect","IntersectLL(lrs,lrs)",null); } VecD a0=lrsA.Start; VecD a1=lrsA.End; VecD b0=lrsB.Start; VecD b1=lrsB.End; VecD dirA=lrsA.DirTang; VecD dirB=lrsB.DirTang; double det = dirA.Cross(dirB); // lrsA and lrsB are not parallel if (Math.Abs(det)>MConsts.EPS_DEC) { double lenA = (a1-a0).Norm; double lenB = (b1-b0).Norm; VecD diff = b0-a0; Param parA = (diff.Cross(dirB))/(det*lenA); Param parB = (diff.Cross(dirA))/(det*lenB); if (lrsA.IsEvaluableStrict(parA)&&lrsB.IsEvaluableStrict(parB)) { VecD pnt = 0.5*(lrsA.Evaluate(parA)+lrsB.Evaluate(parB)); inters=new IntersD0(parA,parB,pnt,false); } return true; } // lrsA and lrsB are parallel LineD lineB=new LineD(lrsB); Param paramBInvA0, paramBInvA1; VecD pntProjA0, pntProjA1; a0.Project(lineB, out paramBInvA0, out pntProjA0); a1.Project(lineB, out paramBInvA1, out pntProjA1); double distA0=a0.Dist(pntProjA0); double distA1=a1.Dist(pntProjA1); if ((distA0<MConsts.EPS_DEC)||(distA1<MConsts.EPS_DEC)) { // lrsA and lrsB are colinear Param.TypeParam typeA0=lrsB.ParamClassify(paramBInvA0); Param.TypeParam typeA1=lrsB.ParamClassify(paramBInvA1); int mult=(int)typeA0*(int)typeA1; if (mult==4) { return true; } else if (mult==1) { throw new ExceptionGMath("Intersect","IntersectLL(lrs,lrs)",null); // lrsA is degenerated //return false; } else if (mult==2) { if ((typeA0==Param.TypeParam.Start)&& (typeA1==Param.TypeParam.Before)) { inters=new IntersD0(0,0,a0,false); } if ((typeA0==Param.TypeParam.Before)&& (typeA1==Param.TypeParam.Start)) { inters=new IntersD0(1,0,a1,false); } if ((typeA0==Param.TypeParam.End)&& (typeA1==Param.TypeParam.After)) { inters=new IntersD0(0,1,a0,false); } if ((typeA0==Param.TypeParam.After)&& (typeA1==Param.TypeParam.End)) { inters=new IntersD0(1,1,a1,false); } return true; } else if (mult<=0) { return (Inters.RefineIntersLLD1(lrsA,lrsB,out inters)); } } return true; }
public bool RayParity(RayD ray, CParam parStartRay, out MConsts.TypeParity typeParity) { /* * ASSUMPTIONS * INPUT: * - (parStartRay==null) is the ray does not start at * the contour * RETURN VALUE; * - (false) in case of real failure; * (true)+(typeParity==Undef) in unclear cases * */ typeParity = MConsts.TypeParity.Undef; ListInfoInters linters = new ListInfoInters(); bool isStartIntersFound = false; for (int pozKnot = 0; pozKnot < this.NumKnot; pozKnot++) { BCurve curve = this.CurveByPoz(pozKnot); if (curve != null) { Knot knot = this.KnotByPoz(pozKnot); int numIntersBefore = linters.Count; if (!Inters.IntersectBL(curve, ray, linters)) { linters.ClearDestroy(); return(false); } int numIntersAfter = linters.Count; if (numIntersAfter != numIntersBefore) { InfoInters inters; if ((curve.IsDegen) || (curve.IsSelfInters(out inters))) { linters.ClearDestroy(); return(true); } } bool isRayStartOnCurve = ((parStartRay != null) && (parStartRay.IndKnot == knot.IndexKnot)); for (int iInters = numIntersBefore; iInters < numIntersAfter; iInters++) { InfoInters inters = linters[iInters] as InfoInters; if (inters.Dim == InfoInters.TypeDim.Dim1) { linters.ClearDestroy(); return(true); } IntersD0 intersD0 = inters as IntersD0; double parValCurve = intersD0.Ipi.Par(0).Val; double parValRay = intersD0.Ipi.Par(1).Val; if (Math.Abs(parValRay) < MConsts.EPS_DEC) { if ((!isRayStartOnCurve) || (isRayStartOnCurve && isStartIntersFound)) { linters.ClearDestroy(); return(true); } isStartIntersFound = true; } if ((Math.Abs(parValCurve) < MConsts.EPS_DEC_WEAK) || (Math.Abs(1.0 - parValCurve) < MConsts.EPS_DEC_WEAK)) { linters.ClearDestroy(); return(true); } VecD dirTangCurve = curve.DirTang(parValCurve); VecD dirTangRay = (ray as LCurve).DirTang; if ((dirTangCurve == null) || (dirTangRay == null)) { linters.ClearDestroy(); return(true); } if (Math.Abs(dirTangRay.Cross(dirTangCurve)) < MConsts.EPS_DEC_WEAK) { linters.ClearDestroy(); return(true); } } if ((isRayStartOnCurve) && (!isStartIntersFound)) { linters.ClearDestroy(); return(true); } } } int numIntersAll = (isStartIntersFound)? linters.Count - 1: linters.Count; typeParity = (numIntersAll % 2 == 0)? MConsts.TypeParity.Even: MConsts.TypeParity.Odd; linters.ClearDestroy(); return(true); }