예제 #1
0
파일: MatrixX.cs 프로젝트: nakijun/adasg
 public void Rotate(float angle, MatrixOrderX order)
 {
     if (order == MatrixOrderX.Prepend)
     {
         MatrixFP m = MatrixFP.Identity();
         m.Rotate(MathFP.ToRadians(SingleFP.FromFloat(angle)));
         m.Multiply(matrix);
         matrix = m;
     }
     else
     {
         matrix.Rotate(MathFP.ToRadians(SingleFP.FromFloat(angle)));
     }
 }
예제 #2
0
파일: MatrixX.cs 프로젝트: nakijun/adasg
 public void RotateAt(float angle, PointF point, MatrixOrderX order)
 {
     if (order == MatrixOrderX.Prepend)
     {
         MatrixFP m = MatrixFP.Identity();
         m.Translate(SingleFP.FromFloat(-point.X), SingleFP.FromFloat(-point.Y));
         m.Rotate(MathFP.ToRadians(SingleFP.FromFloat(angle)));
         m.Multiply(matrix);
         m.Translate(SingleFP.FromFloat(point.X), SingleFP.FromFloat(point.Y));
         matrix = m;
     }
     else
     {
         matrix.Translate(SingleFP.FromFloat(-point.X), SingleFP.FromFloat(-point.Y));
         matrix.Rotate(MathFP.ToRadians(SingleFP.FromFloat(angle)));
         matrix.Translate(SingleFP.FromFloat(point.X), SingleFP.FromFloat(point.Y));
     }
 }
예제 #3
0
        public GradientBrushFP(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_angle, int type)
        {
            bounds.Reset(ff_xmin, ff_ymin,
                         ff_xmax == ff_xmin ? ff_xmin + 1 : ff_xmax,
                         ff_ymax == ff_ymin ? ff_ymin + 1 : ff_ymax);
            matrix = new MatrixFP();
            matrix.Translate(-(ff_xmin + ff_xmax) / 2, -(ff_ymin + ff_ymax) / 2);
            matrix.Rotate(-ff_angle);
            this.type = type;
            if (type == RADIAL_GRADIENT)
            {
                matrix.Scale(MathFP.Div(SingleFP.One, bounds.Width), MathFP.Div(SingleFP.One, bounds.Height));
            }
            int ff_ang = MathFP.Atan(MathFP.Div(bounds.Height, bounds.Width == 0 ? 1 : bounds.Width));
            int ff_len = PointFP.Distance(bounds.Height, bounds.Width);

            ff_length = MathFP.Mul(ff_len, MathFP.Max(
                                       MathFP.Abs(MathFP.Cos(ff_angle - ff_ang)),
                                       MathFP.Abs(MathFP.Cos(ff_angle + ff_ang))));
        }