Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SkeletalPrimitive.hpp

Go to the documentation of this file.
00001 
00002 //
00003 //       Title           : SkeletalPrimitive.hpp
00004 //       Project         : D&D Demos
00005 //       Created         : Apr. 18, 2005
00006 //       Author          : Troy Harden, Ethan Swint, 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         : Abstract skeletal obstacle .  Defines the skeletal obstacle
00027 //                         interface for the various obstacles.
00028 //
00029 //----------------------------------------------------------------------------
00030 //
00031 //       $Revisions$
00032 //
00033 //       $Log: SkeletalPrimitive.hpp,v $
00034 //       Revision 1.18  2005/06/20 22:43:07  aspencer
00035 //       Changed UpdateInternalParamaters to updateInternalParameters
00036 //
00037 //       Revision 1.17  2005/06/10 17:03:20  josh
00038 //       Added Clone method.
00039 //
00040 //       Revision 1.16  2005/06/07 23:08:00  aspencer
00041 //       Added a virtual update function to ModelingObject. Made all inheriting, implemented Update functions virtual as well.
00042 //
00043 //       Revision 1.15  2005/06/07 20:11:54  aspencer
00044 //       Changed over to the new version of Node. Made appropriate changes in other files as a result. LoadRev2File in ObAvData no longer populates a node tree.
00045 //
00046 //       Revision 1.14  2005/06/07 18:20:48  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.13  2005/06/07 15:50:52  aspencer
00050 //       Moved the default constructor to not be an inline function, as it was causing problems whem both the filedata and the OA libraries were used.
00051 //
00052 //       Revision 1.12  2005/06/07 00:08:13  aspencer
00053 //       When a point was being set in a Plane object, the r, n, and s vectors were not automatically being updated. This is completely wrong and has now been fixed.
00054 //
00055 //       Revision 1.11  2005/06/06 23:28:25  aspencer
00056 //       Fixed a syntax error
00057 //
00058 //       Revision 1.10  2005/06/06 23:26:14  aspencer
00059 //       Changed all "SetInfo" functions to be "SetProperties" functions.
00060 //
00061 //       Revision 1.9  2005/06/03 20:03:55  aspencer
00062 //       Changed the "GetPoint" method so that it now returns a pointer. This allows error checking, such that if the index parameter is out of range a NULL pointer can be returned. Also removed the "normal" protected atribute from the class.
00063 //
00064 //       Revision 1.8  2005/06/03 18:32:44  aspencer
00065 //       Corrected header files
00066 //
00067 //       Revision 1.7  2005/06/02 16:38:56  aspencer
00068 //       Moved the protected attribute localToGlobal Xform from BoxOb.hpp, ConeOb.hpp, and SkeletalPrimitive.hpp to the abstract base class ModelingObject.hpp
00069 //
00070 //       Revision 1.6  2005/06/01 22:27:33  chetan
00071 //       Made changes to copyright headers
00072 //
00073 //       Revision 1.5  2005/06/01 19:51:06  aspencer
00074 //       Continued making commenting changes.
00075 //
00076 //       Revision 1.4  2005/06/01 19:51:06  aspencer
00077 //       Made further changes to commenting.
00078 //
00079 //       Revision 1.3  2005/05/31 19:38:43  aspencer
00080 //       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.
00081 //
00082 //       Revision 1.2  2005/05/27 15:56:49  aspencer
00083 //       Changed "Reference" enumeration to "ReferenceFrame"
00084 //
00085 //       Revision 1.1  2005/05/26 21:02:43  aspencer
00086 //       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/Initial Commit
00087 //
00088 //
00090 
00091 #ifndef SkeletalPrimitive_h
00092 #define SkeletalPrimitive_h
00093 
00094 //Includes go here
00095 #include "Primitive.hpp"
00096 
00097 namespace OSCAR { 
00105 class SkeletalPrimitive : public Primitive
00106 {
00107 public:
00108 
00114   SkeletalPrimitive(double rad = 0.0);
00115 
00123   bool SetProperties(const vector<Vector3>& pts, double rd);
00124 
00128   virtual ~SkeletalPrimitive(){  }
00129 
00134         virtual SkeletalPrimitive* Clone() const = 0;
00135 
00139   double GetRadius() const { return radius; }
00140 
00145   bool SetRadius(double rd);
00146 
00151   unsigned int Size() const;
00152 
00153   SkeletalPrimitive(const SkeletalPrimitive& arg);
00154 
00155   SkeletalPrimitive& operator=(const SkeletalPrimitive& rhs);
00156 
00162   virtual bool SetPoint(unsigned int index, const Vector3& pt);
00163 
00169   bool SetPoints(const vector<Vector3> pts);
00170 
00177   const Vector3* GetPoint(unsigned int index, ReferenceFrame globalOrLocal = Global) const;
00178 
00183   virtual bool Update(const Xform& transform);
00184 
00190   /* Legacy code: currently unimplemented and un-needed
00191   bool UpdateSinglePoint(const Xform& transform, const unsigned int index);
00192   */
00193 
00198   const vector<Vector3>& GetPoints(ReferenceFrame globalOrLocal = Global) const { return point[globalOrLocal]; }
00199   
00200   //Below is a function which is no longer needed
00201   //vector<Vector3>& GetPoints(ReferenceFrame globalOrLocal = Global) { return point[globalOrLocal]; }
00202 
00209   unsigned int AddPoint(const Vector3& newPt);//, ReferenceFrame globalOrLocal = Global);
00210 
00216   bool Clear(){point[Local].clear(); point[Global].clear(); radius=0; return true;}
00217 
00218 protected:
00219   double radius;
00220   vector<Vector3> point[2];
00221 
00222   //Automatically updates any internal parameters (such as the r,n, and s vectors contained in plane)
00223   //Is called whenever a local point is changed by the user, but is only further implemented in Plane.cpp since it is the only
00224   //inheriting primitive which has internal parameters which need to be updated when a point is changed.
00225   virtual bool updateInternalParameters(){return false;};
00226 
00227 };
00228 
00229 #include "SkeletalPrimitive.ipp"
00230 }  //namespace OSCAR
00231 #endif //SkeletalPrimitive_h
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations