资源简介
本示例演示了从文件中读取数据点并把读取的点在UG中画出来,然后根据每个截面上的点拟合成样条曲线并对曲线进行光顺等操作,最后通过曲线创建曲面的过程。

代码片段和文件信息
//The following program was created by Northwestern Polytechnical University in 2007.
#include “StdAfx.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define UF_CALL(X) (report( __FILE__ __LINE__ #X (X)))
static int report( char *file int line char *call int irc)
{
if (irc)
{
char messg[133];
printf(“%s line %d: %s\n“ file line call);
(UF_get_fail_message(irc messg)) ?
printf(“ returned a %d\n“ irc) :
printf(“ returned error %d: %s\n“ irc messg);
}
return(irc);
}
tag_t SmoothSpline(tag_t spline_tag)
{
UF_CURVE_spline_t spline_data;
int cont_order;
double dist_toler ang_toler;
double smooth_param = 1.2;
int num_states;
UF_CURVE_state_p_t states;
tag_t output_tag;
UF_CALL(UF_CURVE_ask_spline_data(spline_tag&spline_data));//get spline_data
cont_order=2;
dist_toler=smooth_param;
ang_toler=360;
UF_CALL( UF_CURVE_smooth_spline_data
(&spline_datacont_orderdist_tolerang_toler&num_states&states));//光顺曲线
UF_CALL(UF_CURVE_create_spline(&spline_data&output_tag&num_states&states));
//光顺以后重新生成曲线
UF_OBJ_set_color(spline_tag 1);
UF_free(spline_data.knots);
UF_free(spline_data.poles);
UF_free(states);
return output_tag;
}
void CreateSheetbody(tag_t *spline)
{
int i;
UF_STRING_t s_section s_spine;
int patch = 2 alignment = 1;
double value[6];
int vdegree = 3 vstatus = 0 body_type = 1;
UF_FEATURE_SIGN boolean = UF_NULLSIGN;
double tol[3] = {0.0010.5*PI/180.00.001};
tag_t c_face_id[2] = {NULLNULL};
int c_flag[2] = {00};
tag_t body_obj_id;
UF_MODL_init_string_list(&s_section);
UF_MODL_create_string_list(6 6 &s_section);
s_section.num = 6;
for(i=0; i<6; i++)
{
s_section.string[i] = 1;
s_section.dir[i] = UF_MODL_CURVE_START_FROM_BEGIN;
s_section.id[i] = spline[i];
}
UF_MODL_create_thru_curves(&s_section &s_spine &patch &alignment value &vdegree
&vstatus &body_type boolean tol c_face_id c_flag &body_obj_id);
UF_MODL_free_string_list(&s_section);
}
static void do_ugopen_api(void)
{
FILE *fp;
int i j;
char filename[100];
double point[3];
tag_t t_pnt;
tag_t spline[6];
double pnt[6][300];
int num_points = 100;
int opt=1;
for (i=0; i<6; i++)
{
sprintf(filename “E:\\slice%d.txt“ i);
fp = fopen(filename “r“);
j = 0;
if (fp!=NULL)
{
while (!feof(fp))
{
fscanf(fp “%lf %lf %lf“ &point[0] &point[1] &point[2]);
UF_CURVE_create_point(point &t_pnt);
pnt[i][3*j] = point[0];
pnt[i][3*j+1] = point[1];
pnt[i][3*j+2] = point[2];
j++;
}
FTN(uf5080)(&opt &num_points pnt[i] &spline[i]);
spline[i] = SmoothSpline(spline[i]);
}
else
uc1601(“Cannot
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3325 2007-12-26 21:07 Create_Surface\chapter5_blade.cpp
文件 102472 2007-11-07 16:30 Create_Surface\chapter5_blade.dll
文件 4250 2007-11-07 09:37 Create_Surface\chapter5_blade.dsp
文件 553 2007-11-06 22:12 Create_Surface\chapter5_blade.dsw
文件 50176 2007-12-26 20:52 Create_Surface\chapter5_blade.ncb
文件 49664 2007-12-26 20:52 Create_Surface\chapter5_blade.opt
文件 1243 2007-11-07 16:30 Create_Surface\chapter5_blade.plg
文件 211 2006-07-09 11:07 Create_Surface\StdAfx.cpp
文件 1447 2006-07-09 11:07 Create_Surface\StdAfx.h
目录 0 2010-04-17 13:07 Create_Surface
----------- --------- ---------- ----- ----
213341 10
- 上一篇:电机控制FOC算法方框图
- 下一篇:DHCP snooping代码
相关资源
- Histamine excites rat lateral vestibular nucle
- Diltiazem augmented pentobarbital-induced LORR
- Xilinx-FPGA-引脚功能详细介绍.doc
- 基于xilinx FPGA的PCIe设计实战
- usb调试程序 对USB设备进行数据的读写
- Douglas-Peucker 曲线离散化算法.rar
- 曲面拟合算法程序
- Dibrugarh地区牛场土壤中潜在的益生菌
- 中盈 NX-612打印机驱动 v1.1 官方版
- 宏碁Acer 4741G驱动合集 for winxp 官方版
- 网上书店期末项目,BUG很多
- 轻量级文件服务器Fdfs搭建(fastDFS+n
- 调试九法.pdf
- Xilinx FPGA底层资源架构与设计规范
- S32K144 和S32K SDK开发入门培训.pdf
- 基于NXP的NFC电子钱包技术设计
-
Volley获取json和xm
l数据解析显示 - Investigation of the Absorption Mechanism of G
- 基于曲率信息由曲线到曲面的重建与
- 基于曲率的适应性移动最小二乘曲面
- nginx-rtmp-win32-master.rar
- M5-branes的Argyres-Douglas理论的顶点算子
- yaf-2.1.17.tgz
- sphinx中文分词 xdict_1.1.tar.gz
- xilinx_ise_14.7_license破解
- Notepad++ ComparePlugin32+64
- ComparePlugin.dll
- ComparePlugin.zip
- 中盈NX-2470打印机驱动 v1.1 官方版
- 华硕PCE-AC66无线网卡驱动 v6.30.77.0 fo
评论
共有 条评论