pNeuma_simulator.contact_distance.contact_distance module

pNeuma_simulator.contact_distance.contact_distance.calc_dtc(l_j: float, w_j: float, l_i: float, w_i: float, x_j: float, y_j: float, x_i: float, y_i: float, theta_j: float, theta_i: float) float[source]

Calculates the distance to closest approach (DTC) between two objects.

Parameters:
  • l_j (float) – Length of object j.

  • w_j (float) – Width of object j.

  • l_i (float) – Length of object i.

  • w_i (float) – Width of object i.

  • x_j (float) – x-coordinate of object j.

  • y_j (float) – y-coordinate of object j.

  • x_i (float) – x-coordinate of object i.

  • y_i (float) – y-coordinate of object i.

  • theta_j (float) – Orientation angle of object j.

  • theta_i (float) – Orientation angle of object i.

Returns:

The distance to closest approach (DTC) between the two objects.

Return type:

float

pNeuma_simulator.contact_distance.contact_distance.ellipses(a1: float, b1: float, a2: float, b2: float, x1: float, y1: float, x2: float, y2: float, theta1: float, theta2: float) float[source]

Subroutine to calculate the distance of closest approach of two ellipses

Original code written in Fortran90: https://www.math.kent.edu/~zheng/ellipse.html https://www.math.kent.edu/~zheng/ellipses.f90

This is my Pythonic implementation powered by JIT.

Parameters:
  • a1 (float) – length of major semiaxis of first ellipse

  • b1 (float) – length of minor semiaxis of first ellipse

  • a2 (float) – length of major semiaxis of second ellipse

  • b2 (float) – length of minor semiaxis of second ellipse

  • x1 (float) – x coordinate of the center of the first ellipse

  • y1 (float) – y coordinate of the center of the first ellipse

  • x2 (float) – x coordinate of the center of the second ellipse

  • y2 (float) – y coordinate of the center of the second ellipse

  • theta1 (float) – angle associated with the major axis of first ellipse

  • theta2 (float) – angle associated with the major axis of second ellipse

Returns:

distance between the centers when two ellipses are externally tangent

Return type:

float