00001 #ifndef OPENTISSUE_CORE_GEOMETRY_GEOMETRY_BASE_SHAPE_H 00002 #define OPENTISSUE_CORE_GEOMETRY_GEOMETRY_BASE_SHAPE_H 00003 // 00004 // OpenTissue Template Library 00005 // - A generic toolbox for physics-based modeling and simulation. 00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. 00007 // 00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php 00009 // 00010 #include <OpenTissue/configuration.h> 00011 00012 #include <OpenTissue/collision/collision_geometry_interface.h> 00013 00014 #include <vector> 00015 00016 00017 namespace OpenTissue 00018 { 00019 00020 namespace geometry 00021 { 00022 00029 template< typename math_types > 00030 class BaseShape 00031 : public OpenTissue::collision::GeometryInterface< math_types > 00032 { 00033 public: 00034 00035 virtual ~BaseShape() {} 00036 00037 public: 00038 00039 typedef typename math_types::real_type real_type; 00040 typedef typename math_types::vector3_type vector3_type; 00041 typedef typename math_types::matrix3x3_type matrix3x3_type; 00042 00043 00044 // 2007-07-24 kenny: generic design problem with compute_surface_points 00045 // 2007-09-11 micky: I agree, it's not possible to have a pure abstract interface and letting the user decide his choice of point container. 00046 // 2007-09-11 micky: compute_surface_points and get_support_point should be removed from this interface. Both functions belong to some collision interface. 00047 // 2007-09-18 kenny: I partial agree... get_support_point is used by GJK (exclusively as I recall?) However, compute_surface_points is used by some of the geometry utils. Fitting tools and such. 00048 00049 // TODO 2007-02-06 kenny: Yikes what if end-user wants to use std::list or some homebrewed container type? It is a bit ugly that the container type is hardwired into the abstract base class:-( Could we make something like a pure virtual template class? 00050 virtual void compute_surface_points( std::vector<vector3_type> & points) const = 0; 00051 virtual vector3_type get_support_point(vector3_type const & v) const = 0; 00052 00053 virtual void translate(vector3_type const & T) = 0; 00054 virtual void rotate(matrix3x3_type const & R) = 0; 00055 virtual void scale(real_type const & s) = 0; 00056 00057 }; 00058 00059 } // namespace geometry 00060 00061 } // namespace OpenTissue 00062 00063 //OPENTISSUE_CORE_GEOMETRY_GEOMETRY_BASE_SHAPE_H 00064 #endif