Beispiel #1
0
        private ObjFigu cnvCruveToFigu(ClsAtrXY atrxy0, ClsAtrXY atrxy1, ClsAtrXY atrxy2, ClsAtrXY atrxy3)
        {
            ObjFigu    objFigu;
            int        atr0, atr1, atr2;
            double     x0, y0, x1, y1, x2, y2, x3, y3;
            ClsBeze    bz;
            ClsPairRag pr;
            ClsPoint   pt;

            objFigu      = new ObjFigu();
            objFigu.kind = Constants.BEZEKIND;
            objFigu.x1   = atrxy1.x; objFigu.y1 = atrxy1.y;
            objFigu.x4   = atrxy2.x; objFigu.y4 = atrxy2.y;
            atr0         = atrxy0.atr;
            atr1         = atrxy1.atr;
            atr2         = atrxy2.atr;
            x0           = atrxy0.x; y0 = atrxy0.y;
            x1           = atrxy1.x; y1 = atrxy1.y;
            x2           = atrxy2.x; y2 = atrxy2.y;
            x3           = atrxy3.x; y3 = atrxy3.y;
            pr           = new ClsPairRag();
            pr.srag      = m_libCurve.getCurveStartRag(atr0, atr1, x0, y0, x1, y1, x2, y2);
            pr.erag      = m_libCurve.getCurveEndRag(atr1, atr2, x1, y1, x2, y2, x3, y3);
            pr           = m_libCurve.legalCurveRag(pr);
            pt           = m_libCurve.getBezeControlPoint(x1, y1, x2, y2, pr.srag);
            objFigu.x2   = pt.x; objFigu.y2 = pt.y;
            pt           = m_libCurve.getBezeControlPoint(x2, y2, x1, y1, pr.erag);
            objFigu.x3   = pt.x; objFigu.y3 = pt.y;
            return(objFigu);
        }
Beispiel #2
0
        private ObjFigu cnvLineToFigu(ClsAtrXY atrxy1, ClsAtrXY atrxy2)
        {
            ObjFigu objFigu;

            objFigu      = new ObjFigu();
            objFigu.kind = Constants.LINEKIND;
            objFigu.x1   = atrxy1.x; objFigu.y1 = atrxy1.y;
            objFigu.x4   = atrxy2.x; objFigu.y4 = atrxy2.y;
            return(objFigu);
        }
Beispiel #3
0
        private ObjFigu cnvBezeToFigu(ClsAtrXY atrxy1, ClsAtrXY atrxy2, ClsAtrXY atrxy3, ClsAtrXY atrxy4)
        {
            ObjFigu objFigu;

            objFigu      = new ObjFigu();
            objFigu.kind = Constants.BEZEKIND;
            objFigu.x1   = atrxy1.x; objFigu.y1 = atrxy1.y;
            objFigu.x2   = atrxy2.x; objFigu.y2 = atrxy2.y;
            objFigu.x3   = atrxy3.x; objFigu.y3 = atrxy3.y;
            objFigu.x4   = atrxy4.x; objFigu.y4 = atrxy4.y;
            return(objFigu);
        }
Beispiel #4
0
        private byte[] AtrDXYSet(byte[] byteData, int pp, ClsAtrXY atrxy)
        {
            int bytep;
            int bitx, bity, ix, iy;

            bitx  = (byte)(atrxy.x) & 0x03;
            bity  = (byte)(atrxy.y) & 0x03;
            ix    = (int)(atrxy.x) >> 2;
            iy    = (int)(atrxy.y) >> 2;
            bytep = pp * Constants.ESF0SIZADD;
            byteData[bytep + Constants.ESF0ATRADD] = (byte)((bitx << 6) | (bity << 4) | atrxy.atr);
            byteData[bytep + Constants.ESF0XCDADD] = (byte)ix;
            byteData[bytep + Constants.ESF0YCDADD] = (byte)iy;
            return(byteData);
        }
Beispiel #5
0
        private ObjFigu cnvArcToFigu(ClsAtrXY atrxy1, ClsAtrXY atrxy2, ClsAtrXY atrxy3)
        {
            ObjFigu      objFigu;
            double       x1, y1, x2, y2, x3, y3;
            ClsArcCenter cntr;
            ClsArcSER    ser;
            ClsBeze      bz;
            double       rag;
            double       t1, t2;

            x1           = atrxy1.x;
            y1           = atrxy1.y;
            x2           = atrxy2.x;
            y2           = atrxy2.y;
            x3           = atrxy3.x;
            y3           = atrxy3.y;
            objFigu      = new ObjFigu();
            objFigu.kind = Constants.LINEKIND;
            objFigu.x1   = x1; objFigu.y1 = y1;
            objFigu.x4   = x3; objFigu.y4 = y3;
            cntr         = m_libCurve.getCurve3pCenter(x1, y1, x2, y2, x3, y3);
            if (cntr.stat == false)
            {
                return(objFigu);
            }
            ser = m_libCurve.getCurve3pRagR(x1, y1, x2, y2, x3, y3, cntr.x0, cntr.y0);
            if (ser.stat == false)
            {
                return(objFigu);
            }
            bz           = new ClsBeze();
            bz.x1        = x1; bz.y1 = y1;
            rag          = (ser.erag - ser.srag) / 3.0 + ser.srag;
            bz.x2        = Math.Cos(rag) * ser.dr + cntr.x0;
            bz.y2        = Math.Sin(rag) * ser.dr + cntr.y0;
            rag          = (ser.erag - ser.srag) / 3.0 * 2.0 + ser.srag;
            bz.x3        = Math.Cos(rag) * ser.dr + cntr.x0;
            bz.y3        = Math.Sin(rag) * ser.dr + cntr.y0;
            bz.x4        = x3; bz.y4 = y3;
            t1           = 1.0 / 3.0; t2 = 1.0 / 3.0 * 2.0;
            bz           = m_libCurve.cnvOnpointToCntrlpoint(bz, t1, t2);
            objFigu.kind = Constants.BEZEKIND;
            objFigu.x1   = bz.x1; objFigu.y1 = bz.y1;
            objFigu.x2   = bz.x2; objFigu.y2 = bz.y2;
            objFigu.x3   = bz.x3; objFigu.y3 = bz.y3;
            objFigu.x4   = bz.x4; objFigu.y4 = bz.y4;
            return(objFigu);
        }
Beispiel #6
0
        private ClsAtrXY FAtrDXYGet(byte[] byteData, int pp)
        {
            int      bytep;
            int      bitx, bity, ix, iy;
            ClsAtrXY atrxy;

            atrxy     = new ClsAtrXY();
            bytep     = pp * Constants.ESF0SIZADD;
            atrxy.atr = (byteData[bytep + Constants.ESF0ATRADD] & 0x0f);
            bitx      = (byteData[bytep + Constants.ESF0ATRADD] & 0xc0) >> 6;
            bity      = (byteData[bytep + Constants.ESF0ATRADD] & 0x30) >> 4;
            ix        = byteData[bytep + Constants.ESF0XCDADD];
            iy        = byteData[bytep + Constants.ESF0YCDADD];
            atrxy.x   = (double)(((ix << 2) & 0x3fc) | (bitx & 0x003));
            atrxy.y   = (double)(((iy << 2) & 0x3fc) | (bity & 0x003));
            return(atrxy);
        }