goat3d

annotate 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
rev   line source
nuclear@75 1 #include <float.h>
nuclear@75 2 #include <algorithm>
nuclear@75 3 #include "aabox.h"
nuclear@75 4
nuclear@75 5 using namespace g3dimpl;
nuclear@75 6
nuclear@75 7 AABox::AABox()
nuclear@75 8 : bmin(FLT_MAX, FLT_MAX, FLT_MAX), bmax(-FLT_MAX, -FLT_MAX, -FLT_MAX)
nuclear@75 9 {
nuclear@75 10 }
nuclear@75 11
nuclear@75 12 AABox::AABox(const Vector3 &b0, const Vector3 &b1)
nuclear@75 13 : bmin(b0), bmax(b1)
nuclear@75 14 {
nuclear@75 15 }
nuclear@75 16
nuclear@75 17 AABox g3dimpl::aabox_union(const AABox &a, const AABox &b)
nuclear@75 18 {
nuclear@75 19 Vector3 bmin, bmax;
nuclear@75 20
nuclear@75 21 for(int i=0; i<3; i++) {
nuclear@75 22 bmin[i] = std::min(a.bmin[i], b.bmin[i]);
nuclear@75 23 bmax[i] = std::max(a.bmax[i], b.bmax[i]);
nuclear@75 24 }
nuclear@75 25
nuclear@75 26 return AABox(bmin, bmax);
nuclear@75 27 }