PixelFarm.Agg.Lines.LineParameters.Divide C# (CSharp) Method

Divide() public method

public Divide ( LineParameters &lp1, LineParameters &lp2 ) : void
lp1 LineParameters
lp2 LineParameters
return void
        public void Divide(out LineParameters lp1, out LineParameters lp2)
        {
            int xmid = (x1 + x2) >> 1;
            int ymid = (y1 + y2) >> 1;
            int len2 = len >> 1;
            //lp1 = this; // it is a struct so this is a copy
            //lp2 = this; // it is a struct so this is a copy

            lp1 = new LineParameters(this.x1, this.y1, this.x2, this.y2, this.len);
            lp2 = new LineParameters(this.x1, this.y1, this.x2, this.y2, this.len);
            lp1.x2 = xmid;
            lp1.y2 = ymid;
            lp1.len = len2;
            lp1.dx = Math.Abs(lp1.x2 - lp1.x1);
            lp1.dy = Math.Abs(lp1.y2 - lp1.y1);
            lp2.x1 = xmid;
            lp2.y1 = ymid;
            lp2.len = len2;
            lp2.dx = Math.Abs(lp2.x2 - lp2.x1);
            lp2.dy = Math.Abs(lp2.y2 - lp2.y1);
        }
    };

Usage Example

Exemplo n.º 1
0
        void Line2NoClip(LineParameters lp, int ex, int ey)
        {
            if (lp.len > LineAA.MAX_LENGTH)
            {
                LineParameters lp1, lp2;
                lp.Divide(out lp1, out lp2);
                Line2NoClip(lp1, lp1.x2 + (lp1.y2 - lp1.y1), lp1.y2 - (lp1.x2 - lp1.x1));
                Line2NoClip(lp2, (lp.x2 + ex) >> 1, (lp.y2 + ey) >> 1);
                return;
            }

            LineAA.FixDegenBisectrixEnd(lp, ref ex, ref ey);
            LineInterpolatorAA2 li = new LineInterpolatorAA2(this, lp, ex, ey);

            if (li.IsVertical)
            {
                while (li.StepV())
                {
                    ;
                }
            }
            else
            {
                while (li.StepH())
                {
                    ;
                }
            }
        }
All Usage Examples Of PixelFarm.Agg.Lines.LineParameters::Divide