Пример #1
0
        //------------------------------------------------------------------------
        Perspective premultiply(Perspective b)
        {
            Perspective a = new Perspective(this);

            sx  = a.sx * b.sx + a.shx * b.shy + a.tx * b.w0;
            shx = a.sx * b.shx + a.shx * b.sy + a.tx * b.w1;
            tx  = a.sx * b.tx + a.shx * b.ty + a.tx * b.w2;
            shy = a.shy * b.sx + a.sy * b.shy + a.ty * b.w0;
            sy  = a.shy * b.shx + a.sy * b.sy + a.ty * b.w1;
            ty  = a.shy * b.tx + a.sy * b.ty + a.ty * b.w2;
            w0  = a.w0 * b.sx + a.w1 * b.shy + a.w2 * b.w0;
            w1  = a.w0 * b.shx + a.w1 * b.sy + a.w2 * b.w1;
            w2  = a.w0 * b.tx + a.w1 * b.ty + a.w2 * b.w2;
            return(this);
        }
Пример #2
0
 public ICoordTransformer MultiplyWith(ICoordTransformer another)
 {
     if (another is Affine)
     {
         return(this * (Affine)another);
     }
     else if (another is Perspective)
     {
         Perspective p = new Perspective(this);
         return(p * (Perspective)another);
     }
     else
     {
         return(new CoordTransformationChain(this, another));
     }
 }
Пример #3
0
 ICoordTransformer ICoordTransformer.MultiplyWith(ICoordTransformer another)
 {
     if (another is Affine)
     {
         return(this * (Affine)another);
     }
     else if (another is Perspective)
     {
         Perspective p = new Perspective(this);
         return(p * (Perspective)another);
     }
     else
     {
         return(null);
     }
 }
Пример #4
0
        unsafe bool InternalGenerateQuadToQuad(double *qs_h, double *qdHead)
        {
            Perspective p = new Perspective();

            if (!square_to_quad(qs_h))
            {
                return(false);
            }

            invert();
            //---------------------------------
            if (!p.square_to_quad(qdHead))
            {
                return(false);
            }
            multiply(p);
            return(true);
        }
Пример #5
0
 // From trans_perspective
 public Perspective(Perspective a)
 {
     sx  = a.sx; shy = a.shy; w0 = a.w0;
     shx = a.shx; sy = a.sy; w1 = a.w1;
     tx  = a.tx; ty = a.ty; w2 = a.w2;
 }