Distance

Distance Type

enum class ipc::PointEdgeDistanceType;

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;

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;

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.

PointEdgeDistanceType ipc::point_edge_distance_type(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>e1);

Determine the closest pair between a point and edge.

Parameters:
const Eigen::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge.

const Eigen::Ref<const VectorMax3d> &e1

The second vertex of the edge.

Returns:

The distance type of the point-edge pair.

EdgeEdgeDistanceType ipc::edge_edge_distance_type(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1);

Determine the closest pair between two edges.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &eb1

The second vertex of the second edge.

Returns:

The distance type of the edge-edge pair.

PointTriangleDistanceType ipc::point_triangle_distance_type(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>t2);

Determine the closest pair between a point and triangle.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t2

The third vertex of the triangle.

Returns:

The distance type of the point-triangle pair.

Edge-Edge Mollifier

double ipc::edge_edge_mollifier_threshold(
    
const Eigen::Ref<const Eigen::Vector3d>ea0_rest,
    
const Eigen::Ref<const Eigen::Vector3d>ea1_rest,
    
const Eigen::Ref<const Eigen::Vector3d>eb0_rest,
    
const Eigen::Ref<const Eigen::Vector3d>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::Ref<const Eigen::Vector3d> &ea0_rest

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

const Eigen::Ref<const Eigen::Vector3d> &ea1_rest

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

const Eigen::Ref<const Eigen::Vector3d> &eb0_rest

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

const Eigen::Ref<const Eigen::Vector3d> &eb1_rest

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

Returns:

Threshold for edge-edge mollification.

double ipc::edge_edge_cross_squarednorm(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1);

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

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &eb1

The second vertex of the second edge.

Returns:

The squared norm of the edge-edge cross product.

Vector12d ipc::edge_edge_cross_squarednorm_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1);

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

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &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.

Matrix12d ipc::edge_edge_cross_squarednorm_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1);

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

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &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.

double ipc::edge_edge_mollifier(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1,
    
const double eps_x);

Compute a mollifier for the edge-edge distance.

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

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &eb1

The second vertex of the second edge.

const double eps_x

Mollifier activation threshold.

Returns:

The mollifier coefficient to premultiply the edge-edge distance.

double ipc::edge_edge_mollifier(const double xconst double eps_x);

Mollifier function for edge-edge distance.

Parameters:
const double x

Squared norm of the edge-edge cross product.

const double eps_x

Mollifier activation threshold.

Returns:

The mollifier coefficient to premultiply the edge-edge distance.

Vector12d ipc::edge_edge_mollifier_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1,
    
const double eps_x);

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

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &eb1

The second vertex of the second edge.

const double eps_x

Mollifier activation threshold.

Returns:

The gradient of the mollifier.

double ipc::edge_edge_mollifier_gradient(
    
const double xconst double eps_x);

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

Parameters:
const double x

Squared norm of the edge-edge cross product.

const double eps_x

Mollifier activation threshold.

Returns:

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

Matrix12d ipc::edge_edge_mollifier_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1,
    
const double eps_x);

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

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &eb1

The second vertex of the second edge.

const double eps_x

Mollifier activation threshold.

Returns:

The hessian of the mollifier.

double ipc::edge_edge_mollifier_hessian(
    
const double xconst double eps_x);

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

Parameters:
const double x

Squared norm of the edge-edge cross product.

const double eps_x

Mollifier activation threshold.

Returns:

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

Edge-Edge

double ipc::edge_edge_distance(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1,
    
EdgeEdgeDistanceType dtype = EdgeEdgeDistanceType::AUTO);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &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.

Vector12d ipc::edge_edge_distance_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>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::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &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.

Matrix12d ipc::edge_edge_distance_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>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::Ref<const Eigen::Vector3d> &ea0

The first vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the first edge.

const Eigen::Ref<const Eigen::Vector3d> &eb0

The first vertex of the second edge.

const Eigen::Ref<const Eigen::Vector3d> &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

double ipc::line_line_distance(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>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::Ref<const Eigen::Vector3d> &ea0

The first vertex of the edge defining the first line.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the edge defining the first line.

const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the edge defining the second line.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the edge defining the second line.

Returns:

The distance between the two lines.

Vector12d ipc::line_line_distance_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1);

Compute the gradient of the distance between a two 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::Ref<const Eigen::Vector3d> &ea0

The first vertex of the edge defining the first line.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the edge defining the first line.

const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the edge defining the second line.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the edge defining the second line.

Returns:

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

Matrix12d ipc::line_line_distance_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>ea0,
    
const Eigen::Ref<const Eigen::Vector3d>ea1,
    
const Eigen::Ref<const Eigen::Vector3d>eb0,
    
const Eigen::Ref<const Eigen::Vector3d>eb1);

Compute the hessian of the distance between a two 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::Ref<const Eigen::Vector3d> &ea0

The first vertex of the edge defining the first line.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the edge defining the first line.

const Eigen::Ref<const Eigen::Vector3d> &ea0

The first vertex of the edge defining the second line.

