单位化向量
#include "me.hpp"
extern DllExport void ufusr(char *param, int *returnCode, int rlen)
{
UF_initialize();
double douV[3] = { 0,2,2 };
double douUnitizeV[3] = { 0,0,0 };
double tolerance = 0.001;
double magnitude = 0;
UF_VEC3_unitize(douV, tolerance, &magnitude, douUnitizeV);
print("%f\n", magnitude);
print("%f,%f,%f\n", douUnitizeV[0], douUnitizeV[1], douUnitizeV[2]);
UF_terminate();
}
extern int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
效果: