示例#1
0
 public IPRInfos_CS()
 {
     Id           = -1;
     Adj_M        = -1;
     Adj_D        = -1;
     Value_M      = 0.0f;
     Value_D      = 0.0f;
     ClipNormal_M = new IW_Point3d();
     ClipNormal_D = new IW_Point3d();
     ClipCenter_M = new IW_Point3d();
     ClipCenter_D = new IW_Point3d();
 }
示例#2
0
        public void BinaryDeserialization(byte[] DataArray)
        {
            if (DataArray == null)
            {
                throw new SystemException("No data");
            }

            MemoryStream stream = new MemoryStream(DataArray);

            using (BinaryReader reader = new BinaryReader(stream))
            {
                try
                {
                    int verNum  = reader.ReadInt32();
                    int faceNum = reader.ReadInt32();

                    vertex = new IW_Point3d[verNum];
                    face   = new IW_triIdx[faceNum];
                    for (int i = 0; i < verNum; i++)
                    {
                        vertex[i]   = new IW_Point3d();
                        vertex[i].x = (double)reader.ReadSingle();
                        vertex[i].y = (double)reader.ReadSingle();
                        vertex[i].z = (double)reader.ReadSingle();
                    }
                    for (int i = 0; i < faceNum; i++)
                    {
                        face[i]   = new IW_triIdx();
                        face[i].a = reader.ReadInt32();
                        face[i].b = reader.ReadInt32();
                        face[i].c = reader.ReadInt32();
                    }


                    //(Optional)
                    try
                    {
                        bool has_color = (reader.BaseStream.Position < reader.BaseStream.Length);/*reader.PeekChar() != -1  .net在讀 UTF-8 有問題 */
                        if (has_color)
                        {
                            int colorNum = reader.ReadInt32();
                            color = new IW_Point3d[colorNum];
                            for (int i = 0; i < colorNum; i++)
                            {
                                color[i]   = new IW_Point3d();
                                color[i].x = (double)reader.ReadSingle();
                                color[i].y = (double)reader.ReadSingle();
                                color[i].z = (double)reader.ReadSingle();
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        string msg = ex.Message;
                        color = null;
                    }
                }
                catch (System.Exception ex)
                {
                    vertex = new IW_Point3d[0];
                    face   = new IW_triIdx[0];
                    color  = null;
                }
            }
        }