00001 00002 // 00003 // Title : Box.hpp 00004 // Project : OSCAR 00005 // Created : Oct 25, 2004 00006 // Author : Andrew Spencer 00007 // Platforms : All 00008 // Copyright : Copyright© The University of Texas at Austin, 2002. All rights reserved. 00009 // 00010 // This software and documentation constitute an unpublished work 00011 // and contain valuable trade secrets and proprietary information 00012 // belonging to the University. None of the foregoing material may be 00013 // copied or duplicated or disclosed without the express, written 00014 // permission of University. THE UNIVERSITY EXPRESSLY DISCLAIMS ANY 00015 // AND ALL WARRANTIES CONCERNING THIS SOFTWARE AND DOCUMENTATION, 00016 // INCLUDING ANY WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 00017 // PARTICULAR PURPOSE, AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY 00018 // THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE. 00019 // NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF 00020 // THE SOFTWARE OR DOCUMENTATION. Under no circumstances shall the 00021 // University be liable for incidental, special, indirect, direct or 00022 // consequential damages or loss of profits, interruption of business, 00023 // or related expenses which may arise from use of software or documentation, 00024 // including but not limited to those resulting from defects in software 00025 // and/or documentation, or loss or inaccuracy of data of any kind. 00026 // Purpose : A rectangular box obstacle, made up of six zero radius planes 00027 // 00028 // $Revisions$ 00029 // 00030 // $Log: Box.hpp,v $ 00031 // Revision 1.9 2005/11/23 16:59:11 aspencer 00032 // Corrected an error in how the global corner points were calculated. 00033 // 00034 // Revision 1.8 2005/06/21 15:31:07 aspencer 00035 // Re-wrapped the hpp files with _SOLID ifdefs, per chetan. 00036 // 00037 // Revision 1.7 2005/06/16 16:59:34 chetan 00038 // Issues with base class constructors not being called, etc. 00039 // 00040 // Revision 1.6 2005/06/10 17:03:16 josh 00041 // Added Clone method. 00042 // 00043 // Revision 1.5 2005/06/07 23:07:58 aspencer 00044 // Added a virtual update function to ModelingObject. Made all inheriting, implemented Update functions virtual as well. 00045 // 00046 // Revision 1.4 2005/06/07 18:20:45 aspencer 00047 // Changed how SOLID functionality was implemented so that there are no #ifdef _SOLID tags in the header files which would cause errors when the header file was included in another library. 00048 // 00049 // Revision 1.3 2005/06/06 23:26:12 aspencer 00050 // Changed all "SetInfo" functions to be "SetProperties" functions. 00051 // 00052 // Revision 1.2 2005/06/06 14:21:53 chetan 00053 // Changed SetInfo method name to SetProperties 00054 // 00055 // Revision 1.1 2005/06/03 18:15:38 aspencer 00056 // Removed the "Ob" designation from all primitive names (BoxOb is now Box, etc). Changed "CylOb" to "Cylisphere". 00057 // 00058 // Revision 1.21 2005/06/02 16:38:56 aspencer 00059 // Moved the protected attribute localToGlobal Xform from BoxOb.hpp, ConeOb.hpp, and SkeletalPrimitive.hpp to the abstract base class ModelingObject.hpp 00060 // 00061 // Revision 1.20 2005/06/01 22:27:26 chetan 00062 // Made changes to copyright headers 00063 // 00064 // Revision 1.19 2005/06/01 19:51:04 aspencer 00065 // Made further changes to commenting. 00066 // 00067 // Revision 1.18 2005/06/01 16:37:24 aspencer 00068 // Continued re-naming of functions and updating of documentation. 00069 // 00070 // Revision 1.17 2005/05/31 19:38:40 aspencer 00071 // Changes to various function names in the primitive classes (trying to fit the "Get/Set" scheme of the rest of OSCAR). Also moved some code in primitive files from .hpp to .cpp, as it should be. 00072 // 00073 // Revision 1.16 2005/05/27 16:32:11 aspencer 00074 // Corrected Header File 00075 // 00076 // Revision 1.15 2005/05/27 15:56:48 aspencer 00077 // Changed "Reference" enumeration to "ReferenceFrame" 00078 // 00079 // Revision 1.14 2005/05/26 21:01:53 aspencer 00080 // Changed "obstacle" to "primitive" in both the obstacle and the skeletalobstacle class. Inserted "modeling object" abstract class, which primitive (was obstacle) now inherits from. Updated the rest of OSCAR to reflect this. 00081 // 00082 // Revision 1.13 2005/05/06 18:46:26 aspencer 00083 // Added ingroup specifications into doxygen commenting (thanks Peter) 00084 // 00085 // Revision 1.12 2005/05/03 17:29:27 aspencer 00086 // no message 00087 // 00088 // Revision 1.11 2005/05/02 22:18:54 aspencer 00089 // Added solid functionality. This is as yet untested as boxob is not fully integrated into the rest of OA. 00090 // 00091 // Revision 1.10 2005/04/29 16:27:54 aspencer 00092 // Moved BoxOb from deriving from skeletalobstacle to deriving from obstacle. Also changed how the object is created and added appropriate functionality. SOLID functionality has not been implemented. 00093 // 00094 // Revision 1.9 2005/04/21 22:06:19 aspencer 00095 // Inserted a new "skeletalobstacle" abstract class which inherits from obstacle. Planes, spheres and cylispheres now all inherit from this new class. 00096 // 00097 // Revision 1.8 2005/03/18 20:06:20 chetan 00098 // Enabled W4 level warnings and fixed warnings 00099 // 00100 // Revision 1.7 2005/03/18 19:20:22 chetan 00101 // Fixed errors under g++ compile 00102 // 00103 // Revision 1.6 2005/03/14 21:26:43 aspencer 00104 // Added to namespace OSCAR and removed "RR" from front of class names. 00105 // 00106 // Revision 1.5 2005/02/23 14:06:45 aspencer 00107 // Changed many things while implementing in OSCAR 00108 // 00109 // Revision 1.4 2004/11/12 18:56:40 aspencer 00110 // Changed the initial 'i' value in the z portion of "PopulatePoints" from i=1 to i=0. With i=1 not all points are being given the correct value. 00111 // 00112 // Revision 1.3 2004/10/27 21:09:53 aspencer 00113 // Added an author tag for doxygen 00114 // 00115 // Revision 1.2 2004/10/26 21:29:53 aspencer 00116 // Discarded the six seperate Planes and made a six long vector of Planes. 00117 // 00118 // Revision 1.1 2004/10/25 18:04:53 aspencer 00119 // Initial Commit 00120 // 00122 #ifndef Box_h 00123 #define Box_h 00124 00125 //Includes go here 00126 #include "Primitive.hpp" 00127 #include "Plane.hpp" 00128 #include <vector> 00129 00130 namespace OSCAR { 00131 00141 class Box : public Primitive { 00142 public: 00143 00154 Box(const double xDimen, const double yDimen, const double zDimen, const Xform& pose); //Constructor 00155 00159 Box(const Box& arg) : Primitive(arg) { 00160 this->operator=(arg); 00161 } 00162 00166 Box(); 00167 00172 virtual Box* Clone() const; 00173 00179 const vector<Plane>& GetPlanes() const { return planes; } 00180 00189 const vector<unsigned int>& GetAdjacentVertices(unsigned int index) const; 00190 00199 const vector<unsigned int>& GetAdjacentPlanes(unsigned int index) const; 00200 00208 const vector<Vector3>& GetPoints(ReferenceFrame globalOrLocal = Global) const {return point[globalOrLocal];} 00209 00218 bool SetProperties(const double xDimen, const double yDimen, const double zDimen, const Xform& pose); 00219 00225 bool SetXDim(const double xDimen); 00226 00232 bool SetYDim(const double yDimen); 00233 00239 bool SetZDim(const double zDimen); 00240 00247 bool SetLocalTransform(const Xform& inFrameTransform); 00248 00252 double GetXDim() const {return xDim;} 00253 00258 double GetYDim() const {return yDim;} 00259 00264 double GetZDim() const {return zDim;} 00265 00270 const Xform& GetLocalTransform() const {return localTransform;} 00271 00277 virtual bool Update(const Xform& transform); 00278 00279 Box& operator=(const Box& rhs); 00280 00281 Xform& GetCompleteXform(); 00282 protected: 00283 00284 double xDim, yDim, zDim; 00285 Xform localTransform; 00286 Xform fullTransform; 00287 bool populatePoints(); 00288 bool updatePlanes(); 00289 bool populateMaps(); 00290 bool TransformInternalToLocal(); 00291 std::vector<Plane> planes; 00292 std::vector<Vector3> internalPoint; 00293 std::vector<Vector3> point[2]; 00294 //std::map<const Vector3*, const Vector3* 00295 unsigned int vertexMap[8][3]; 00296 unsigned int planeMap[8][3]; 00297 #if defined _SOLID 00298 virtual bool createSolid(); 00299 #endif 00300 }; 00301 00302 //Inline include 00303 #include "Box.ipp" 00304 } //namespace OSCAR 00305 #endif //box_h
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |