Exemple #1
0
        private void DrawText()
        {
            Space3D space = new Space3D();

            // Prepare text points and lines
            Text3D text = Text3D.FromString("This is a test string...", new Font("Times New Roman", 24), 10f, FontStyle.Regular, 50);

            // Set color for tag 1, if color is need to be specified directly use 0x7f000000 | rgb color (0xrrggbb)
            space.SetColor(0, Color.Black);
            space.Text(0, text, Text3DLocation.XY, Text3DFlip.None, 10f, 10f, 10f);

            text = Text3D.FromString("This is another test string...", new Font("Arial", 24), 10f, FontStyle.Bold, 50);
            space.Text(Form1.ColorToTag(Color.Orange), text, Text3DLocation.XZ, Text3DFlip.None, 10f, 10f, 10f);


            space.SetColor(1, Color.SandyBrown);
            space.SetColor(2, Color.RoyalBlue);
            space.SetColor(3, Color.SeaGreen);
            for (int i = 0; i < 5; i++)
            {
                text = Text3D.FromString(String.Format("String #{0}", i + 1), new Font("Courier New", 24), 10f, FontStyle.Italic, 50);
                space.Text(i % 4, text, Text3DLocation.YZ, Text3DFlip.None, 10f, 10f * (float)i, 10f);
            }


            this.view.Space = space;
        }
Exemple #2
0
        private void DrawChart()
        {
            Space3D space = new Space3D();

            space.SetColor(100, Color.LightGray);

            float h = 100f;

            Form1.DrawScale(space, h, DrawAxis.X);
            Form1.DrawScale(space, h, DrawAxis.Y);
            Form1.DrawScale(space, h, DrawAxis.Z);

            int steps = 40;

            Color[] gradient = ColorUtils.CreateGradient(Color.Red, Color.Green, steps, ColorGradientFlags.Empty, 0.5f);
            for (int i = 0; i < gradient.Length; i++)
            {
                space.SetColor(i, gradient[i]);
            }


            float step = h / (float)steps;

            float x0 = 0f;

            for (int i = 0; i < steps; i++)
            {
                float y0 = 0f;
                float x1 = x0 + step;
                for (int j = 0; j < steps; j++)
                {
                    float y1 = y0 + step;
                    Form1.Plane(space, x0, y0, x1, y1, h, gradient.Length - 1);
                    y0 = y1;
                }
                x0 = x1;
            }


            this.view.Space = space;
        }