Skip to content

Commit 63801b3

Browse files
committed
remove spherical integral
1 parent ba0c783 commit 63801b3

File tree

5 files changed

+73
-4393
lines changed

5 files changed

+73
-4393
lines changed

aabb.h

+25
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ inline Vector3 corner(const AABB3 &b, int i) {
6060
return ret;
6161
}
6262

63+
DEVICE
64+
inline AABB3 merge(const AABB3 &b, const Vector3 &p) {
65+
return AABB3{
66+
Vector3{
67+
min(b.p_min[0], p[0]),
68+
min(b.p_min[1], p[1]),
69+
min(b.p_min[2], p[2])},
70+
Vector3{
71+
max(b.p_max[0], p[0]),
72+
max(b.p_max[1], p[1]),
73+
max(b.p_max[2], p[2])}};
74+
}
75+
6376
DEVICE
6477
inline AABB3 merge(const AABB3 &b0, const AABB3 &b1) {
6578
return AABB3{
@@ -108,11 +121,23 @@ inline Sphere compute_bounding_sphere(const AABB6 &b) {
108121
return Sphere{c, r};
109122
}
110123

124+
DEVICE
125+
inline bool inside(const AABB3 &b, const Vector3 &p) {
126+
return p.x >= b.p_min.x && p.x <= b.p_max.x &&
127+
p.y >= b.p_min.y && p.y <= b.p_max.y &&
128+
p.z >= b.p_min.z && p.z <= b.p_max.z;
129+
}
130+
111131
DEVICE
112132
inline bool inside(const Sphere &b, const Vector3 &p) {
113133
return distance(p, b.center) <= b.radius;
114134
}
115135

136+
DEVICE
137+
inline Vector3 center(const AABB3 &b) {
138+
return 0.5f * (b.p_max + b.p_min);
139+
}
140+
116141

117142
DEVICE
118143
inline bool intersect(const Sphere &s, const AABB3 &b) {

0 commit comments

Comments
 (0)