zoukankan      html  css  js  c++  java
  • NX二次开发-UFUN将矩阵绕任意轴旋转uf5945

    函数方法

    NX9+VS2012
    
    #include <uf.h>
    #include <uf_csys.h>
    #include <uf_mtx.h>
    #include <uf_trns.h>
    
    
    UF_initialize();
    
    //初始化3*3矩阵
    double x_vec[3] = {1.0, 0.0, 0.0};
    double y_vec[3] = {0.0, 1.0, 0.0}; 
    double mtx[9];
    UF_MTX3_initialize(x_vec, y_vec, mtx);
    
    //创建矩阵
    tag_t MatrixTag = NULL_TAG;
    UF_CSYS_create_matrix(mtx, &MatrixTag);
    
    //创建坐标系
    double csys_origin [3] = {10, 10, 10};
    tag_t CsysTag = NULL_TAG;
    UF_CSYS_create_csys(csys_origin, MatrixTag, &CsysTag);
    
    for (int i = 0; i < 36; i++)
    {
        //将矩阵绕任意轴旋转
        double origin[3] = {10, 10, 10};
        double direction[3]  = {0.0, 0.0, 1.0};
        double degrees_rotation = i;
        double matrix[12];
        int status = 0; 
        uf5945(origin, direction, &degrees_rotation, matrix, &status);
    
        //变换矩阵
        tag_t objects[] = {CsysTag};
        int n_objects = 1;
        int move_or_copy = 1;
        int dest_layer = 0;
        int trace_curves = 2;
        tag_t copies = NULL_TAG;
        tag_t trace_curve_group = NULL_TAG;
        int status1 = 0;
        uf5947(matrix, objects, &n_objects, &move_or_copy, &dest_layer, &trace_curves, &copies, &trace_curve_group, &status1);
    }
    
    UF_terminate();
    
    Caesar卢尚宇
    2020年6月21日

    数学方法

     关于矩阵数学方面的参考资料https://www.cnblogs.com/zhoug2020/p/7842808.html

    NX9+VS2012
    
    #include <uf.h>
    #include <uf_csys.h>
    
    
    UF_initialize();
    
    for (int i = 0; i < 36; i++)
    {
        //旋转矩阵(绕Z轴旋转)
        double rot[12]={cos(i),-sin(i),0,sin(i),cos(i),0,0,0,1};
    
        //创建矩阵
        tag_t MatrixTag = NULL_TAG;
        UF_CSYS_create_matrix(rot, &MatrixTag);
    
        //创建坐标系
        double csys_origin [3] = {10, 10, 10};
        tag_t CsysTag = NULL_TAG;
        UF_CSYS_create_csys(csys_origin, MatrixTag, &CsysTag);
    }
    
    UF_terminate();
    
    Caesar卢尚宇
    2020年6月21日

    2020年7月2日

    新增C#写法https://www.cnblogs.com/nxopen2018/p/13226117.html

  • 相关阅读:
    JS中!=、==、!==、===的用法和区别
    Jquery判断Checkbox是否选中三种方法
    C# 信号量 学习
    redis学习资料
    Redis常用命令
    MySQL、HBase、ES的对比
    我对依赖注入,控制反转的理解
    net输出错误日志
    XmlExtensions帮助类
    DatetimeHelper类的编写
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/13173905.html
Copyright © 2011-2022 走看看