Integration of gauss map, osculating toroidal patches, loop detection and C2 judgement to figure out the singular or loop intersection.
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.
 
 

2.1 KiB

SingularityJudger

Integration of gauss map, osculating toroidal patches, loop detection and C2 judgement to figure out the singular or loop intersection.

Usage

CmakeLists.txt中将以下两行改为自己tinynurbs和glm的依赖路径

include_directories(E:/CLib/tinynurbs/include E:/CLib/glm)

直接运行

直接cmake构建,make编译链接,运行可执行文件即可

生成依赖库

  1. CMakeLists.txt中注释以下代码
add_executable(SingularityJudger main.cpp ${DIR_SRCS} ${DIR_INCLUDE})

# 下面两个仅仅是main文件的依赖,用于对读取的曲面文本文件做字符串处理
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
  1. CMakeLists.txt中取消注释以下代码
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
#add_library(SingularityJudger ${DIR_SRCS})
  1. CMake构建,make生成

具体使用

#include "bvh.h"
#include "singularityJudger.h"
// 创建两个曲面
tinynurbs::RationalSurface<float> s;
tinynurbs::RationalSurface<float> f;
// 曲面初始化
...

// 采样层数
int level = 6;
// 得到两个曲面level层的采样信息
// 如果已经采样过,这里用SrfMesh的无参构造,然后把采样的网格数据传入,避免重复采样
auto mesh1 = SrfMesh(s, level);
auto mesh2 = SrfMesh(f, level);

// 构建BVH
BVH bvh1(mesh1.evaluation);
BVH bvh2(mesh2.evaluation);
bvh1.build();
bvh2.build();
// bvh判交,获得重叠盒子对
auto intersectBoxPairs = getOverlapLeafNodes(bvh1, bvh2); // return [{{u1, v1}, {u2, v2}}]

// 创建SingularityJudger对象
SingularityJudger singularityJudger(s, f, mesh1, mesh2);

// 对于两个曲面各自的参数下标范围所确定的两个子面片,判断哪些小格子内存在critical point
// 一般就用完整的参数下标范围,即{0, pow(2, level - 1) - 1}
pair<int, int> cellIdxFullRange = {0, pow(2, level - 1) - 1};
auto cellsWithCriticalPts = singularityJudger.judge(intersectBoxPairs, cellIdxFullRange, cellIdxFullRange, cellIdxFullRange, cellIdxFullRange);