当前位置: 首页>>代码示例>>C#>>正文


C# Point3d.Load方法代码示例

本文整理汇总了C#中Point3d.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Point3d.Load方法的具体用法?C# Point3d.Load怎么用?C# Point3d.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point3d的用法示例。


在下文中一共展示了Point3d.Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public bool Load(StreamReader sr)
        {
            try
            {
                //load color
                int a = byte.Parse(sr.ReadLine());
                int r = byte.Parse(sr.ReadLine()); //R
                int g = byte.Parse(sr.ReadLine()); //G
                int b = byte.Parse(sr.ReadLine()); //B
                m_color = Color.FromArgb(a, r, g, b);

                //load numer of points
                int npoint = int.Parse(sr.ReadLine());
                //load points
                for (int c = 0; c< npoint; c++)
                {
                    Point3d p = new Point3d();
                    p.Load(sr);
                    m_points.Add(p);
                }

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
开发者ID:RFranta,项目名称:UVDLPSlicerController,代码行数:28,代码来源:PolyLine3d.cs

示例2: LoadSTL_Binary

 public bool LoadSTL_Binary(string filename) 
 {
     BinaryReader br = null;
     try
     {
         br = new BinaryReader(File.Open(filename, FileMode.Open));
         m_fullname = filename;
         m_name = Path.GetFileName(filename);
         byte[] data = new byte[80];
         data = br.ReadBytes(80); // read the header
         uint numtri = br.ReadUInt32();
         for (uint c = 0; c < numtri; c++) 
         {
             Polygon p = new Polygon();
             m_lstpolys.Add(p); // add this polygon to the object
             p.m_normal.Load(br); // load the normal
             p.m_points = new Point3d[3]; // create storage
             for (int pc = 0; pc < 3; pc++) //iterate through the points
             {                        
                 Point3d pnt = new Point3d();
                 pnt.Load(br);
                 m_lstpoints.Add(pnt);
                 p.m_points[pc] = pnt;
             }
             uint attr = br.ReadUInt16(); // not used attribute
         }
         
         Update(); // initial positions please...
         br.Close();
         return true;
     }
     catch (Exception) 
     {
         if(br!=null)
             br.Close();
         return false;
     }
     
 }
开发者ID:nick570775,项目名称:UVDLPSlicerController,代码行数:39,代码来源:Object3d.cs

示例3: LoadSTL_Binary

        public bool LoadSTL_Binary(string filename) 
        {
            BinaryReader br = null;
            try
            {
                br = new BinaryReader(File.Open(filename, FileMode.Open));
                m_fullname = filename;
                m_name = Path.GetFileNameWithoutExtension(filename);
                byte[] data = new byte[80];
                data = br.ReadBytes(80); // read the header
                uint numtri = br.ReadUInt32();
                for (uint c = 0; c < numtri; c++) 
                {
                    Polygon p = new Polygon();
                    m_lstpolys.Add(p); // add this polygon to the object
                    p.m_normal.Load(br); // load the normal
                    p.m_points = new Point3d[3]; // create storage
                    for (int pc = 0; pc < 3; pc++) //iterate through the points
                    {                        
                        Point3d pnt = new Point3d();
                        pnt.Load(br);
                        m_lstpoints.Add(pnt);
                        p.m_points[pc] = pnt;
                    }
                    uint attr = br.ReadUInt16(); // attribute COULD be used for color 
                    /*
                    The VisCAM and SolidView software packages use the two "attribute byte count" bytes at the end of every triangle to store a 15-bit RGB color:

                        bit 0 to 4 are the intensity level for blue (0 to 31),
                        bits 5 to 9 are the intensity level for green (0 to 31),
                        bits 10 to 14 are the intensity level for red (0 to 31),
                        bit 15 is 1 if the color is valid, or 0 if the color is not valid (as with normal STL files).
                     
                     */
                    //BBBBBGGGGGRRRRRV
                    //VRRRRRGGGGGBBBBB
                    byte R, G, B, used;
                    B = (byte)((attr & 0x001f)<<3);
                    G = (byte)((attr>>5 & 0x001f)<<3);
                    R = (byte)((attr>>10 & 0x001f)<<3);

                    used = (byte)(attr >> 15 & 0x0001);
                    if (used != 0) 
                    {
                        p.m_colorsource = Color.FromArgb(255, R, G, B);
                        p.m_color = p.m_colorsource;
                    }

                }
                
                Update(); // initial positions please...
                br.Close();
                return true;
            }
            catch (Exception) 
            {
                if(br!=null)
                    br.Close();
                return false;
            }
            
        }
开发者ID:tojoevan,项目名称:BGC-CW,代码行数:62,代码来源:Object3d.cs


注:本文中的Point3d.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。