ProlateHyperspheroid.h
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2014, University of Toronto
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the University of Toronto nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 /* Author: Jonathan Gammell */
36 
37 #ifndef OMPL_UTIL_PROLATE_HYPERSPHEROID_
38 #define OMPL_UTIL_PROLATE_HYPERSPHEROID_
39 
40 #include <memory>
41 
42 // For ease-of-use shared_ptr definition
43 #include <ompl/util/ClassForward.h>
44 
45 namespace ompl
46 {
48  // A forward declaration of the prolate hyperspheroid class
49  OMPL_CLASS_FORWARD(ProlateHyperspheroid);
51 
60  class ProlateHyperspheroid
61  {
62  public:
64  ProlateHyperspheroid(unsigned int n, const double focus1[], const double focus2[]);
65 
67  void setTransverseDiameter(double transverseDiameter);
68 
70  void transform(const double sphere[], double phs[]) const;
71 
73  bool isInPhs(const double point[]) const;
74 
76  bool isOnPhs(const double point[]) const;
77 
79  unsigned int getPhsDimension() const;
80 
82  double getPhsMeasure() const;
83 
85  double getPhsMeasure(double tranDiam) const;
86 
88  double getMinTransverseDiameter() const;
89 
92  double getPathLength(const double point[]) const;
93 
95  unsigned int getDimension() const;
96 
97  protected:
98  private:
100  struct PhsData;
101 
103  std::shared_ptr<PhsData> dataPtr_;
104 
105  // Functions
108  void updateRotation();
109 
111  void updateTransformation();
112  };
113 }
114 
115 #endif
ProlateHyperspheroid(unsigned int n, const double focus1[], const double focus2[])
The description of an n-dimensional prolate hyperspheroid.
void transform(const double sphere[], double phs[]) const
Transform a point from a sphere to PHS. The return variable phs is expected to already exist.
bool isInPhs(const double point[]) const
Check if the given point lies in the PHS.
double getPathLength(const double point[]) const
Calculate length of a line that originates from one focus, passes through the given point,...
void setTransverseDiameter(double transverseDiameter)
Set the transverse diameter of the PHS.
unsigned int getDimension() const
The state dimension of the PHS.
double getPhsMeasure() const
The measure of the PHS.
unsigned int getPhsDimension() const
The dimension of the PHS.
bool isOnPhs(const double point[]) const
Check if the given point lies on the PHS.
double getMinTransverseDiameter() const
The minimum transverse diameter of the PHS, i.e., the distance between the foci.
Main namespace. Contains everything in this library.