Distance

Distance Type

enum class ipc::PointEdgeDistanceType : uint8_t;

Closest pair between a point and edge.

Values:

enumerator P_E0;

The point is closest to edge vertex zero.

enumerator P_E1;

The point is closest to edge vertex one.

enumerator P_E;

The point is closest to the interior of the edge.

enumerator AUTO;

Automatically determine the closest pair.

enum class ipc::EdgeEdgeDistanceType : uint8_t;

Closest pair between two edges.

Values:

enumerator EA0_EB0;

The edges are closest at vertex 0 of edge A and 0 of edge B.

enumerator EA0_EB1;

The edges are closest at vertex 0 of edge A and 1 of edge B.

enumerator EA1_EB0;

The edges are closest at vertex 1 of edge A and 0 of edge B.

enumerator EA1_EB1;

The edges are closest at vertex 1 of edge A and 1 of edge B.

enumerator EA_EB0;

The edges are closest at the interior of edge A and vertex 0 of edge B.

enumerator EA_EB1;

The edges are closest at the interior of edge A and vertex 1 of edge B.

enumerator EA0_EB;

The edges are closest at vertex 0 of edge A and the interior of edge B.

enumerator EA1_EB;

The edges are closest at vertex 1 of edge A and the interior of edge B.

enumerator EA_EB;

The edges are closest at an interior point of edge A and B.

enumerator AUTO;

Automatically determine the closest pair.

enum class ipc::PointTriangleDistanceType : uint8_t;

Closest pair between a point and triangle.

Values:

enumerator P_T0;

The point is closest to triangle vertex zero.

enumerator P_T1;

The point is closest to triangle vertex one.

enumerator P_T2;

The point is closest to triangle vertex two.

enumerator P_E0;

The point is closest to triangle edge zero (vertex zero to one).

enumerator P_E1;

The point is closest to triangle edge one (vertex one to two).

enumerator P_E2;

The point is closest to triangle edge two (vertex two to zero).

enumerator P_T;

The point is closest to the interior of the triangle.

enumerator AUTO;

Automatically determine the closest pair.

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline PointEdgeDistanceType ipc::point_edge_distance_type(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1);

Determine the closest pair between a point and edge.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge.

Returns:

The distance type of the point-edge pair.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1,
    std::enable_if_t<std::is_class_v<DerivedEA0>, int> = 0>
inline EdgeEdgeDistanceType ipc::edge_edge_distance_type(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);

Determine the closest pair between two edges.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

Returns:

The distance type of the edge-edge pair.

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2,
    std::enable_if_t<std::is_class_v<DerivedP>, int> = 0>
inline PointTriangleDistanceType ipc::point_triangle_distance_type(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2);

Determine the closest pair between a point and triangle.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

Returns:

The distance type of the point-triangle pair.

Edge-Edge Mollifier

template <typename DerivedEA0Rest, typename DerivedEA1Rest,
    typename DerivedEB0Rest, typename DerivedEB1Rest>
inline auto ipc::edge_edge_mollifier_threshold(
    
const Eigen::MatrixBase<DerivedEA0Rest>& ea0_rest,
    
const Eigen::MatrixBase<DerivedEA1Rest>& ea1_rest,
    
const Eigen::MatrixBase<DerivedEB0Rest>& eb0_rest,
    
const Eigen::MatrixBase<DerivedEB1Rest>& eb1_rest);

Compute the threshold of the mollifier edge-edge distance.

This values is computed based on the edges at rest length.

Parameters:
const Eigen::MatrixBase<DerivedEA0Rest> &ea0_rest

The rest position of the first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1Rest> &ea1_rest

The rest position of the second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0Rest> &eb0_rest

The rest position of the first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1Rest> &eb1_rest

The rest position of the second vertex of the second edge.

Returns:

Threshold for edge-edge mollification.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_cross_squarednorm(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);

Compute the squared norm of the edge-edge cross product.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

Returns:

The squared norm of the edge-edge cross product.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_cross_squarednorm_gradient(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);

Compute the gradient of the squared norm of the edge cross product.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

Returns:

The gradient of the squared norm of the edge cross product wrt ea0, ea1, eb0, and eb1.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_cross_squarednorm_hessian(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);

Compute the hessian of the squared norm of the edge cross product.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

Returns:

The hessian of the squared norm of the edge cross product wrt ea0, ea1, eb0, and eb1.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_mollifier(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1,
    
const typename DerivedEA0::Scalar eps_x);

Compute a mollifier for the edge-edge distance.

This helps smooth the non-smoothness at close to parallel edges.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

const typename DerivedEA0::Scalar eps_x

Mollifier activation threshold.

Returns:

The mollifier coefficient to premultiply the edge-edge distance.

template <typename T>
inline T ipc::edge_edge_mollifier(const T xconst T eps_x);

