コード例 #1
0
ファイル: PlaneGetter.cs プロジェクト: olitur/Bowerbird
        private static void DrawPlane(DisplayPipeline di, RhinoViewport vp, Plane plane)
        {
            double num;

            if (!vp.GetWorldToScreenScale(plane.Origin, out num))
                return;

            var unit = 10.0;

            if ((unit * num) < 20.0)
                unit = 20.0 / num;

            unit *= 0.2;

            var min = -5;
            var max = 5;

            for (var x = min; x <= max; x++)
            {
                var p0 = plane.PointAt(min * unit, x * unit);
                var p1 = plane.PointAt(max * unit, x * unit);

                if (x == 0)
                {
                    var origin = plane.Origin;
                    di.DrawLine(p0, origin, Color.Gray);
                    di.DrawLine(origin, p1, Color.DarkRed, 3);
                    di.DrawArrowHead(p1, p1 - origin, Color.DarkRed, 0.0, 1.0 * unit);
                }
                else
                {
                    di.DrawLine(p0, p1, Color.Gray);
                }
            }

            for (var y = min; y <= max; y++)
            {
                var p0 = plane.PointAt(y * unit, min * unit);
                var p1 = plane.PointAt(y * unit, max * unit);

                if (y == 0)
                {
                    var origin = plane.Origin;
                    di.DrawLine(p0, origin, Color.Gray);
                    di.DrawLine(origin, p1, Color.DarkGreen, 3);
                    di.DrawArrowHead(p1, p1 - origin, Color.DarkGreen, 0.0, 1.0 * unit);
                }
                else
                {
                    di.DrawLine(p0, p1, Color.Gray);
                }
            }
        }