Exemplo n.º 1
0
        public void InnerOuterByOutline(Outline outl,
                                        out MConsts.TypeInnerOuter typeInnerOuter)
        {
            typeInnerOuter = MConsts.TypeInnerOuter.Undef;

            RayD   ray;
            CParam parStartRay;

            MConsts.TypeParity typeParityContour, typeParityAll = MConsts.TypeParity.Even;

            int iTrial;

            for (iTrial = 0; iTrial < MConsts.MAX_RAY_INTERS_TRIAL; iTrial++)
            {
                try
                {
                    typeParityAll = MConsts.TypeParity.Even;
                    if (!this.RayAlmostNormal(out ray, out parStartRay))
                    {
                        continue;
                    }
                    int pozCont;
                    for (pozCont = 0; pozCont < outl.NumCont; pozCont++)
                    {
                        Contour cont = outl.ContourByPoz(pozCont);
                        if (cont == this)
                        {
                            continue;
                        }
                        if (!cont.RayParity(ray, null, out typeParityContour))
                        {
                            break;
                        }
                        if (typeParityContour == MConsts.TypeParity.Undef)
                        {
                            break;
                        }
                        typeParityAll = (typeParityAll == typeParityContour)?
                                        MConsts.TypeParity.Even: MConsts.TypeParity.Odd;
                    }
                    if (pozCont != outl.NumCont)
                    {
                        continue;    // parity failed for one of contours
                    }
                }
                catch (ExceptionGMath)
                {
                    continue;
                }
                break;                // the result is clear, stop trials
            }
            if (iTrial == MConsts.MAX_RAY_INTERS_TRIAL)
            {
                return;                // typeInnerOuter is undefined
            }
            typeInnerOuter = (typeParityAll == MConsts.TypeParity.Even)?
                             MConsts.TypeInnerOuter.Outer: MConsts.TypeInnerOuter.Inner;
        }
Exemplo n.º 2
0
 public bool OutlineAdd(Outline outl, MatrixD trD)
 {
     if ((outl == null) || (trD == null))
     {
         throw new ExceptionGMath("Outline", "OutlineAdd", null);
         //return false;
     }
     for (int pozCont = 0; pozCont < outl.NumCont; pozCont++)
     {
         Contour cont = new Contour(outl.ContourByPoz(pozCont));
         cont.Transform(trD);
         this.ContourAdd(cont);
     }
     this.ReNumber();
     return(true);
 }
Exemplo n.º 3
0
        public void InnerOuterByOutline(Outline outl, 
            out MConsts.TypeInnerOuter typeInnerOuter)
        {
            typeInnerOuter=MConsts.TypeInnerOuter.Undef;

            RayD ray;
            CParam parStartRay;
            MConsts.TypeParity typeParityContour, typeParityAll=MConsts.TypeParity.Even; 

            int iTrial;
            for (iTrial=0; iTrial<MConsts.MAX_RAY_INTERS_TRIAL; iTrial++)
            {
                try
                {
                    typeParityAll=MConsts.TypeParity.Even;
                    if (!this.RayAlmostNormal(out ray, out parStartRay))
                    {
                        continue;
                    }
                    int pozCont;
                    for (pozCont=0; pozCont<outl.NumCont; pozCont++)
                    {
                        Contour cont=outl.ContourByPoz(pozCont);
                        if (cont==this)
                            continue;
                        if (!cont.RayParity(ray,null,out typeParityContour))
                            break;
                        if (typeParityContour==MConsts.TypeParity.Undef)
                            break;
                        typeParityAll=(typeParityAll==typeParityContour)? 
                            MConsts.TypeParity.Even: MConsts.TypeParity.Odd;
                    }
                    if (pozCont!=outl.NumCont) 
                        continue;    // parity failed for one of contours
                }
                catch (ExceptionGMath)
                {
                    continue;
                }
                break;                // the result is clear, stop trials
            }
            if (iTrial==MConsts.MAX_RAY_INTERS_TRIAL) 
            {
                return;                // typeInnerOuter is undefined
            }
            typeInnerOuter=(typeParityAll==MConsts.TypeParity.Even)? 
                MConsts.TypeInnerOuter.Outer: MConsts.TypeInnerOuter.Inner;
        }
Exemplo n.º 4
0
 public bool OutlineAdd(Outline outl, MatrixD trD)
 {
     if ((outl==null)||(trD==null))
     {
         throw new ExceptionGMath("Outline","OutlineAdd",null);
         //return false;
     }
     for (int pozCont=0; pozCont<outl.NumCont; pozCont++)
     {
         Contour cont=new Contour(outl.ContourByPoz(pozCont));
         cont.Transform(trD);
         this.ContourAdd(cont);
     }
     this.ReNumber();
     return true;
 }