goat3d

view src/aabox.cc @ 84:022b13ed975b

minor gui fix
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 12 May 2014 07:37:30 +0300
parents 76dea247f75c
children
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 bool AABox::operator ==(const AABox &rhs) const
18 {
19 return bmin == rhs.bmin && bmax == rhs.bmax;
20 }
22 bool AABox::operator !=(const AABox &rhs) const
23 {
24 return !(*this == rhs);
25 }
27 AABox g3dimpl::aabox_union(const AABox &a, const AABox &b)
28 {
29 Vector3 bmin, bmax;
31 for(int i=0; i<3; i++) {
32 bmin[i] = std::min(a.bmin[i], b.bmin[i]);
33 bmax[i] = std::max(a.bmax[i], b.bmax[i]);
34 }
36 return AABox(bmin, bmax);
37 }