Exemple #1
0
        public void DrawAxis()
        {
            Vector3d p0;
            Vector3d p1;

            double wh = Math.Min(DC.ViewWidth, DC.ViewHeight) / 2;


            //double len = DrawingConst.AxisLength;
            //double arrowLen = 4.0 / DC.WorldScale;
            //double arrowW2 = 2.0 / DC.WorldScale;

            double len      = DC.DevSizeToWoldSize(wh - AXIS_MARGIN) * DC.WorldScale;
            double arrowLen = DC.DevSizeToWoldSize(16) * DC.WorldScale;
            double arrowW2  = DC.DevSizeToWoldSize(8) * DC.WorldScale;

            // X軸
            p0 = new Vector3d(-len, 0, 0) / DC.WorldScale;
            p1 = new Vector3d(len, 0, 0) / DC.WorldScale;

            if (!CadMath.IsParallel(p1 - p0, (Vector3d)DC.ViewDir))
            {
                DrawArrow(DC.GetPen(DrawTools.PEN_AXIS_X), p0, p1, ArrowTypes.CROSS, ArrowPos.END, arrowLen, arrowW2);
            }

            // Y軸
            p0 = new Vector3d(0, -len, 0) / DC.WorldScale;
            p1 = new Vector3d(0, len, 0) / DC.WorldScale;

            if (!CadMath.IsParallel(p1 - p0, (Vector3d)DC.ViewDir))
            {
                DrawArrow(DC.GetPen(DrawTools.PEN_AXIS_Y), p0, p1, ArrowTypes.CROSS, ArrowPos.END, arrowLen, arrowW2);
            }

            // Z軸
            p0 = new Vector3d(0, 0, -len) / DC.WorldScale;
            p1 = new Vector3d(0, 0, len) / DC.WorldScale;

            if (!CadMath.IsParallel(p1 - p0, (Vector3d)DC.ViewDir))
            {
                DrawArrow(DC.GetPen(DrawTools.PEN_AXIS_Z), p0, p1, ArrowTypes.CROSS, ArrowPos.END, arrowLen, arrowW2);
            }
        }