Read() public method

public Read ( System s ) : System.Windows.Media.Media3D.Model3DGroup
s System
return System.Windows.Media.Media3D.Model3DGroup
        public MainViewModel()
        {
            // Create a model group
            var modelGroup = new Model3DGroup();

            points = new List <Point3D>();

            // Create a mesh builder and add a box to it
            var meshBuilder = new MeshBuilder(false, false);
            // -1 -1 -1
            //1 -1 -1
            //1 1 -1
            //-1 1 -1
            //-1 -1 1
            //1 -1 1
            //1 1 1
            //-1 1 1
            string    path   = @"teapot.ply";
            PLYReader reader = new PLYReader();

            using (var s = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                mg = reader.Read(s);
            }

            this.points = reader.Vertices;
            this.faces  = reader.Faces;
            // meshBuilder.Positions.Add(new Point3D(-1, -1, -1));//, 1, 2, 0.5);
            // meshBuilder.Positions.Add(new Point3D(1, -1, -1));
            // meshBuilder.Positions.Add(new Point3D(1, 1, -1));
            // meshBuilder.Positions.Add(new Point3D(-1, 1, -1));
            // meshBuilder.Positions.Add(new Point3D(-1, -1, 1));
            // meshBuilder.Positions.Add(new Point3D(1, -1, 1));
            // meshBuilder.Positions.Add(new Point3D(1, 1, 1));
            // meshBuilder.Positions.Add(new Point3D(-1, 1, 1));
            // meshBuilder.AddPolygon(new int[4] {0,1,2,3 });
            // meshBuilder.AddPolygon(new int[4] { 5,4,7,6 });
            // meshBuilder.AddPolygon(new int[4] { 6,2,1,5 });
            // meshBuilder.AddPolygon(new int[4] { 3,7,4,0 });
            // meshBuilder.AddPolygon(new int[4] { 7,3,2,6 });
            // meshBuilder.AddPolygon(new int[4] { 5,1,0,4 });

            // // Create a mesh from the builder (and freeze it)
            // var mesh = meshBuilder.ToMesh(true);

            // // Create some materials
            // var greenMaterial = MaterialHelper.CreateMaterial(Colors.Green);
            // var redMaterial = MaterialHelper.CreateMaterial(Colors.Red);
            // var blueMaterial = MaterialHelper.CreateMaterial(Colors.Blue);
            // var insideMaterial = MaterialHelper.CreateMaterial(Colors.Yellow);

            // // Add 3 models to the group (using the same mesh, that's why we had to freeze it)
            // modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Material = greenMaterial, BackMaterial = insideMaterial });
            //// modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Transform = new TranslateTransform3D(-2, 0, 0), Material = redMaterial, BackMaterial = insideMaterial });
            //// modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Transform = new TranslateTransform3D(2, 0, 0), Material = blueMaterial, BackMaterial = insideMaterial });

            // // Set the property, which will be bound to the Content property of the ModelVisual3D (see MainWindow.xaml)
            this.Model = mg;
        }
        public MainViewModel()
        {
            // Create a model group
            var modelGroup = new Model3DGroup();
            points = new List<Point3D>();
            
            // Create a mesh builder and add a box to it
            var meshBuilder = new MeshBuilder(false, false);
            // -1 -1 -1 
            //1 -1 -1 
            //1 1 -1 
            //-1 1 -1 
            //-1 -1 1 
            //1 -1 1 
            //1 1 1 
            //-1 1 1 
            string path = @"teapot.ply";
            PLYReader reader = new PLYReader();

            using (var s = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                mg=reader.Read(s);
            }
           
            this.points = reader.Vertices;
            this.faces = reader.Faces;
           // meshBuilder.Positions.Add(new Point3D(-1, -1, -1));//, 1, 2, 0.5);
           // meshBuilder.Positions.Add(new Point3D(1, -1, -1));
           // meshBuilder.Positions.Add(new Point3D(1, 1, -1));
           // meshBuilder.Positions.Add(new Point3D(-1, 1, -1));
           // meshBuilder.Positions.Add(new Point3D(-1, -1, 1));
           // meshBuilder.Positions.Add(new Point3D(1, -1, 1));
           // meshBuilder.Positions.Add(new Point3D(1, 1, 1));
           // meshBuilder.Positions.Add(new Point3D(-1, 1, 1));
           // meshBuilder.AddPolygon(new int[4] {0,1,2,3 });
           // meshBuilder.AddPolygon(new int[4] { 5,4,7,6 });
           // meshBuilder.AddPolygon(new int[4] { 6,2,1,5 });
           // meshBuilder.AddPolygon(new int[4] { 3,7,4,0 });
           // meshBuilder.AddPolygon(new int[4] { 7,3,2,6 });
           // meshBuilder.AddPolygon(new int[4] { 5,1,0,4 });
            
           // // Create a mesh from the builder (and freeze it)
           // var mesh = meshBuilder.ToMesh(true);

           // // Create some materials
           // var greenMaterial = MaterialHelper.CreateMaterial(Colors.Green);
           // var redMaterial = MaterialHelper.CreateMaterial(Colors.Red);
           // var blueMaterial = MaterialHelper.CreateMaterial(Colors.Blue);
           // var insideMaterial = MaterialHelper.CreateMaterial(Colors.Yellow);

           // // Add 3 models to the group (using the same mesh, that's why we had to freeze it)
           // modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Material = greenMaterial, BackMaterial = insideMaterial });
           //// modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Transform = new TranslateTransform3D(-2, 0, 0), Material = redMaterial, BackMaterial = insideMaterial });
           //// modelGroup.Children.Add(new GeometryModel3D { Geometry = mesh, Transform = new TranslateTransform3D(2, 0, 0), Material = blueMaterial, BackMaterial = insideMaterial });

           // // Set the property, which will be bound to the Content property of the ModelVisual3D (see MainWindow.xaml)
            this.Model = mg;
        }