コード例 #1
0
ファイル: Map.cs プロジェクト: GJiin/meridian59-dotnet
        protected void DrawWall(Graphics G, RooWall Wall, Pen Pen, bool Infinite, Pen PenInfinite)
        {
            V2 p1p2;

            // transform points to match world of pixeldrawing
            float transx1 = (float)(Wall.P1.X - boxMin.X) * ZoomInv;
            float transy1 = (float)(Wall.P1.Y - boxMin.Y) * ZoomInv;
            float transx2 = (float)(Wall.P2.X - boxMin.X) * ZoomInv;
            float transy2 = (float)(Wall.P2.Y - boxMin.Y) * ZoomInv;

            // draw extensions of line
            if (Infinite)
            {
                V2 p1 = new V2(transx1, transy1);
                V2 p2 = new V2(transx2, transy2);
                p1p2 = p2 - p1;

                p2 += 1000f * p1p2;
                p1 -= 1000f * p1p2;

                G.DrawLine(PenInfinite, (float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y);
            }

            // check if this is an issue line (almost horizontal or vertical, but not fully)
            p1p2 = Wall.GetP1P2();
            if (chkVertHortLines.Checked && p1p2.X != 0.0f && p1p2.Y != 0.0f)
            {
                Real m = (Real)(p1p2.Y / p1p2.X);

                if ((m > -0.125f && m < 0.125f) ||
                    (m > 8.0f || m < -8.0f))
                        Pen = penRed2;
            }
            
            // draw line
            G.DrawLine(Pen, transx1, transy1, transx2, transy2);           
        }