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.

102 lines
3.6 KiB

2 years ago
//
// Created by 14727 on 2022/12/24.
//
#ifndef GAUSSMAP_GAUSS_MAP_H
#define GAUSSMAP_GAUSS_MAP_H
#include "aabb.h"
#include "glm/glm.hpp"
2 years ago
#include "map"
#include "real.h"
#include "set"
#include "tinynurbs/tinynurbs.h"
#include "vector"
2 years ago
// 一个节点就表示一个球上矩形面片
struct GaussMapNode {
// 四个顶点的法向量值确定一个平面的法向量值
AABB bound;
int level, firstChild;
int idx_u, idx_v;
2 years ago
};
class GaussMap {
public:
int maxLevel;
const std::vector<std::vector<glm::vec3>> &normals;
std::vector<GaussMapNode> tree;
2 years ago
void recursiveBuild(int level, int idx, int idx_u, int idx_v);
2 years ago
explicit GaussMap(const std::vector<std::vector<glm::vec3>> &normals_);
2 years ago
void build();
2 years ago
void printQuadTree();
2 years ago
};
// std::vector<std::pair<int, int>> getOverlapLeafNodes(const GaussMap &gm1,
// const GaussMap &gm2);
std::map<std::pair<int, int>, std::set<std::pair<int, int>>>
getOverlapLeafNodes(const GaussMap &gm1, const GaussMap &gm2);
2 years ago
void recursiveGetOverlapLeafNodes(const GaussMap &gm1, const GaussMap &gm2,
int idx1, int idx2,
2 years ago
std::vector<std::pair<int, int>> &pairs);
/**
* Gauss Map在指定的
* @param idxRange_u1 gauss
* map的参数u范围对应的u方向上的采样网格的格子下标范围
* @param idxRange_v1 gauss
* map的参数v范围对应的u方向上的采样网格的格子下标范围
* @param idxRange_u2 gauss
* map的参数u范围对应的u方向上的采样网格的格子下标范围
* @param idxRange_v2 gauss
* map的参数v范围对应的u方向上的采样网格的格子下标范围
* @return true:gauss map的包围盒有交集gauss map<>false: gauss
* map一定没有重合
2 years ago
*/
bool isGaussMapsOverlapped(const GaussMap &gm1, const GaussMap &gm2,
std::pair<int, int> idxRange_u1,
std::pair<int, int> idxRange_v1,
std::pair<int, int> idxRange_u2,
2 years ago
std::pair<int, int> idxRange_v2);
bool isLeafNodesOverlapped(const GaussMap &gm1, const GaussMap &gm2,
std::pair<int, int> idx1, std::pair<int, int> idx2);
2 years ago
/**
* Gauss Map在指定的
* @param range_u1 gauss map的参数u范围
* @param range_v1 gauss map的参数v范围
* @param range_u2 gauss map的参数u范围
* @param range_v2 gauss map的参数v范围
* @param paramRange_u1 gauss map的参数u定义域
* @param paramRange_v1 gauss map的参数v定义域
* @param paramRange_u2 gauss map的参数u定义域
* @param paramRange_v2 gauss map的参数v定义域
* @return true:gauss map的包围盒有交集gauss map<>false: gauss
* map一定没有重合
2 years ago
*/
bool isGaussMapsOverlapped(
const GaussMap &gm1, const GaussMap &gm2, std::pair<real, real> range_u1,
std::pair<real, real> range_v1, std::pair<real, real> range_u2,
std::pair<real, real> range_v2, std::pair<real, real> paramRange_u1,
std::pair<real, real> paramRange_v1, std::pair<real, real> paramRange_u2,
std::pair<real, real> paramRange_v2);
2 years ago
/**
*
* @param layer
*/
2 years ago
int getStartIdxOfLayerN(int layer);
/**
* uv参数域中的小矩形的位置BVH叶节点层
*/
2 years ago
int getChildNodeIdx(int ix, int iy);
#endif // GAUSSMAP_GAUSS_MAP_H