Пример #1
0
        public static NumCoordCell ReadCell(BinaryReader reader)
        {
            int   cellNum = reader.ReadInt32();
            Point point   = Point.ReadPoint(reader);

            return(new NumCoordCell(cellNum, point));
        }
Пример #2
0
        public static AttCoordCell ReadCell(BinaryReader reader)
        {
            FieldCell cell  = FieldCell.readCell(reader);
            Point     point = Point.ReadPoint(reader);

            return(new AttCoordCell(cell, point));
        }
Пример #3
0
        public static List <Point> readMeshes(string filename)
        {
            List <Point> retVal = new List <Point>();
            FileStream   stream = File.OpenRead(filename);
            BinaryReader reader = new BinaryReader(stream);

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                retVal.Add(Point.ReadPoint(reader));
            }
            return(retVal);
        }
Пример #4
0
        /// <summary>
        /// Reads a voxel from a specified file
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static Voxel ReadVoxel(BinaryReader reader)
        {
            ///read the point
            Point point = Point.ReadPoint(reader);
            //The number of cells that were found in this voxel
            int        numOfCells = reader.ReadInt32();
            List <int> cells      = new List <int>();

            //grab the cell number of each cell in this voxel
            for (int i = 0; i < numOfCells; i++)
            {
                if (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    cells.Add(reader.ReadInt32());
                }
            }
            return(new Voxel(cells, point));
        }
Пример #5
0
        public static IM ReadIntermediateFromFile(string filePath)
        {
            FileStream   stream    = File.OpenRead(filePath);
            BinaryReader reader    = new BinaryReader(stream);
            List <Point> vertices  = new List <Point>();
            List <int>   triangles = new List <int>();

            int vertCount = reader.ReadInt32();

            for (int i = 0; i < vertCount; i++)
            {
                vertices.Add(Point.ReadPoint(reader));
            }
            int triCount = reader.ReadInt32();

            for (int i = 0; i < triCount; i++)
            {
                triangles.Add(reader.ReadInt32());
            }

            return(new IM(vertices, triangles));
        }