goat3d

view src/aabox.cc @ 75:76dea247f75c

in progress
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 08 May 2014 00:50:16 +0300
parents
children 70b7c41a4f17
line source
1 #include <float.h>
2 #include <algorithm>
3 #include "aabox.h"
5 using namespace g3dimpl;
7 AABox::AABox()
8 : bmin(FLT_MAX, FLT_MAX, FLT_MAX), bmax(-FLT_MAX, -FLT_MAX, -FLT_MAX)
9 {
10 }
12 AABox::AABox(const Vector3 &b0, const Vector3 &b1)
13 : bmin(b0), bmax(b1)
14 {
15 }
17 AABox g3dimpl::aabox_union(const AABox &a, const AABox &b)
18 {
19 Vector3 bmin, bmax;
21 for(int i=0; i<3; i++) {
22 bmin[i] = std::min(a.bmin[i], b.bmin[i]);
23 bmax[i] = std::max(a.bmax[i], b.bmax[i]);
24 }
26 return AABox(bmin, bmax);
27 }