00001 /****************************************************************************************/ 00002 /* BOX.H */ 00003 /* */ 00004 /* Author: Jason Wood */ 00005 /* Description: Box is a 3D Oriented Bounding Box */ 00006 /* */ 00007 /* The contents of this file are subject to the Genesis3D Public License */ 00008 /* Version 1.01 (the "License"); you may not use this file except in */ 00009 /* compliance with the License. You may obtain a copy of the License at */ 00010 /* http://www.genesis3d.com */ 00011 /* */ 00012 /* Software distributed under the License is distributed on an "AS IS" */ 00013 /* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ 00014 /* the License for the specific language governing rights and limitations */ 00015 /* under the License. */ 00016 /* */ 00017 /* The Original Code is Genesis3D, released March 25, 1999. */ 00018 /* Genesis3D Version 1.1 released November 15, 1999 */ 00019 /* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ 00020 /* */ 00021 /****************************************************************************************/ 00022 00023 #if !defined (GE_BOX_H) 00024 #define GE_BOX_H 00025 00026 #include "Vec3d.h" 00027 #include "XForm3d.h" 00028 00029 typedef struct geBox 00030 { 00031 // all member variables are **PRIVATE** 00032 // the Box's scales along the Box's local frame axes 00033 00034 geFloat xScale, yScale, zScale; 00035 00036 // the Box's local frame origin lies at (0, 0, 0) in local space 00037 // 00038 // these are the scaled Box axes in the global frame 00039 00040 geVec3d GlobalFrameAxes[3]; 00041 00042 // the transformation that takes the Box's axes from local space 00043 // to global space, and its inverse 00044 00045 geXForm3d Transform, TransformInv; 00046 00047 }geBox; 00048 00050 // call this to set up a Box for the first time or when the Box's 00051 // local frame axes scale(s) change 00052 void geBox_Set(geBox* Box, geFloat xScale, geFloat yScale, geFloat zScale, const geXForm3d* Transform); 00053 00054 00055 // call this to set the Box's transformation matrix (does not change the 00056 // scales of the Box's local frame axes) 00057 void geBox_SetXForm(geBox* Box, const geXForm3d* Transform); 00058 00059 00060 // returns GE_TRUE if the boxes overlap, GE_FALSE otherwise 00061 geBoolean geBox_DetectCollisionBetween(const geBox* Box1, const geBox* Box2); 00062 00063 #endif
1.3.2