A tool for evaluating multiple NURBS curve/surface points using the GPU.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Dtouch cd9e02d6d1 readme 补充 2 years ago
.idea 原始版本 2 years ago
.gitignore 使用说明完善 2 years ago
CMakeLists.txt 原始版本 2 years ago
LICENSE Initial commit 2 years ago
NurbsEvaluator.cu 原始版本 2 years ago
NurbsEvaluator.cuh 原始版本 2 years ago
README.md readme 补充 2 years ago
main.cpp 使用说明完善 2 years ago
utils.cpp 原始版本 2 years ago
utils.h 原始版本 2 years ago

README.md

NurbsEvaluator

A tool for evaluating multiple NURBS curve/surface points using the GPU.

Dependencies

  • MSVC
  • CUDA 11.8.0

Usage

Nurbs曲线

在构造函数中传入控制点向量和knots向量:

NurbsCurve::Evaluator nurbsCurveEvaluator(
        {
            {-1, 0,   0},
            {0,  1,   6},
            {1,  0,   4},
            {2,  0.5, 3},
            {3,  3,   1},
            {4,  -5,  0}
        },
        {0, 0, 0, 0.1, 0.5, 0.8, 1, 1, 1}
);  // 6点控制,knots长度为9,degree为2的NURBS

设置是否需要输出GPU并行计算花费的时间(默认否):

nurbsCurveEvaluator.setRecordTime(true);

开始计算

nurbsCurveEvaluator.calculate(5);  // 在参数域采样5个点

Nurbs曲面

曲面在构造函数中需要传入三层vector嵌套表示的二维点阵、u方向的knots向量、v方向的knots向量

NurbsSurface::Evaluator nurbsSurfaceEvaluator(
        {
            {{-1,   0,   0},   {0,   1, 6},  {1,  0,   4},   {2,  0.5,  3},    {3,    3,   1},   {4,  -5,    0}},
            {{-2,   1,   1.2}, {1,   2, 3},  {2,  2,   3},   {-1, -0.3, 2},    {-1,   2,   0},   {7,  -8,    2}},
            {{-3.4, 2,   3},   {2,   3, 0},  {4,  3,   7},   {-2, 0,    -0.2}, {1,    1.7, 5},   {9,  -10.3, 6}},
            {{-1.5, 3.2, 1},   {2.6, 7, -2}, {5,  0.8, 4.2}, {-4, 1,    4},    {2.1,  4,   -2},  {11, -6,    4}},
            {{-0.2, 2,   0},   {5,   3, 2},  {5,  1.5, 1.4}, {-3, 2,    5},    {0.8,  1.3, 0},   {15, -2,    0.9}},
            {{3,    1.4, -1},  {6,   2, 4},  {-1, 0,   -2},  {0,  2.8,  2},    {-0.5, 2,   1.2}, {7,  -3,    -2}}
        },
        {0, 0, 0, 0.1, 0.5, 0.8, 1, 1, 1},
        {0, 0, 0, 0.2, 0.7, 0.8, 1, 1, 1}
);
nurbsSurfaceEvaluator.setRecordTime(true);
nurbsSurfaceEvaluator.calculate(3, 4);  // 计算时需要传入u、v两个方向的采样数目

Primary Reference