True Axis Physics SDK 1.2.0.1 Beta Documentation
www.trueaxis.com

AABB.h

00001 //---------------------------------------------------------------------------------
00002 // File Name: AABB.h
00003 // Description: Axis Aligned Bounding Box
00004 //
00005 // Copyright (C) 2004 - 2006 True Axis Pty Ltd, Australia. 
00006 // All Rights Reserved.
00007 //
00008 // History:
00009 //      Created File.
00010 //---------------------------------------------------------------------------------
00011 
00012 #ifndef TA_AABB_H
00013 #define TA_AABB_H
00014 
00015 #ifndef TA_VECTOR_H
00016 #include "Vector.h"
00017 #endif // TA_VECTOR_H
00018 
00019 TA_OBFUSCATION_SKIP_PASS_2
00020 
00021 namespace TA
00022 {
00023 
00024 struct MFrame;
00025 
00026 struct TACOMMON_CLASS AABB
00027 {
00028     // Skip m_ for convenience and because we are a struct
00029     // I'm not really shore if a center and an extent
00030     // is better than a max and a min.
00031     TA_OBFUSCATION_RESERVED_FULL_ON
00032     Vec3 v3Center;
00033     Vec3 v3Extent;
00034     TA_OBFUSCATION_RESERVED_FULL_OFF
00035 
00036     TA_OBFUSCATION_RESERVED_ON
00037     AABB() {}
00038     AABB(const Vec3& v3NewCenter, const Vec3& v3NewExtent) { Initialise(v3NewCenter, v3NewExtent); }
00039 
00040     // Initialisation
00041     void Initialise(const Vec3& v3NewCenter, const Vec3& v3NewExtent);
00042     void InitialiseToFit2Points(const Vec3& v3A, const Vec3& v3B);
00043     void Clear();
00044 
00045     // Operators
00046     AABB& operator += (const AABB& aabb);
00047     AABB operator + (const AABB& aabb) const;
00048     AABB operator * (const MFrame& mFrame) const;
00049     AABB operator * (float fValue) const;
00050 
00051     // Other functions
00052     bool Intersects(const AABB& aabb) const;
00053     bool Intersects(const Vec3& v3Point) const;
00054     bool IsInside(const AABB& aabb) const;
00055     void ExpandToFit(const Vec3& v3Point);
00056     TA_OBFUSCATION_RESERVED_OFF
00057 };
00058 
00059 }
00060 
00061 #include "AABB.inl"
00062 
00063 #endif // TA_AABB_H


© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.