Ejemplo n.º 1
0
        // Define the model.
        private void DefineModel(Model3DGroup group)
        {
            //// Verify the tetrahedron calculations.
            //MeshExtensions.VerifyTetrahedron();

            // Show the axes.
            MeshExtensions.AddAxes(group);

            const double scale = 5;

            // Make a solid insphere.
            MeshGeometry3D mesh1 = new MeshGeometry3D();

            mesh1.AddSphere(D3.Origin, G3.TetrahedronInradius(), 60, 30, true);
            mesh1.ApplyTransformation(new ScaleTransform3D(scale, scale, scale));
            group.Children.Add(mesh1.MakeModel(Brushes.Red));

            // Make a translucent tetrahedron.
            MeshGeometry3D mesh2 = new MeshGeometry3D();

            mesh2.AddTetrahedron();
            mesh2.ApplyTransformation(new ScaleTransform3D(scale, scale, scale));
            Brush         brush  = new SolidColorBrush(Color.FromArgb(128, 128, 255, 128));
            MaterialGroup group2 = D3.MakeMaterialGroup(
                new DiffuseMaterial(brush),
                new SpecularMaterial(Brushes.White, 100));

            group.Children.Add(mesh2.MakeModel(group2));

            // Make a translucent circumsphere.
            MeshGeometry3D mesh3 = new MeshGeometry3D();

            mesh3.AddSphere(D3.Origin, G3.TetrahedronCircumradius(), 60, 30, true);
            mesh3.ApplyTransformation(new ScaleTransform3D(scale, scale, scale));
            MaterialGroup group3 = D3.MakeMaterialGroup(
                new DiffuseMaterial(brush),
                new SpecularMaterial(Brushes.White, 100));

            group.Children.Add(mesh3.MakeModel(group3));
        }
        // Define the model.
        private void DefineModel(Model3DGroup group)
        {
            // Show the axes.
            MeshExtensions.AddAxes(group);

            // Make a translucent sphere.
            MeshGeometry3D mesh2 = new MeshGeometry3D();

            mesh2.AddSphere(new Point3D(-2, 0, 0), 1, 60, 30, true);
            Brush         brush  = new SolidColorBrush(Color.FromArgb(128, 128, 255, 128));
            MaterialGroup group2 = D3.MakeMaterialGroup(
                new DiffuseMaterial(brush),
                new SpecularMaterial(Brushes.White, 100));

            group.Children.Add(mesh2.MakeModel(group2));

            // Make a translucent circumsphere.
            MeshGeometry3D mesh3 = new MeshGeometry3D();

            mesh3.AddSphere(new Point3D(2, 0, 0), 1, 60, 30, true);
            group.Children.Add(mesh3.MakeModel(group2));
        }