OpenVDB  2.0.0
Proximity.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2013 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30 
31 #ifndef OPENVDB_MATH_PROXIMITY_HAS_BEEN_INCLUDED
32 #define OPENVDB_MATH_PROXIMITY_HAS_BEEN_INCLUDED
33 
34 #include <openvdb/Types.h>
35 //#include <openvdb/openvdb.h>
36 
37 
38 namespace openvdb {
40 namespace OPENVDB_VERSION_NAME {
41 namespace math {
42 
43 
60  const Vec3d& a, const Vec3d& b, const Vec3d& c, const Vec3d& p, Vec3d& uvw);
61 
62 
73  const Vec3d& a, const Vec3d& b, const Vec3d& p, double& t);
74 
75 
77 
78 
79 // DEPRECATED METHODS
80 
81 
86  const Vec3d &p1,
87  const Vec3d &point,
88  double &t,
89  double epsilon = 1e-10);
90 
91 
118 sTri3ToPointDistSqr(const Vec3d &v0,
119  const Vec3d &v1,
120  const Vec3d &v2,
121  const Vec3d &point,
122  Vec2d &uv,
123  double epsilon);
124 
125 
127 static inline OPENVDB_DEPRECATED double
129  const Vec3d &v1,
130  const Vec3d &v2,
131  const Vec3d &point)
132 {
133  Vec3d cpt, uvw;
134  cpt = closestPointOnTriangleToPoint(v0, v1, v2, point, uvw);
135  return (cpt - point).lengthSqr();
136 }
137 
138 
139 } // namespace math
140 } // namespace OPENVDB_VERSION_NAME
141 } // namespace openvdb
142 
143 #endif // OPENVDB_TOOLS_MESH_TO_VOLUME_UTIL_HAS_BEEN_INCLUDED
144 
145 // Copyright (c) 2012-2013 DreamWorks Animation LLC
146 // All rights reserved. This software is distributed under the
147 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
#define OPENVDB_API
Helper macros for defining library symbol visibility.
Definition: Platform.h:162
#define OPENVDB_DEPRECATED
Definition: Platform.h:47
OPENVDB_API Vec3d closestPointOnSegmentToPoint(const Vec3d &a, const Vec3d &b, const Vec3d &p, double &t)
Closest Point on Line Segment to Point. Given segment ab and point p, returns the point on ab closest...
OPENVDB_API Vec3d closestPointOnTriangleToPoint(const Vec3d &a, const Vec3d &b, const Vec3d &c, const Vec3d &p, Vec3d &uvw)
Closest Point on Triangle to Point. Given a triangle abc and a point p, returns the point on abc clos...
OPENVDB_API OPENVDB_DEPRECATED double sLineSeg3ToPointDistSqr(const Vec3d &p0, const Vec3d &p1, const Vec3d &point, double &t, double epsilon=1e-10)
Squared distance of a line segment p(t) = (1-t)*p0 + t*p1 to point.
#define OPENVDB_VERSION_NAME
Definition: version.h:45
static OPENVDB_DEPRECATED double triToPtnDistSqr(const Vec3d &v0, const Vec3d &v1, const Vec3d &v2, const Vec3d &point)
Definition: Proximity.h:128
Vec3< double > Vec3d
Definition: Vec3.h:605
Vec2< double > Vec2d
Definition: Vec2.h:502
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:56
OPENVDB_API OPENVDB_DEPRECATED double sTri3ToPointDistSqr(const Vec3d &v0, const Vec3d &v1, const Vec3d &v2, const Vec3d &point, Vec2d &uv, double epsilon)
Slightly modified version of the algorithm described in &quot;Geometric Tools for Computer Graphics&quot; pg 37...
ScalarToVectorConverter< GridType >::Type::Ptr cpt(const GridType &grid, bool threaded, InterruptT *interrupt)
Compute the Closest-Point Transform (CPT) from a distance field.
Definition: GridOperators.h:668