Barrier

template<typename T>
T ipc::barrier(const T &d, const double dhat)

Function that grows to infinity as x approaches 0 from the right.

\[ b(d) = -(d-\hat{d})^2\ln\left(\frac{d}{\hat{d}}\right) \]

Parameters:
const T &d

The distance.

const double dhat

Activation distance of the barrier.

Returns:

The value of the barrier function at d.

double ipc::barrier_gradient(const double d, const double dhat)

Derivative of the barrier function.

\[ b'(d) = (\hat{d}-d) \left( 2\ln\left( \frac{d}{\hat{d}} \right) - \frac{\hat{d}}{d} + 1\right) \]

Parameters:
const double d

The distance.

const double dhat

Activation distance of the barrier.

Returns:

The derivative of the barrier wrt d.

double ipc::barrier_hessian(const double d, const double dhat)

Second derivative of the barrier function.

\[ b''(d) = \left( \frac{\hat{d}}{d} + 2 \right) \frac{\hat{d}}{d} - 2\ln\left( \frac{d}{\hat{d}} \right) - 3 \]

Parameters:
const double d

The distance.

const double dhat

Activation distance of the barrier.

Returns:

The second derivative of the barrier wrt d.


Last update: January 26, 2023