goat3d

annotate src/aabox.cc @ 90:8b156bc5205b

[maxgoat] fixed the transform export bug [goatview] added widgets for the animation controls [goatview] added a grid ground plane with automatic sizing and transitions from size to size
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 May 2014 06:26:24 +0300
parents 76dea247f75c
children
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@82 17 bool AABox::operator ==(const AABox &rhs) const
nuclear@82 18 {
nuclear@82 19 return bmin == rhs.bmin && bmax == rhs.bmax;
nuclear@82 20 }
nuclear@82 21
nuclear@82 22 bool AABox::operator !=(const AABox &rhs) const
nuclear@82 23 {
nuclear@82 24 return !(*this == rhs);
nuclear@82 25 }
nuclear@82 26
nuclear@75 27 AABox g3dimpl::aabox_union(const AABox &a, const AABox &b)
nuclear@75 28 {
nuclear@75 29 Vector3 bmin, bmax;
nuclear@75 30
nuclear@75 31 for(int i=0; i<3; i++) {
nuclear@75 32 bmin[i] = std::min(a.bmin[i], b.bmin[i]);
nuclear@75 33 bmax[i] = std::max(a.bmax[i], b.bmax[i]);
nuclear@75 34 }
nuclear@75 35
nuclear@75 36 return AABox(bmin, bmax);
nuclear@75 37 }