const Eigen::Ref<const Eigen::Vector3d> &ea1

The second vertex of the edge defining the second line.

Returns:

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

Point-Edge

double ipc::point_edge_distance(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>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::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge.

const Eigen::Ref<const VectorMax3d> &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.

VectorMax9d ipc::point_edge_distance_gradient(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>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::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge.

const Eigen::Ref<const VectorMax3d> &e1

The second vertex of the edge.

PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

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

MatrixMax9d ipc::point_edge_distance_hessian(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>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::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge.

const Eigen::Ref<const VectorMax3d> &e1

The second vertex of the edge.

PointEdgeDistanceType dtype = PointEdgeDistanceType::AUTO

The point edge distance type to compute.

Returns:

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

Point-Line

double ipc::point_line_distance(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>e1);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge defining the line.

const Eigen::Ref<const VectorMax3d> &e1

The second vertex of the edge defining the line.

Returns:

The distance between the point and line.

VectorMax9d ipc::point_line_distance_gradient(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>e1);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge defining the line.

const Eigen::Ref<const VectorMax3d> &e1

The second vertex of the edge defining the line.

Returns:

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

MatrixMax9d ipc::point_line_distance_hessian(
    
const Eigen::Ref<const VectorMax3d>p,
    
const Eigen::Ref<const VectorMax3d>e0,
    
const Eigen::Ref<const VectorMax3d>e1);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const VectorMax3d> &p

The point.

const Eigen::Ref<const VectorMax3d> &e0

The first vertex of the edge defining the line.

const Eigen::Ref<const VectorMax3d> &e1

The second vertex of the edge defining the line.

Returns:

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

Point-Plane

double ipc::point_plane_distance(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>origin,
    
const Eigen::Ref<const Eigen::Vector3d>normal);

Compute the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &origin

The origin of the plane.

const Eigen::Ref<const Eigen::Vector3d> &normal

The normal of the plane.

Returns:

The distance between the point and plane.

double ipc::point_plane_distance(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>t2);

Compute the distance between a point and a plane.

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t2

The third vertex of the triangle.

Returns:

The distance between the point and plane.

Eigen::Vector3d ipc::point_plane_distance_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>origin,
    
const Eigen::Ref<const Eigen::Vector3d>normal);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &origin

The origin of the plane.

const Eigen::Ref<const Eigen::Vector3d> &normal

The normal of the plane.

Returns:

The gradient of the distance wrt p.

Vector12d ipc::point_plane_distance_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>t2);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t2

The third vertex of the triangle.

Returns:

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

Eigen::Matrix3d ipc::point_plane_distance_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>origin,
    
const Eigen::Ref<const Eigen::Vector3d>normal);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &origin

The origin of the plane.

const Eigen::Ref<const Eigen::Vector3d> &normal

The normal of the plane.

Returns:

The hessian of the distance wrt p.

Matrix12d ipc::point_plane_distance_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>t2);

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

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t2

The third vertex of the triangle.

Returns:

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

Point-Point

double ipc::point_point_distance(
    
const Eigen::Ref<const VectorMax3d>p0,
    
const Eigen::Ref<const VectorMax3d>p1);

Compute the distance between two points.

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const VectorMax3d> &p0

The first point.

const Eigen::Ref<const VectorMax3d> &p1

The second point.

Returns:

The distance between p0 and p1.

VectorMax6d ipc::point_point_distance_gradient(
    
const Eigen::Ref<const VectorMax3d>p0,
    
const Eigen::Ref<const VectorMax3d>p1);

Compute the gradient of the distance between two points.

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const VectorMax3d> &p0

The first point.

const Eigen::Ref<const VectorMax3d> &p1

The second point.

Returns:

The computed gradient.

MatrixMax6d ipc::point_point_distance_hessian(
    
const Eigen::Ref<const VectorMax3d>p0,
    
const Eigen::Ref<const VectorMax3d>p1);

Compute the hessian of the distance between two points.

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const VectorMax3d> &p0

The first point.

const Eigen::Ref<const VectorMax3d> &p1

The second point.

Returns:

The computed hessian.

Point-Triangle

double ipc::point_triangle_distance(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>t2,
    
PointTriangleDistanceType dtype
   
 = PointTriangleDistanceType::AUTO
);

Compute the distance between a points and a triangle.

Note

The distance is actually squared distance.

Parameters:
const Eigen::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &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.

Vector12d ipc::point_triangle_distance_gradient(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>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::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &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.

Matrix12d ipc::point_triangle_distance_hessian(
    
const Eigen::Ref<const Eigen::Vector3d>p,
    
const Eigen::Ref<const Eigen::Vector3d>t0,
    
const Eigen::Ref<const Eigen::Vector3d>t1,
    
const Eigen::Ref<const Eigen::Vector3d>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::Ref<const Eigen::Vector3d> &p

The point.

const Eigen::Ref<const Eigen::Vector3d> &t0

The first vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &t1

The second vertex of the triangle.

const Eigen::Ref<const Eigen::Vector3d> &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.


Last update: Feb 18, 2025