使用AnyCAD.Net三维图图形控件能够计算曲线的切线、法线、曲率、长度等,能够计算曲面的uv切线、法线、面积等。

代码示例一:曲线分析

            Platform.LineStyle lineStyle = new Platform.LineStyle();
lineStyle.SetLineWidth(0.5f);
lineStyle.SetColor(ColorValue.BLUE);
Platform.LineStyle lineStyle2 = new Platform.LineStyle();
lineStyle2.SetLineWidth(0.5f);
lineStyle2.SetColor(ColorValue.GREEN); Platform.TopoShape arc = renderView.ShapeMaker.MakeEllipseArc(Vector3.ZERO, , , , , Vector3.UNIT_Z);
renderView.ShowGeometry(arc, ); {
Platform.GeomeCurve curve = new Platform.GeomeCurve();
curve.Initialize(arc); float paramStart = curve.FirstParameter();
float paramEnd = curve.LastParameter(); float step = (paramEnd - paramStart) * 0.1f; for (float uu = paramStart; uu <= paramEnd; uu += step)
{
Vector3 dir = curve.DN(uu, );
Vector3 pos = curve.Value(uu); // 切线
{
Platform.TopoShape line = renderView.ShapeMaker.MakeLine(pos, pos + dir);
Platform.SceneNode node = renderView.ShowGeometry(line, );
node.SetLineStyle(lineStyle);
}
// 法线
{
Vector3 dirN = dir.CrossProduct(Vector3.UNIT_Z);
Platform.TopoShape line = renderView.ShapeMaker.MakeLine(pos, pos + dirN);
Platform.SceneNode node = renderView.ShowGeometry(line, );
node.SetLineStyle(lineStyle2);
} } }

运行结果:

代码示例二:曲面分析

            Platform.LineStyle lineStyle = new Platform.LineStyle();
lineStyle.SetLineWidth(0.5f);
lineStyle.SetColor(ColorValue.RED); TopoShape arc = renderView.ShapeMaker.MakeArc(Vector3.ZERO, , -, , Vector3.UNIT_X);
TopoShape face = renderView.ShapeMaker.Extrude(arc, , Vector3.UNIT_X); renderView.ShowGeometry(face, ); GeomeSurface surface = new GeomeSurface();
surface.Initialize(face);
float ufirst = surface.FirstUParameter();
float uLarst = surface.LastUParameter();
float vfirst = surface.FirstVParameter();
float vLast = surface.LastVParameter(); float ustep = (uLarst - ufirst) * 0.1f;
float vstep = (vLast - vfirst) * 0.1f;
for(float ii=ufirst; ii<=uLarst; ii+= ustep)
for (float jj = vfirst; jj <= vLast; jj += vstep)
{
Vector3List data = surface.D1(ii, jj); Vector3 pos = data.Get();
Vector3 dirU = data.Get();
Vector3 dirV = data.Get();
Vector3 dir = dirV.CrossProduct(dirU);
{
Platform.TopoShape line = renderView.ShapeMaker.MakeLine(pos, pos + dir);
Platform.SceneNode node = renderView.ShowGeometry(line, ); node.SetLineStyle(lineStyle);
}
}

运行结果

最新文章

  1. iOS滤镜实现之LOMO(美图秀秀经典LOMO)
  2. CentOS下 MySQL5.7 详细的部署安装流程
  3. Windows phone 8.0 本地化遇到的两个问题
  4. UVa 10562看图写树(二叉树遍历)
  5. 安装配置sock5代理
  6. Office 365 - Windows PowerShell for SharePoint Online
  7. wp8 ListPicker
  8. HTTP refere
  9. Vim的tagbar插件
  10. juce中的内存泄漏检测
  11. hdu1044
  12. 文件系统的几种类型:ext3, s…
  13. Linux时间子系统之三:时间的维护者:timekeeper
  14. RedisLive安装
  15. 7 家 IT 厂商 6394.5 万元中标天津公安云项目(虚拟化、数据库、软件开发)
  16. android获取屏幕长宽的方法
  17. jQuery的回调管理机制
  18. P4101 [HEOI2014]人人尽说江南好
  19. Python学习笔记——与爬虫相关的网络知识
  20. PDF Document Creation, Viewing

热门文章

  1. db2常用名词
  2. Guava 12-数学运算
  3. filter的执行顺序
  4. Ubuntu打开终端和设置root密码(转载)
  5. 30天轻松掌握JavaWeb_使用beanutils
  6. iOS获取电量方法
  7. 论职务犯罪案件侦查 z
  8. spring和springmvc之间的整合
  9. C# 文件压缩与解压(ZIP格式)
  10. (medium)LeetCode 207.Course Schedule