coal/BV/RSS.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011-2014, Willow Garage, Inc.
5  * Copyright (c) 2014-2015, 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 COAL_RSS_H
39 #define COAL_RSS_H
40 
41 #include "coal/data_types.h"
42 
43 #include <boost/math/constants/constants.hpp>
44 
45 namespace coal {
46 
47 struct CollisionRequest;
48 
51 
53 struct COAL_DLLAPI RSS {
54  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
55 
62 
65 
67  CoalScalar length[2];
68 
71 
73  RSS() : axes(Matrix3s::Zero()), Tr(Vec3s::Zero()), radius(-1) {
74  length[0] = 0;
75  length[1] = 0;
76  }
77 
79  bool operator==(const RSS& other) const {
80  return axes == other.axes && Tr == other.Tr &&
81  length[0] == other.length[0] && length[1] == other.length[1] &&
82  radius == other.radius;
83  }
84 
86  bool operator!=(const RSS& other) const { return !(*this == other); }
87 
89  bool contain(const Vec3s& p) const;
90 
92  bool overlap(const RSS& other) const;
93 
95  bool overlap(const RSS& other, const CollisionRequest&,
96  CoalScalar& sqrDistLowerBound) const {
97  sqrDistLowerBound = sqrt(-1);
98  return overlap(other);
99  }
100 
103  CoalScalar distance(const RSS& other, Vec3s* P = NULL, Vec3s* Q = NULL) const;
104 
107  RSS& operator+=(const Vec3s& p);
108 
110  inline RSS& operator+=(const RSS& other) {
111  *this = *this + other;
112  return *this;
113  }
114 
116  RSS operator+(const RSS& other) const;
117 
119  inline CoalScalar size() const {
120  return (std::sqrt(length[0] * length[0] + length[1] * length[1]) +
121  2 * radius);
122  }
123 
125  inline const Vec3s& center() const { return Tr; }
126 
128  inline CoalScalar width() const { return length[0] + 2 * radius; }
129 
131  inline CoalScalar height() const { return length[1] + 2 * radius; }
132 
134  inline CoalScalar depth() const { return 2 * radius; }
135 
137  inline CoalScalar volume() const {
138  return (length[0] * length[1] * 2 * radius +
139  4 * boost::math::constants::pi<CoalScalar>() * radius * radius *
140  radius);
141  }
142 
146  bool overlap(const RSS& other, RSS& /*overlap_part*/) const {
147  return overlap(other);
148  }
149 };
150 
156 COAL_DLLAPI CoalScalar distance(const Matrix3s& R0, const Vec3s& T0,
157  const RSS& b1, const RSS& b2, Vec3s* P = NULL,
158  Vec3s* Q = NULL);
159 
162 COAL_DLLAPI bool overlap(const Matrix3s& R0, const Vec3s& T0, const RSS& b1,
163  const RSS& b2);
164 
167 COAL_DLLAPI bool overlap(const Matrix3s& R0, const Vec3s& T0, const RSS& b1,
168  const RSS& b2, const CollisionRequest& request,
169  CoalScalar& sqrDistLowerBound);
170 
171 } // namespace coal
172 
173 #endif
coal::RSS::operator+=
RSS & operator+=(const RSS &other)
Merge the RSS and another RSS.
Definition: coal/BV/RSS.h:110
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
coal::RSS::center
const Vec3s & center() const
The RSS center.
Definition: coal/BV/RSS.h:125
coal::RSS::depth
CoalScalar depth() const
Depth of the RSS.
Definition: coal/BV/RSS.h:134
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::RSS::radius
CoalScalar radius
Radius of sphere summed with rectangle to form RSS.
Definition: coal/BV/RSS.h:70
coal::RSS::width
CoalScalar width() const
Width of the RSS.
Definition: coal/BV/RSS.h:128
coal::RSS::length
CoalScalar length[2]
Side lengths of rectangle.
Definition: coal/BV/RSS.h:67
coal::distance
COAL_DLLAPI CoalScalar distance(const Matrix3s &R0, const Vec3s &T0, const kIOS &b1, const kIOS &b2, Vec3s *P=NULL, Vec3s *Q=NULL)
Approximate distance between two kIOS bounding volumes.
Definition: kIOS.cpp:180
coal::RSS::overlap
bool overlap(const RSS &other, RSS &) const
Check collision between two RSS and return the overlap part. For RSS, we return nothing,...
Definition: coal/BV/RSS.h:146
coal::RSS::volume
CoalScalar volume() const
Volume of the RSS.
Definition: coal/BV/RSS.h:137
coal::RSS::overlap
bool overlap(const RSS &other, const CollisionRequest &, CoalScalar &sqrDistLowerBound) const
Not implemented.
Definition: coal/BV/RSS.h:95
coal::RSS::operator==
bool operator==(const RSS &other) const
Equality operator.
Definition: coal/BV/RSS.h:79
coal::CollisionRequest
request to the collision algorithm
Definition: coal/collision_data.h:311
coal::overlap
COAL_DLLAPI bool overlap(const Matrix3s &R0, const Vec3s &T0, const AABB &b1, const AABB &b2)
Check collision between two aabbs, b1 is in configuration (R0, T0) and b2 is in identity.
Definition: AABB.cpp:134
coal::RSS::axes
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Matrix3s axes
Orientation of RSS. axis[i] is the ith column of the orientation matrix for the RSS; it is also the i...
Definition: coal/BV/RSS.h:61
coal::Matrix3s
Eigen::Matrix< CoalScalar, 3, 3 > Matrix3s
Definition: coal/data_types.h:81
coal::RSS::height
CoalScalar height() const
Height of the RSS.
Definition: coal/BV/RSS.h:131
coal::RSS::Tr
Vec3s Tr
Origin of the rectangle in RSS.
Definition: coal/BV/RSS.h:64
coal::RSS::RSS
RSS()
&#160;
Definition: coal/BV/RSS.h:73
coal::RSS::operator!=
bool operator!=(const RSS &other) const
Difference operator.
Definition: coal/BV/RSS.h:86
coal::RSS
A class for rectangle sphere-swept bounding volume.
Definition: coal/BV/RSS.h:53
data_types.h
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
coal::RSS::size
CoalScalar size() const
Size of the RSS (used in BV_Splitter to order two RSSs)
Definition: coal/BV/RSS.h:119


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:59