coal/BV/OBBRSS.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_OBBRSS_H
39 #define COAL_OBBRSS_H
40 
41 #include "coal/BV/OBB.h"
42 #include "coal/BV/RSS.h"
43 
44 namespace coal {
45 
46 struct CollisionRequest;
47 
50 
53 struct COAL_DLLAPI OBBRSS {
54  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
55 
58 
61 
63  bool operator==(const OBBRSS& other) const {
64  return obb == other.obb && rss == other.rss;
65  }
66 
68  bool operator!=(const OBBRSS& other) const { return !(*this == other); }
69 
71  inline bool contain(const Vec3s& p) const { return obb.contain(p); }
72 
74  bool overlap(const OBBRSS& other) const { return obb.overlap(other.obb); }
75 
79  bool overlap(const OBBRSS& other, const CollisionRequest& request,
80  CoalScalar& sqrDistLowerBound) const {
81  return obb.overlap(other.obb, request, sqrDistLowerBound);
82  }
83 
86  CoalScalar distance(const OBBRSS& other, Vec3s* P = NULL,
87  Vec3s* Q = NULL) const {
88  return rss.distance(other.rss, P, Q);
89  }
90 
92  OBBRSS& operator+=(const Vec3s& p) {
93  obb += p;
94  rss += p;
95  return *this;
96  }
97 
99  OBBRSS& operator+=(const OBBRSS& other) {
100  *this = *this + other;
101  return *this;
102  }
103 
105  OBBRSS operator+(const OBBRSS& other) const {
106  OBBRSS result;
107  result.obb = obb + other.obb;
108  result.rss = rss + other.rss;
109  return result;
110  }
111 
113  inline CoalScalar size() const { return obb.size(); }
114 
116  inline const Vec3s& center() const { return obb.center(); }
117 
119  inline CoalScalar width() const { return obb.width(); }
120 
122  inline CoalScalar height() const { return obb.height(); }
123 
125  inline CoalScalar depth() const { return obb.depth(); }
126 
128  inline CoalScalar volume() const { return obb.volume(); }
129 };
130 
133 inline bool overlap(const Matrix3s& R0, const Vec3s& T0, const OBBRSS& b1,
134  const OBBRSS& b2) {
135  return overlap(R0, T0, b1.obb, b2.obb);
136 }
137 
144 inline bool overlap(const Matrix3s& R0, const Vec3s& T0, const OBBRSS& b1,
145  const OBBRSS& b2, const CollisionRequest& request,
146  CoalScalar& sqrDistLowerBound) {
147  return overlap(R0, T0, b1.obb, b2.obb, request, sqrDistLowerBound);
148 }
149 
152 inline CoalScalar distance(const Matrix3s& R0, const Vec3s& T0,
153  const OBBRSS& b1, const OBBRSS& b2, Vec3s* P = NULL,
154  Vec3s* Q = NULL) {
155  return distance(R0, T0, b1.rss, b2.rss, P, Q);
156 }
157 
158 } // namespace coal
159 
160 #endif
coal::OBBRSS::rss
RSS rss
RSS member, for distance.
Definition: coal/BV/OBBRSS.h:60
coal::OBBRSS::overlap
bool overlap(const OBBRSS &other) const
Check collision between two OBBRSS.
Definition: coal/BV/OBBRSS.h:74
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
coal::OBBRSS::operator+=
OBBRSS & operator+=(const Vec3s &p)
Merge the OBBRSS and a point.
Definition: coal/BV/OBBRSS.h:92
coal::RSS::distance
CoalScalar distance(const RSS &other, Vec3s *P=NULL, Vec3s *Q=NULL) const
the distance between two RSS; P and Q, if not NULL, return the nearest points
Definition: RSS.cpp:982
obb
Definition: obb.py:1
OBB.h
coal::OBBRSS::depth
CoalScalar depth() const
Depth of the OBBRSS.
Definition: coal/BV/OBBRSS.h:125
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
coal::OBBRSS::operator+=
OBBRSS & operator+=(const OBBRSS &other)
Merge two OBBRSS.
Definition: coal/BV/OBBRSS.h:99
coal::OBBRSS::obb
EIGEN_MAKE_ALIGNED_OPERATOR_NEW OBB obb
OBB member, for rotation.
Definition: coal/BV/OBBRSS.h:57
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::OBBRSS::operator==
bool operator==(const OBBRSS &other) const
Equality operator.
Definition: coal/BV/OBBRSS.h:63
RSS.h
coal::OBBRSS::distance
CoalScalar distance(const OBBRSS &other, Vec3s *P=NULL, Vec3s *Q=NULL) const
Distance between two OBBRSS; P and Q , is not NULL, returns the nearest points.
Definition: coal/BV/OBBRSS.h:86
coal::OBBRSS
Class merging the OBB and RSS, can handle collision and distance simultaneously.
Definition: coal/BV/OBBRSS.h:53
P
P
coal::OBBRSS::center
const Vec3s & center() const
Center of the OBBRSS.
Definition: coal/BV/OBBRSS.h:116
coal::CollisionRequest
request to the collision algorithm
Definition: coal/collision_data.h:311
coal::OBBRSS::height
CoalScalar height() const
Height of the OBBRSS.
Definition: coal/BV/OBBRSS.h:122
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::OBBRSS::operator+
OBBRSS operator+(const OBBRSS &other) const
Merge two OBBRSS.
Definition: coal/BV/OBBRSS.h:105
coal::OBBRSS::width
CoalScalar width() const
Width of the OBRSS.
Definition: coal/BV/OBBRSS.h:119
coal::OBBRSS::overlap
bool overlap(const OBBRSS &other, const CollisionRequest &request, CoalScalar &sqrDistLowerBound) const
Definition: coal/BV/OBBRSS.h:79
coal::Matrix3s
Eigen::Matrix< CoalScalar, 3, 3 > Matrix3s
Definition: coal/data_types.h:81
coal::OBBRSS::volume
CoalScalar volume() const
Volume of the OBBRSS.
Definition: coal/BV/OBBRSS.h:128
coal::OBB
Oriented bounding box class.
Definition: include/coal/BV/OBB.h:51
coal::OBBRSS::contain
bool contain(const Vec3s &p) const
Check whether the OBBRSS contains a point.
Definition: coal/BV/OBBRSS.h:71
coal::OBBRSS::operator!=
bool operator!=(const OBBRSS &other) const
Difference operator.
Definition: coal/BV/OBBRSS.h:68
coal::RSS
A class for rectangle sphere-swept bounding volume.
Definition: coal/BV/RSS.h:53
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
coal::OBBRSS::size
CoalScalar size() const
Size of the OBBRSS (used in BV_Splitter to order two OBBRSS)
Definition: coal/BV/OBBRSS.h:113


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