coal/internal/intersect.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_INTERSECT_H
39 #define COAL_INTERSECT_H
40 
42 
43 #include "coal/math/transform.h"
44 
45 namespace coal {
46 
48 class COAL_DLLAPI Intersect {
49  public:
50  static bool buildTrianglePlane(const Vec3s& v1, const Vec3s& v2,
51  const Vec3s& v3, Vec3s* n, CoalScalar* t);
52 }; // class Intersect
53 
55 class COAL_DLLAPI Project {
56  public:
57  struct COAL_DLLAPI ProjectResult {
60  CoalScalar parameterization[4];
61 
63  CoalScalar sqr_distance;
64 
66  unsigned int encode;
67 
68  ProjectResult() : sqr_distance(-1), encode(0) {}
69  };
70 
72  static ProjectResult projectLine(const Vec3s& a, const Vec3s& b,
73  const Vec3s& p);
74 
76  static ProjectResult projectTriangle(const Vec3s& a, const Vec3s& b,
77  const Vec3s& c, const Vec3s& p);
78 
80  static ProjectResult projectTetrahedra(const Vec3s& a, const Vec3s& b,
81  const Vec3s& c, const Vec3s& d,
82  const Vec3s& p);
83 
85  static ProjectResult projectLineOrigin(const Vec3s& a, const Vec3s& b);
86 
88  static ProjectResult projectTriangleOrigin(const Vec3s& a, const Vec3s& b,
89  const Vec3s& c);
90 
92  static ProjectResult projectTetrahedraOrigin(const Vec3s& a, const Vec3s& b,
93  const Vec3s& c, const Vec3s& d);
94 };
95 
97 class COAL_DLLAPI TriangleDistance {
98  public:
104  static void segPoints(const Vec3s& P, const Vec3s& A, const Vec3s& Q,
105  const Vec3s& B, Vec3s& VEC, Vec3s& X, Vec3s& Y);
106 
116  static CoalScalar sqrTriDistance(const Vec3s S[3], const Vec3s T[3], Vec3s& P,
117  Vec3s& Q);
118 
119  static CoalScalar sqrTriDistance(const Vec3s& S1, const Vec3s& S2,
120  const Vec3s& S3, const Vec3s& T1,
121  const Vec3s& T2, const Vec3s& T3, Vec3s& P,
122  Vec3s& Q);
123 
134  static CoalScalar sqrTriDistance(const Vec3s S[3], const Vec3s T[3],
135  const Matrix3s& R, const Vec3s& Tl, Vec3s& P,
136  Vec3s& Q);
137 
148  static CoalScalar sqrTriDistance(const Vec3s S[3], const Vec3s T[3],
149  const Transform3s& tf, Vec3s& P, Vec3s& Q);
150 
161  static CoalScalar sqrTriDistance(const Vec3s& S1, const Vec3s& S2,
162  const Vec3s& S3, const Vec3s& T1,
163  const Vec3s& T2, const Vec3s& T3,
164  const Matrix3s& R, const Vec3s& Tl, Vec3s& P,
165  Vec3s& Q);
166 
177  static CoalScalar sqrTriDistance(const Vec3s& S1, const Vec3s& S2,
178  const Vec3s& S3, const Vec3s& T1,
179  const Vec3s& T2, const Vec3s& T3,
180  const Transform3s& tf, Vec3s& P, Vec3s& Q);
181 };
182 
183 } // namespace coal
184 
186 
187 #endif
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition: coal/data_types.h:77
coal
Main namespace.
Definition: coal/broadphase/broadphase_bruteforce.h:44
transform.h
generate_distance_plot.b
float b
Definition: generate_distance_plot.py:7
coal::Matrix3s
Eigen::Matrix< CoalScalar, 3, 3 > Matrix3s
Definition: coal/data_types.h:81
coal::CoalScalar
double CoalScalar
Definition: coal/data_types.h:76
X


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