|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
具体怎么添加颜色设置函数把这个拉伸体设置成红色?小弟刚学不会呀
#include <stdio.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_curve.h>
#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);
}
static void do_ugopen_api(void)
{
double pt1[3]= {0.0,0.0,0.0};
double pt2[3]= {1.0,0.0,0.0};
double pt3[3]= {3.0,3.0,0.0};
double pt4[3]= {0.0,1.0,0.0};
tag_t line1;
tag_t line2;
tag_t line3;
tag_t line4;
UF_CURVE_line_t line_coords1;
UF_CURVE_line_t line_coords2;
UF_CURVE_line_t line_coords3;
UF_CURVE_line_t line_coords4;
line_coords1.start_point[0] = pt1[0];
line_coords1.start_point[1] = pt1[1];
line_coords1.start_point[2] = pt1[2];
line_coords1.end_point[0] = pt2[0];
line_coords1.end_point[1] = pt2[1];
line_coords1.end_point[2] = pt2[2];
UF_CALL(UF_CURVE_create_line(&line_coords1, &line1));
line_coords2.start_point[0] = pt2[0];
line_coords2.start_point[1] = pt2[1];
line_coords2.start_point[2] = pt2[2];
line_coords2.end_point[0] = pt3[0];
line_coords2.end_point[1] = pt3[1];
line_coords2.end_point[2] = pt3[2];
UF_CALL(UF_CURVE_create_line(&line_coords2, &line2));
line_coords3.start_point[0] = pt3[0];
line_coords3.start_point[1] = pt3[1];
line_coords3.start_point[2] = pt3[2];
line_coords3.end_point[0] = pt4[0];
line_coords3.end_point[1] = pt4[1];
line_coords3.end_point[2] = pt4[2];
UF_CALL(UF_CURVE_create_line(&line_coords3, &line3));
line_coords4.start_point[0] = pt4[0];
line_coords4.start_point[1] = pt4[1];
line_coords4.start_point[2] = pt4[2];
line_coords4.end_point[0] = pt1[0];
line_coords4.end_point[1] = pt1[1];
line_coords4.end_point[2] = pt1[2];
UF_CALL(UF_CURVE_create_line(&line_coords4, &line4));
double direction[3] = {0.0, 0.0, 1.0};
UF_FEATURE_SIGN sign = UF_NULLSIGN;
char * taper_angle = "0.0";
double point[3];
char * limit[2] = {"0.0", "10"};
uf_list_p_t objects, body;
UF_CALL(UF_MODL_create_list(&objects));
UF_CALL(UF_MODL_put_list_item(objects, line1));
UF_CALL(UF_MODL_put_list_item(objects, line2));
UF_CALL(UF_MODL_put_list_item(objects, line3));
UF_CALL(UF_MODL_put_list_item(objects, line4));
UF_CALL(UF_MODL_create_extruded (objects, taper_angle, limit, point, direction, sign, &body));
}
/*ARGSUSED*/
extern void ufusr(char *param, int *retcode, int paramLen)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
|
|