All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
RealVectorStateProjections.h
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2010, Rice University
00005 *  All rights reserved.
00006 *
00007 *  Redistribution and use in source and binary forms, with or without
00008 *  modification, are permitted provided that the following conditions
00009 *  are met:
00010 *
00011 *   * Redistributions of source code must retain the above copyright
00012 *     notice, this list of conditions and the following disclaimer.
00013 *   * Redistributions in binary form must reproduce the above
00014 *     copyright notice, this list of conditions and the following
00015 *     disclaimer in the documentation and/or other materials provided
00016 *     with the distribution.
00017 *   * Neither the name of the Rice University nor the names of its
00018 *     contributors may be used to endorse or promote products derived
00019 *     from this software without specific prior written permission.
00020 *
00021 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032 *  POSSIBILITY OF SUCH DAMAGE.
00033 *********************************************************************/
00034 
00035 /* Author: Ioan Sucan */
00036 
00037 #ifndef OMPL_BASE_SPACES_REAL_VECTOR_STATE_PROJECTIONS_
00038 #define OMPL_BASE_SPACES_REAL_VECTOR_STATE_PROJECTIONS_
00039 
00040 #include "ompl/base/ProjectionEvaluator.h"
00041 #include "ompl/base/spaces/RealVectorStateSpace.h"
00042 
00043 namespace ompl
00044 {
00045     namespace base
00046     {
00047 
00053         class RealVectorLinearProjectionEvaluator : public ProjectionEvaluator
00054         {
00055         public:
00056 
00059             RealVectorLinearProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes,
00060                                                 const ProjectionMatrix::Matrix &projection);
00061 
00064             RealVectorLinearProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes,
00065                                                 const ProjectionMatrix::Matrix &projection);
00066 
00069             RealVectorLinearProjectionEvaluator(const StateSpace *space,
00070                                                 const ProjectionMatrix::Matrix &projection);
00071 
00074             RealVectorLinearProjectionEvaluator(const StateSpacePtr &space,
00075                                                 const ProjectionMatrix::Matrix &projection);
00076 
00077             virtual unsigned int getDimension(void) const;
00078 
00079             virtual void project(const State *state, EuclideanProjection &projection) const;
00080 
00081         protected:
00082 
00084             ProjectionMatrix projection_;
00085 
00086         };
00087 
00089         class RealVectorRandomLinearProjectionEvaluator : public RealVectorLinearProjectionEvaluator
00090         {
00091         public:
00092 
00095             RealVectorRandomLinearProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes) :
00096                 RealVectorLinearProjectionEvaluator(space, cellSizes, ProjectionMatrix::ComputeRandom(space->getDimension(), cellSizes.size()))
00097             {
00098             }
00099 
00102             RealVectorRandomLinearProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes) :
00103                 RealVectorLinearProjectionEvaluator(space, cellSizes, ProjectionMatrix::ComputeRandom(space->getDimension(), cellSizes.size()))
00104             {
00105             }
00106 
00109             RealVectorRandomLinearProjectionEvaluator(const StateSpace *space, unsigned int dim) :
00110                 RealVectorLinearProjectionEvaluator(space, ProjectionMatrix::ComputeRandom(space->getDimension(), dim,
00111                                                                                            space->as<RealVectorStateSpace>()->getBounds().getDifference()))
00112             {
00113             }
00114 
00117             RealVectorRandomLinearProjectionEvaluator(const StateSpacePtr &space, unsigned int dim) :
00118                 RealVectorLinearProjectionEvaluator(space, ProjectionMatrix::ComputeRandom(space->getDimension(), dim,
00119                                                                                            space->as<RealVectorStateSpace>()->getBounds().getDifference()))
00120             {
00121             }
00122 
00123         };
00124 
00126         class RealVectorOrthogonalProjectionEvaluator : public ProjectionEvaluator
00127         {
00128         public:
00129 
00132             RealVectorOrthogonalProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes,
00133                                                     const std::vector<unsigned int> &components);
00134 
00137             RealVectorOrthogonalProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes,
00138                                                     const std::vector<unsigned int> &components);
00139 
00142             RealVectorOrthogonalProjectionEvaluator(const StateSpace *space, const std::vector<unsigned int> &components);
00143 
00146             RealVectorOrthogonalProjectionEvaluator(const StateSpacePtr &space, const std::vector<unsigned int> &components);
00147 
00148             virtual unsigned int getDimension(void) const;
00149 
00150             virtual void defaultCellSizes(void);
00151 
00152             virtual void project(const State *state, EuclideanProjection &projection) const;
00153 
00154         protected:
00155 
00157             std::vector<unsigned int> components_;
00158 
00159         };
00160 
00162         class RealVectorIdentityProjectionEvaluator : public ProjectionEvaluator
00163         {
00164         public:
00165 
00168             RealVectorIdentityProjectionEvaluator(const StateSpace *space, const std::vector<double> &cellSizes);
00169 
00172             RealVectorIdentityProjectionEvaluator(const StateSpacePtr &space, const std::vector<double> &cellSizes);
00173 
00176             RealVectorIdentityProjectionEvaluator(const StateSpace *space);
00177 
00180             RealVectorIdentityProjectionEvaluator(const StateSpacePtr &space);
00181 
00182             virtual unsigned int getDimension(void) const;
00183 
00184             virtual void defaultCellSizes(void);
00185 
00186             virtual void setup(void);
00187 
00188             virtual void project(const State *state, EuclideanProjection &projection) const;
00189 
00190         private:
00191 
00193             std::size_t copySize_;
00194 
00195         };
00196 
00197     }
00198 }
00199 #endif