Mollifier function for edge-edge distance.

Parameters:
const T x

Squared norm of the edge-edge cross product.

const T eps_x

Mollifier activation threshold.

Returns:

The mollifier coefficient to premultiply the edge-edge distance.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_mollifier_gradient(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1,
    
const typename DerivedEA0::Scalar eps_x);

Compute the gradient of the mollifier for the edge-edge distance.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

const typename DerivedEA0::Scalar eps_x

Mollifier activation threshold.

Returns:

The gradient of the mollifier.

template <typename T>
inline T ipc::edge_edge_mollifier_gradient(
    
const T xconst T eps_x);

The gradient of the mollifier function for edge-edge distance.

Parameters:
const T x

Squared norm of the edge-edge cross product.

const T eps_x

Mollifier activation threshold.

Returns:

The gradient of the mollifier function for edge-edge distance wrt x.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_mollifier_hessian(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1,
    
const typename DerivedEA0::Scalar eps_x);

Compute the hessian of the mollifier for the edge-edge distance.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

const typename DerivedEA0::Scalar eps_x

Mollifier activation threshold.

Returns:

The hessian of the mollifier.

template <typename T>
inline T ipc::edge_edge_mollifier_hessian(const T xconst T eps_x);

The hessian of the mollifier function for edge-edge distance.

Parameters:
const T x

Squared norm of the edge-edge cross product.

const T eps_x

Mollifier activation threshold.

Returns:

The hessian of the mollifier function for edge-edge distance wrt x.

Edge-Edge

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_distance(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1,
    
EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);

Compute the distance between two lines segments in 3D.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

The distance between the two edges.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_distance_gradient(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1,
    
EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);

Compute the gradient of the distance between a two lines segments.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

The gradient of the distance wrt ea0, ea1, eb0, and eb1.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::edge_edge_distance_hessian(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1,
    
EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);

Compute the hessian of the distance between a two lines segments.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the first edge.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the first edge.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the second edge.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the second edge.

EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

The hessian of the distance wrt ea0, ea1, eb0, and eb1.

Line-Line

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::line_line_distance(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);

Compute the distance between a two infinite lines in 3D.

Note

The distance is actually squared distance.

Warning

If the lines are parallel this function returns a distance of zero.

Parameters:
const Eigen::MatrixBase<DerivedEA0> &ea0

The first vertex of the edge defining the first line.

const Eigen::MatrixBase<DerivedEA1> &ea1

The second vertex of the edge defining the first line.

const Eigen::MatrixBase<DerivedEB0> &eb0

The first vertex of the edge defining the second line.

const Eigen::MatrixBase<DerivedEB1> &eb1

The second vertex of the edge defining the second line.

Returns:

The distance between the two lines.

template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::line_line_distance_gradient(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);
template <typename DerivedEA0, typename DerivedEA1,
    typename DerivedEB0, typename DerivedEB1>
inline auto ipc::line_line_distance_hessian(
    
const Eigen::MatrixBase<DerivedEA0>& ea0,
    
const Eigen::MatrixBase<DerivedEA1>& ea1,
    
const Eigen::MatrixBase<DerivedEB0>& eb0,
    
const Eigen::MatrixBase<DerivedEB1>& eb1);

Point-Edge

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline auto ipc::point_edge_distance(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1,
    
PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO);

Compute the distance between a point and edge in 2D or 3D.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge.

PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

The distance between the point and edge.

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline auto ipc::point_edge_distance_gradient(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1,
    
PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO);

Compute the gradient of the distance between a point and edge.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge.

PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

The gradient of the distance wrt p, e0, and e1.

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline auto ipc::point_edge_distance_hessian(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1,
    
PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO);

Compute the hessian of the distance between a point and edge.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge.

PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

The hessian of the distance wrt p, e0, and e1.

Point-Line

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline auto ipc::point_line_distance(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1);

Compute the distance between a point and line in 2D or 3D.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge defining the line.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge defining the line.

Returns:

The distance between the point and line.

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline auto ipc::point_line_distance_gradient(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1);

Compute the gradient of the distance between a point and line.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge defining the line.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge defining the line.

Returns:

The gradient of the distance wrt p, e0, and e1.

template <typename DerivedP, typename DerivedE0, typename DerivedE1>
inline auto ipc::point_line_distance_hessian(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedE0>& e0,
    
const Eigen::MatrixBase<DerivedE1>& e1);

Compute the hessian of the distance between a point and line.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedE0> &e0

The first vertex of the edge defining the line.

const Eigen::MatrixBase<DerivedE1> &e1

The second vertex of the edge defining the line.

Returns:

The hessian of the distance wrt p, e0, and e1.

Point-Plane

template <typename DerivedP, typename DerivedOrigin,
    typename DerivedNormal>
