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.
37 lines
1.0 KiB
37 lines
1.0 KiB
//
|
|
// Created by 14727 on 2022/12/24.
|
|
//
|
|
|
|
#ifndef GAUSSMAP_GAUSS_MAP_H
|
|
#define GAUSSMAP_GAUSS_MAP_H
|
|
#include "vector"
|
|
#include "tinynurbs/tinynurbs.h"
|
|
#include "glm/glm.hpp"
|
|
#include "aabb.h"
|
|
#include "map"
|
|
|
|
// 一个节点就表示一个球上矩形面片
|
|
struct GaussMapNode {
|
|
// 四个顶点的法向量值确定一个平面的法向量值
|
|
AABB nBound;
|
|
int level, firstChild;
|
|
};
|
|
|
|
class GaussMap {
|
|
int maxLevel;
|
|
int leafSampleCnt;
|
|
std::vector<std::vector<glm::vec3>> normals;
|
|
tinynurbs::RationalSurface<float> srf;
|
|
void recursiveBuild(int level, int idx, int idx_u, int idx_v);
|
|
public:
|
|
std::vector<GaussMapNode> tree;
|
|
GaussMap(int maxLevel, tinynurbs::RationalSurface<float> srf_);
|
|
void build();
|
|
void normalInit();
|
|
};
|
|
|
|
std::vector<std::pair<int, int>> getOverlapLeafNodes(const GaussMap& gm1, const GaussMap& gm2);
|
|
|
|
void recursiveGetOverlapLeafNodes(const GaussMap& gm1, const GaussMap& gm2, int idx1, int idx2, std::vector<std::pair<int, int>>& pairs);
|
|
|
|
#endif //GAUSSMAP_GAUSS_MAP_H
|
|
|