FCL  0.6.0
Flexible Collision Library
interval_vector.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 // This code is based on code developed by Stephane Redon at UNC and Inria for the CATCH library: http://graphics.ewha.ac.kr/CATCH/
38 #ifndef FCL_CCD_INTERVAL_VECTOR_H
39 #define FCL_CCD_INTERVAL_VECTOR_H
40 
41 #include "fcl/math/motion/taylor_model/interval.h"
42 
43 namespace fcl
44 {
45 
46 template <typename S>
47 struct IVector3
48 {
49  Interval<S> i_[3];
50 
51  IVector3();
52  IVector3(S v);
53  IVector3(S x, S y, S z);
54  IVector3(S xl, S xu, S yl, S yu, S zl, S zu);
55  IVector3(Interval<S> v[3]);
56  IVector3(S v[3][2]);
57  IVector3(const Interval<S>& v1, const Interval<S>& v2, const Interval<S>& v3);
58  IVector3(const Vector3<S>& v);
59 
60  void setValue(S v);
61 
62  void setValue(S x, S y, S z);
63 
64  void setValue(S xl, S xu, S yl, S yu, S zl, S zu);
65 
66  void setValue(S v[3][2]);
67 
68  void setValue(Interval<S> v[3]);
69 
70  void setValue(const Interval<S>& v1, const Interval<S>& v2, const Interval<S>& v3);
71 
72  void setValue(const Vector3<S>& v);
73 
74  void setValue(S v[3]);
75 
76  IVector3 operator + (const IVector3& other) const;
77  IVector3& operator += (const IVector3& other);
78 
79  IVector3 operator - (const IVector3& other) const;
80  IVector3& operator -= (const IVector3& other);
81 
82  Interval<S> dot(const IVector3& other) const;
83  IVector3 cross(const IVector3& other) const;
84 
85  Interval<S> dot(const Vector3<S>& other) const;
86  IVector3 cross(const Vector3<S>& other) const;
87 
88  const Interval<S>& operator [] (size_t i) const;
89 
90  Interval<S>& operator [] (size_t i);
91 
92  Vector3<S> getLow() const;
93 
94  Vector3<S> getHigh() const;
95 
96  void print() const;
97  Vector3<S> center() const;
98  S volumn() const;
99  void setZero();
100 
101  void bound(const Vector3<S>& v);
102  void bound(const IVector3& v);
103 
104  bool overlap(const IVector3& v) const;
105  bool contain(const IVector3& v) const;
106 };
107 
108 template <typename S>
109 IVector3<S> bound(const IVector3<S>& i, const Vector3<S>& v);
110 
111 template <typename S>
112 IVector3<S> bound(const IVector3<S>& i, const IVector3<S>& v);
113 
114 } // namespace fcl
115 
116 #include "fcl/math/motion/taylor_model/interval_vector-inl.h"
117 
118 #endif
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
Interval class for [a, b].
Definition: interval.h:50
Definition: interval_vector.h:47