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 <ompl/config.h>
41 #if !OMPL_HAVE_EIGEN3
42 #error The ProlateHyperspheroid class uses Eigen3, which was not detected at build time.
43 #endif
44 
45 #include <memory>
46 
47 // For ease-of-use shared_ptr definition
48 #include <ompl/util/ClassForward.h>
49 
50 namespace ompl
51 {
53  // A forward declaration of the prolate hyperspheroid class
54  OMPL_CLASS_FORWARD(ProlateHyperspheroid);
56 
67  {
68  public:
70  ProlateHyperspheroid(unsigned int n, const double focus1[], const double focus2[]);
71 
73  void setTransverseDiameter(double transverseDiameter);
74 
76  void transform(const double sphere[], double phs[]) const;
77 
79  bool isInPhs(const double point[]) const;
80 
82  bool isOnPhs(const double point[]) const;
83 
85  unsigned int getPhsDimension() const;
86 
88  double getPhsMeasure() const;
89 
91  double getPhsMeasure(double tranDiam) const;
92 
94  double getMinTransverseDiameter() const;
95 
98  double getPathLength(const double point[]) const;
99 
101  unsigned int getDimension() const;
102 
103  protected:
104  private:
106  struct PhsData;
107 
109  std::shared_ptr<PhsData> dataPtr_;
110 
111  // Functions
114  void updateRotation();
115 
117  void updateTransformation();
118  };
119 }
120 
121 #endif
bool isOnPhs(const double point[]) const
Check if the given point lies on the PHS.
double getPhsMeasure() const
The measure of the PHS.
double getPathLength(const double point[]) const
Calculate length of a line that originates from one focus, passes through the given point...
unsigned int getPhsDimension() const
The dimension of the PHS.
void setTransverseDiameter(double transverseDiameter)
Set the transverse diameter of 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.
Definition: AppBase.h:21
bool isInPhs(const double point[]) const
Check if the given point lies in the PHS.
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...
A class describing a prolate hyperspheroid, a special symmetric type of n-dimensional ellipse...
unsigned int getDimension() const
The state dimension of the PHS.