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.
 
 

36 lines
1.1 KiB

// AABB部分的代码直接原封不动用的gitea/GeometryMain/surface-surface-intersection.git中bvh的代码,之后可以合并过去
#ifndef AABB_HPP
#define AABB_HPP
#include "glm/glm.hpp"
#include "real.h"
#include <cmath>
class AABB {
public:
// 边界
glm::dvec3 pMin, pMax;
public:
AABB() {
real minNum = std::numeric_limits<real>::lowest();
real maxNum = std::numeric_limits<real>::max();
pMax = glm::dvec3(minNum, minNum, minNum);
pMin = glm::dvec3(maxNum, maxNum, maxNum);
}
AABB(const glm::dvec3 p) : pMin(p), pMax(p) {}
AABB(const glm::dvec3 p1, const glm::dvec3 p2) {
pMin = glm::dvec3(fmin(p1.x, p2.x), fmin(p1.y, p2.y), fmin(p1.z, p2.z));
pMax = glm::dvec3(fmax(p1.x, p2.x), fmax(p1.y, p2.y), fmax(p1.z, p2.z));
}
};
// 判断点是否在包围盒内,是返回true,否返回false
bool isPointInBox(const glm::dvec3 &pt, const AABB &box);
// aabb包围盒合并操作,包围盒和点
AABB Union(const AABB &b1, const glm::dvec3 &p);
// aabb包围盒合并操作,两个包围盒
AABB Union(const AABB &b1, const AABB &b2);
// 判断两个aabb包围盒是否重叠
bool IsOverlap(AABB b1, AABB b2);
#endif