资源简介
提取STL的面片信息,包括三角面片的法向量和三个顶点

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
public class Point
{
public Point(double _x = 0 double _y = 0 double _z = 0)
{
x = _x;
y = _y;
z = _z;
}
public double x { get; set; }
public double y { get; set; }
public double z { get; set; }
}
public static void SimpleSaveTxt(List points )
{
string mFileFullname = @“D:\data.txt“;
System.IO.StreamWriter mStreamWriter = new System.IO.StreamWriter(mFileFullname false System.Text.Encoding.UTF8);
Console.WriteLine(“Length:“ + points.Count);
for (int i = 0; i < points.Count; i++)
{
mStreamWriter.WriteLine(points[i].x + “ “ + points[i].y + “ “ + points[i].z);
}
mStreamWriter.Close();
mStreamWriter.Dispose();
mStreamWriter = null;
}
public static List FloatReadBinary(List points string filename)
{
int count = 0;
using (BinaryReader reader = new BinaryReader(File.OpenRead(filename)))
{
reader.ReadBytes(80);
uint facecount = reader.ReadUInt32();
Console.WriteLine(“FaceCount:“ + facecount);
for (int i = 0; i < facecount; i++)
{
for (int m = 0; m < 4; m++)
{
float[] fs = new float[3];
for (int j = 0; j < 3; j++)
{
float x = reader.ReadSingle();
fs[j] = x;
Console.Write(“DD:“ + x + “ “);
}
points.Add(new Point(fs[0] fs[1] fs[2]));
count++;
Console.WriteLine(“Count:“ + count);
}
Console.WriteLine();
UInt16 attribute = reader.ReadUInt16();
Console.WriteLine(“Arribute:“ + attribute);
// Console.ReadKey();
}
}
return points;
}
static void Main(string[] args)
{
string s = “06.stl“;
List points = new List();
points = FloatReadBinary(points s);
SimpleSaveTxt(points);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 45284 2011-08-07 17:34 06.stl
文件 2740 2015-07-01 18:07 Program.cs
----------- --------- ---------- ----- ----
48024 2
- 上一篇:c#实现哈夫曼编码的压缩
- 下一篇:FinsTcp.rar
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论