FCL  0.6.0
Flexible Collision Library
geometry.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2016, Open Source Robotics Foundation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Open Source Robotics Foundation nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
38 #ifndef FCL_MATH_GEOMETRY_H
39 #define FCL_MATH_GEOMETRY_H
40 
41 #include <cmath>
42 #include <iostream>
43 #include <vector>
44 
45 #include "fcl/config.h"
46 #include "fcl/common/types.h"
47 #include "fcl/math/triangle.h"
48 
49 namespace fcl {
50 
51 template <typename S>
52 void normalize(Vector3<S>& v, bool* signal);
53 
54 template <typename Derived>
55 typename Derived::RealScalar triple(const Eigen::MatrixBase<Derived>& x,
56  const Eigen::MatrixBase<Derived>& y,
57  const Eigen::MatrixBase<Derived>& z);
58 
59 template <typename Derived>
60 void generateCoordinateSystem(
61  const Eigen::MatrixBase<Derived>& w,
62  Eigen::MatrixBase<Derived>& u,
63  Eigen::MatrixBase<Derived>& v);
64 
65 template <typename S, int M, int N>
66 VectorN<S, M+N> combine(
67  const VectorN<S, M>& v1, const VectorN<S, N>& v2);
68 
69 template <typename S>
70 void hat(Matrix3<S>& mat, const Vector3<S>& vec);
71 
74 template <typename S>
75 void eigen(const Matrix3<S>& m, Vector3<S>& dout, Matrix3<S>& vout);
76 
79 template<typename S>
80 void eigen_old(const Matrix3<S>& m, Vector3<S>& dout, Matrix3<S>& vout);
81 
82 template <typename S>
83 void axisFromEigen(const Matrix3<S>& eigenV,
84  const Vector3<S>& eigenS,
85  Matrix3<S>& axis);
86 
87 template <typename S>
88 void axisFromEigen(const Matrix3<S>& eigenV,
89  const Vector3<S>& eigenS,
90  Transform3<S>& tf);
91 
92 template <typename S>
93 void generateCoordinateSystem(Matrix3<S>& axis);
94 
95 template <typename S>
96 void generateCoordinateSystem(Transform3<S>& tf);
97 
98 template <typename DerivedA, typename DerivedB, typename DerivedC, typename DerivedD>
99 void relativeTransform(
100  const Eigen::MatrixBase<DerivedA>& R1, const Eigen::MatrixBase<DerivedB>& t1,
101  const Eigen::MatrixBase<DerivedA>& R2, const Eigen::MatrixBase<DerivedB>& t2,
102  Eigen::MatrixBase<DerivedC>& R, Eigen::MatrixBase<DerivedD>& t);
103 
104 template <typename S, typename DerivedA, typename DerivedB>
105 void relativeTransform(
106  const Eigen::Transform<S, 3, Eigen::Isometry>& T1,
107  const Eigen::Transform<S, 3, Eigen::Isometry>& T2,
108  Eigen::MatrixBase<DerivedA>& R, Eigen::MatrixBase<DerivedB>& t);
109 
112 template <typename S>
113 void getRadiusAndOriginAndRectangleSize(
114  Vector3<S>* ps,
115  Vector3<S>* ps2,
116  Triangle* ts,
117  unsigned int* indices,
118  int n,
119  const Matrix3<S>& axis,
120  Vector3<S>& origin,
121  S l[2],
122  S& r);
123 
126 template <typename S>
127 void getRadiusAndOriginAndRectangleSize(
128  Vector3<S>* ps,
129  Vector3<S>* ps2,
130  Triangle* ts,
131  unsigned int* indices,
132  int n,
133  Transform3<S>& tf,
134  S l[2],
135  S& r);
136 
138 template <typename S>
139 void circumCircleComputation(
140  const Vector3<S>& a,
141  const Vector3<S>& b,
142  const Vector3<S>& c,
143  Vector3<S>& center,
144  S& radius);
145 
147 template <typename S>
148 S maximumDistance(
149  Vector3<S>* ps,
150  Vector3<S>* ps2,
151  Triangle* ts,
152  unsigned int* indices,
153  int n,
154  const Vector3<S>& query);
155 
158 template <typename S>
159 void getExtentAndCenter(
160  Vector3<S>* ps,
161  Vector3<S>* ps2,
162  Triangle* ts,
163  unsigned int* indices,
164  int n,
165  const Matrix3<S>& axis,
166  Vector3<S>& center,
167  Vector3<S>& extent);
168 
171 template <typename S>
172 void getExtentAndCenter(
173  Vector3<S>* ps,
174  Vector3<S>* ps2,
175  Triangle* ts,
176  unsigned int* indices,
177  int n,
178  Transform3<S>& tf,
179  Vector3<S>& extent);
180 
184 template <typename S>
185 void getCovariance(
186  Vector3<S>* ps,
187  Vector3<S>* ps2,
188  Triangle* ts,
189  unsigned int* indices,
190  int n,
191  Matrix3<S>& M);
192 
193 } // namespace fcl
194 
195 #include "fcl/math/geometry-inl.h"
196 
197 #endif
Main namespace.
Definition: broadphase_bruteforce-inl.h:45