OpenVDB: openvdb/math/Proximity.h Source File

OpenVDB 10.0.1

Proximity.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: MPL-2.0
3
4#ifndef OPENVDB_MATH_PROXIMITY_HAS_BEEN_INCLUDED
5#define OPENVDB_MATH_PROXIMITY_HAS_BEEN_INCLUDED
6
7#include <openvdb/Types.h>
8
9
10namespace openvdb {
11 OPENVDB_USE_VERSION_NAMESPACE
12namespace OPENVDB_VERSION_NAME {
13namespace math {
14
15/// @brief Closest Point on Triangle to Point. Given a triangle @c abc and a point @c p,
16/// return the point on @c abc closest to @c p and the corresponding barycentric coordinates.
17///
18/// @details Algorithms from "Real-Time Collision Detection" pg 136 to 142 by Christer Ericson.
19/// The closest point is obtained by first determining which of the triangles'
20/// Voronoi feature regions @c p is in and then computing the orthogonal projection
21/// of @c p onto the corresponding feature.
22///
23/// @param a The triangle's first vertex point.
24/// @param b The triangle's second vertex point.
25/// @param c The triangle's third vertex point.
26/// @param p Point to compute the closest point on @c abc for.
27/// @param uvw Barycentric coordinates, computed and returned.
28 OPENVDB_API Vec3d
29closestPointOnTriangleToPoint(
30 const Vec3d& a, const Vec3d& b, const Vec3d& c, const Vec3d& p, Vec3d& uvw);
31
32
33/// @brief Closest Point on Line Segment to Point. Given segment @c ab and point @c p,
34/// return the point on @c ab closest to @c p and @c t the parametric distance to @c b.
35///
36/// @param a The segment's first vertex point.
37/// @param b The segment's second vertex point.
38/// @param p Point to compute the closest point on @c ab for.
39/// @param t Parametric distance to @c b.
40 OPENVDB_API Vec3d
41closestPointOnSegmentToPoint(
42 const Vec3d& a, const Vec3d& b, const Vec3d& p, double& t);
43
44} // namespace math
45} // namespace OPENVDB_VERSION_NAME
46} // namespace openvdb
47
48#endif // OPENVDB_TOOLS_MESH_TO_VOLUME_UTIL_HAS_BEEN_INCLUDED
OPENVDB_API
#define OPENVDB_API
Definition: Platform.h:251
openvdb::v10_0::math::Vec3
Definition: Vec3.h:24
nanovdb::Vec3d
Vec3< double > Vec3d
Definition: NanoVDB.h:1288
openvdb::v10_0::math::closestPointOnTriangleToPoint
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, return the point on abc close...
openvdb::v10_0::math::closestPointOnSegmentToPoint
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, return the point on ab closest ...
openvdb
Definition: Exceptions.h:13
Types.h
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:212