#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_modl.h>
#include <uf_modl_types.h>
#include <uf_ui.h>
#include <uf_object_types.h>
#include <uf_disp.h>
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
static int report_error(char* file, int line, char* call, int irc)
{
if (irc)
{
char err[133],
msg[133];
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
irc, line, file);
UF_get_fail_message(irc, err);
/* NOTE: UF_print_syslog is new in V18 */
UF_print_syslog(msg, FALSE);
UF_print_syslog(err, FALSE);
UF_print_syslog("\n", FALSE);
UF_print_syslog(call, FALSE);
UF_print_syslog(";\n", FALSE);
if (!UF_UI_open_listing_window())
{
UF_UI_write_listing_window(msg);
UF_UI_write_listing_window(err);
UF_UI_write_listing_window("\n");
UF_UI_write_listing_window(call);
UF_UI_write_listing_window(";\n");
}
}
return(irc);
}
void ufusr(char* param, int* retcode, int paramLen)
{
UF_initialize();
double vec[3] = {100.0,100.0,100.0};
double mtx[9] = {1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,0.9};
double Vec_product[3] = {0};
UF_MTX3_vec_multiply(vec, mtx, Vec_product); /*向量跟矩阵的乘积*/
/*创建点*/
tag_t pointTag(NULL_TAG);
UF_CURVE_create_point(Vec_product, &pointTag);
UF_terminate();
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
附带计算方法:线性代数矩阵计算
在上面的功能中则是则是:
Vec_product = (100*1 +100*0+100*0,100*0+100*(-1)+100*0,100*0+100*0+100+0.9) =(100,-100,90);