inline auto ipc::point_plane_distance(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedOrigin>& origin,
    
const Eigen::MatrixBase<DerivedNormal>& normal);

Compute the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedOrigin> &origin

The origin of the plane.

const Eigen::MatrixBase<DerivedNormal> &normal

The normal of the plane.

Returns:

The distance between the point and plane.

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2>
inline auto ipc::point_plane_distance(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2);

Compute the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

Returns:

The distance between the point and plane.

template <typename DerivedP, typename DerivedOrigin,
    typename DerivedNormal>
inline auto ipc::point_plane_distance_gradient(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedOrigin>& origin,
    
const Eigen::MatrixBase<DerivedNormal>& normal);

Compute the gradient of the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedOrigin> &origin

The origin of the plane.

const Eigen::MatrixBase<DerivedNormal> &normal

The normal of the plane.

Returns:

The gradient of the distance wrt p.

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2>
inline auto ipc::point_plane_distance_gradient(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2);

Compute the gradient of the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

Returns:

The gradient of the distance wrt p, t0, t1, and t2.

template <typename DerivedP, typename DerivedOrigin,
    typename DerivedNormal>
inline auto ipc::point_plane_distance_hessian(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedOrigin>& origin,
    
const Eigen::MatrixBase<DerivedNormal>& normal);

Compute the hessian of the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedOrigin> &origin

The origin of the plane.

const Eigen::MatrixBase<DerivedNormal> &normal

The normal of the plane.

Returns:

The hessian of the distance wrt p.

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2>
inline auto ipc::point_plane_distance_hessian(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2);

Compute the hessian of the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

Returns:

The hessian of the distance wrt p, t0, t1, and t2.

Point-Point

template <typename DerivedP0, typename DerivedP1>
inline auto ipc::point_point_distance(
    
const Eigen::MatrixBase<DerivedP0>& p0,
    
const Eigen::MatrixBase<DerivedP1>& p1);

Compute the distance between two points.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP0> &p0

The first point.

const Eigen::MatrixBase<DerivedP1> &p1

The second point.

Returns:

The distance between p0 and p1.

template <typename DerivedP0, typename DerivedP1>
inline auto ipc::point_point_distance_gradient(
    
const Eigen::MatrixBase<DerivedP0>& p0,
    
const Eigen::MatrixBase<DerivedP1>& p1);

Compute the gradient of the distance between two points.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP0> &p0

The first point.

const Eigen::MatrixBase<DerivedP1> &p1

The second point.

Returns:

The computed gradient.

template <typename DerivedP0, typename DerivedP1>
inline auto ipc::point_point_distance_hessian(
    
const Eigen::MatrixBase<DerivedP0>& p0,
    
const Eigen::MatrixBase<DerivedP1>& p1);

Compute the hessian of the distance between two points.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP0> &p0

The first point.

const Eigen::MatrixBase<DerivedP1> &p1

The second point.

Returns:

The computed hessian.

Point-Triangle

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2>
inline auto ipc::point_triangle_distance(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2,
    
PointTriangleDistanceType dtype
    
= PointTriangleDistanceType::AUTO
);

Compute the distance between a points and a triangle.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

PointTriangleDistanceType dtype = PointTriangleDistanceType::AUTO

The point-triangle distance type to compute.

Returns:

The distance between the point and triangle.

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2>
inline auto ipc::point_triangle_distance_gradient(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2,
    
PointTriangleDistanceType dtype
    
= PointTriangleDistanceType::AUTO
);

Compute the gradient of the distance between a points and a triangle.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

PointTriangleDistanceType dtype = PointTriangleDistanceType::AUTO

The point-triangle distance type to compute.

Returns:

The gradient of the distance wrt p, t0, t1, and t2.

template <typename DerivedP, typename DerivedT0, typename DerivedT1,
    typename DerivedT2>
inline auto ipc::point_triangle_distance_hessian(
    
const Eigen::MatrixBase<DerivedP>& p,
    
const Eigen::MatrixBase<DerivedT0>& t0,
    
const Eigen::MatrixBase<DerivedT1>& t1,
    
const Eigen::MatrixBase<DerivedT2>& t2,
    
PointTriangleDistanceType dtype
    
= PointTriangleDistanceType::AUTO
);

Compute the hessian of the distance between a points and a triangle.

Note

The distance is actually squared distance.

Parameters:
const Eigen::MatrixBase<DerivedP> &p

The point.

const Eigen::MatrixBase<DerivedT0> &t0

The first vertex of the triangle.

const Eigen::MatrixBase<DerivedT1> &t1

The second vertex of the triangle.

const Eigen::MatrixBase<DerivedT2> &t2

The third vertex of the triangle.

PointTriangleDistanceType dtype = PointTriangleDistanceType::AUTO

The point-triangle distance type to compute.

Returns:

The hessian of the distance wrt p, t0, t1, and t2.