Beispiel #1
0
 public MatrixD(MatrixD matrix)
 {
     this.tr=new double[3,2];
     for (int i=0; i<3; i++)
         for (int j=0; j<2; j++)
             this.tr[i,j]=matrix[i,j];
 }
        /*
         *        METHODS:    CCURVE
         */

        public void Transform(MatrixD m)
        {
            if (this.knots==null)
                return;
            foreach (Knot knot in this.knots)
                knot.Transform(m);
        }
Beispiel #3
0
 /*
  *        METHODS:    I_TRANSFORMABLE
  */
 public void Transform(MatrixD m)
 {
     if (this.conts==null)
         return;
     foreach (Contour cont in this.conts)
     {
         cont.Transform(m);
     }
 }
Beispiel #4
0
        public bool LoadComponent(Component component, 
            Outline outl, 
            out ArrayList errsLoadComponent)
        {
            isChangedByRound=false;
            errsLoadComponent=null;
            int numKnotBeforeLoad=this.NumKnot;
            int numContBeforeLoad=this.NumCont;
            if (outl==null)
            {
                throw new ExceptionGMath("Outline","LoadComponent",null);
                //return false;
            }
            // validate 
            OTF2Dot14[,] trOTF2Dot14=component.TrOTF2Dot14;

            if (trOTF2Dot14!=null)
            {
                if (Math.Abs((double)trOTF2Dot14[0,0]*(double)trOTF2Dot14[1,1]-
                    (double)trOTF2Dot14[0,1]*(double)trOTF2Dot14[1,0])<MConsts.EPS_COMP)
                {
                    if (errsLoadComponent==null)
                        errsLoadComponent=new ArrayList();
                    errsLoadComponent.Add(Component.TypeErrLoadComponent.IncorrectTransform);
                }
            }
            
            bool isShiftByKnots, isShiftByVec;
            int indKnotAttGlyph=component.IndexKnotAttGlyph;
            int indKnotAttComponent=component.IndexKnotAttComponent;
            isShiftByKnots=((indKnotAttGlyph!=GConsts.IND_UNINITIALIZED)&&
                (indKnotAttComponent!=GConsts.IND_UNINITIALIZED));
            isShiftByVec=(component.Shift!=null);
            if ((isShiftByKnots&&isShiftByVec)||
                ((!isShiftByKnots)&&(!isShiftByVec)))
            {
                if (errsLoadComponent==null)
                    errsLoadComponent=new ArrayList();
                errsLoadComponent.Add(Component.TypeErrLoadComponent.IncorrectShiftSpecification);
            }
        
            if (isShiftByKnots)
            {
                if ((indKnotAttGlyph<0)||(indKnotAttGlyph>=this.NumKnot))
                {
                    if (errsLoadComponent==null)
                        errsLoadComponent=new ArrayList();
                    errsLoadComponent.Add(Component.TypeErrLoadComponent.IncorrectIndexKnotGlyph);
                }
                if ((indKnotAttComponent<0)||(indKnotAttComponent>=outl.NumKnot))
                {
                    if (errsLoadComponent==null)
                        errsLoadComponent=new ArrayList();
                    errsLoadComponent.Add(Component.TypeErrLoadComponent.IncorrectIndexKnotComponent);
                }
            }
            if (errsLoadComponent!=null)
                return true;

            // load
            VecD trShift;
            if (isShiftByKnots)
            {
                Knot knAttGlyph=this.KnotByInd(indKnotAttGlyph);
                Knot knAttComponent=outl.KnotByInd(indKnotAttComponent);
                if ((knAttGlyph==null)||(knAttComponent==null))
                {
                    throw new ExceptionGMath("Outline","LoadComponent",null);
                }
                trShift=knAttGlyph.Val-knAttComponent.Val; // TODO: check !!!
            }
            else
            {
                trShift=component.Shift;
            }
            MatrixD trD=new MatrixD(trOTF2Dot14,trShift);
            component.TrD=trD;
            component.NumKnot=outl.NumKnot;
            component.NumCont=outl.NumCont;
            component.IndKnotStart=numKnotBeforeLoad;
            component.PozContStart=numContBeforeLoad;

            this.OutlineAdd(outl,trD);
            bool isChangedByRoundCur;
            this.FURound(out isChangedByRoundCur);
            if (isChangedByRoundCur)
            {
                this.isChangedByRound=true;
            }
            return true;
        }
Beispiel #5
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;
 }
Beispiel #6
0
 public void Transform(MatrixD m)
 {
     throw new ExceptionGMath("RayD","Transform","NOT IMPLEMENTED");
 }
Beispiel #7
0
 internal void ClearRelease()
 {
     this.shift=null;
     this.trOTF2Dot14=null;
     this.trD=null;
 }
Beispiel #8
0
 public Component(Component component)
 {
     this.indGlyphComponent=component.IndexGlyphComponent;
     this.indKnotAttGlyph=component.IndexKnotAttGlyph;
     this.indKnotAttComponent=component.IndexKnotAttComponent;
     this.shift=component.Shift;
     this.trOTF2Dot14=component.TrOTF2Dot14;
     this.trD=component.TrD;
     this.numKnot=component.NumKnot;
     this.numCont=component.NumCont;
     this.indKnotStart=component.IndKnotStart;
     this.pozContStart=component.PozContStart;
 }
Beispiel #9
0
 public Component(int indexGlyphComponent)
 {
     this.indGlyphComponent=indexGlyphComponent;
     this.indKnotAttGlyph=GConsts.IND_UNINITIALIZED;
     this.indKnotAttComponent=GConsts.IND_UNINITIALIZED;
     this.shift=null;
     this.trOTF2Dot14=null;
     this.trD=null;
     this.numKnot=GConsts.IND_UNINITIALIZED;
     this.numCont=GConsts.IND_UNINITIALIZED;
     this.indKnotStart=GConsts.IND_UNINITIALIZED;
     this.pozContStart=GConsts.IND_UNINITIALIZED;
 }
Beispiel #10
0
 public void Transform(MatrixD m)
 {
     this.cp.Transform(m);
 }
Beispiel #11
0
 public void Transform(MatrixD m)
 {
     this.cp[0].Transform(m);
     this.cp[1].Transform(m);
     this.cp[2].Transform(m);
 }
Beispiel #12
0
 public void Transform(MatrixD m)
 {
     throw new ExceptionGMath("LineD", "Transform", "NOT IMPLEMENTED");
 }
Beispiel #13
0
 /*
  *        METHODS
  */
 public void From(MatrixD matrix)
 {
     for (int i=0; i<3; i++)
         for (int j=0; j<2; j++)
             this.tr[i,j]=matrix[i,j];
 }
Beispiel #14
0
 public void Transform(MatrixD m)
 {
     this.cp.Transform(m);
 }
Beispiel #15
0
 public VecD Transformed(MatrixD m)
 {
     VecD vec=new VecD(this);
     vec.Transform(m);
     return vec;
 }
Beispiel #16
0
 /*
  *        METHODS: GEOMETRICAL
  */
 public void Transform(MatrixD m)
 {
     // vector * matrix
     this.x=m[0,0]*this.x+m[1,0]*this.y+m[2,0];
     this.y=m[0,1]*this.x+m[1,1]*this.y+m[2,1];
 }