PolyhedronGravityCore#
- class PolyhedronGravityCore(vertices: ndarray, faces: ndarray, density: float, gravitational_constant: float)#
Bases:
objectExterior gravity of a constant-density polyhedron.
Computational core of
PolyhedralGravity: the closed-form surface and line integrals of Werner & Scheeres [1], one solid-angle term per triangular facet and one line term per edge. The facet and edge dyads and the mesh topology are built once at construction; only the solid angles and edge factors depend on the field point.Exact everywhere outside the body — there is no truncation degree — and the summed solid angle is
0outside and4*piinside, which doubles as a containment test.With \(G\rho\) the gravitational constant times the density, \(\mathbf{r}_e\) and \(\mathbf{r}_f\) vectors from the field point to any point of edge \(e\) and facet \(f\), the potential and its derivatives are [1]
\[\begin{split}U &= \frac{G\rho}{2} \sum_{e} \mathbf{r}_e^T \mathbf{E}_e \mathbf{r}_e\, L_e - \frac{G\rho}{2} \sum_{f} \mathbf{r}_f^T \mathbf{F}_f \mathbf{r}_f\, \omega_f, \\ \nabla U &= -G\rho \sum_{e} \mathbf{E}_e \mathbf{r}_e\, L_e + G\rho \sum_{f} \mathbf{F}_f \mathbf{r}_f\, \omega_f, \\ \nabla\nabla U &= G\rho \sum_{e} \mathbf{E}_e\, L_e - G\rho \sum_{f} \mathbf{F}_f\, \omega_f, \qquad \nabla^2 U = -G\rho \sum_{f} \omega_f.\end{split}\]The dyads are \(\mathbf{F}_f = \hat{\mathbf{n}}_f \hat{\mathbf{n}}_f^T\) and \(\mathbf{E}_e = \hat{\mathbf{n}}_A \hat{\mathbf{n}}_{A,12}^T + \hat{\mathbf{n}}_B \hat{\mathbf{n}}_{B,21}^T\), where \(A\) and \(B\) are the two facets sharing the edge and \(\hat{\mathbf{n}}_{A,12}\) is the edge’s outward normal in the plane of \(A\). The edge factor uses the distances \(a, b\) from the field point to the edge’s ends and its length \(e\), and the solid angle of a facet with corners \(\mathbf{r}_1, \mathbf{r}_2, \mathbf{r}_3\) (relative to the field point, \(R_i = |\mathbf{r}_i|\)) follows Van Oosterom & Strackee [2]:
\[\begin{split}L_e &= \ln\frac{a + b + e}{a + b - e}, \\ \omega_f &= 2 \arctan \frac{\mathbf{r}_1 \cdot (\mathbf{r}_2 \times \mathbf{r}_3)} {R_1 R_2 R_3 + (\mathbf{r}_1 \cdot \mathbf{r}_2) R_3 + (\mathbf{r}_1 \cdot \mathbf{r}_3) R_2 + (\mathbf{r}_2 \cdot \mathbf{r}_3) R_1},\end{split}\]with the two-argument arctangent.
- Parameters:
- verticesnp.ndarray
(N, 3) vertex coordinates in the body-fixed frame, km.
- facesnp.ndarray
(M, 3) zero-based vertex indices, one row per triangular facet, wound counter-clockwise seen from outside.
- densityfloat
Bulk density, kg/km^3.
- gravitational_constantfloat
Gravitational constant in km^3 kg^-1 s^-2. Supplied by the caller so the value tracks
scarabaeus.Constants.G.
Methods
Centre of mass in the mesh's own frame, km.
compute(position)(U, grad_U, grad2_U, laplacian, omega)at one body-fixed point.compute_acceleration(position)Gravitational acceleration at one point, km/s^2.
compute_acceleration_batch(positions)Accelerations for (N, 3) field points, flattened row-major.
compute_jacobian(position)Gravity-gradient matrix at one point, 1/s^2, flattened row-major.
compute_potential(position)Gravitational potential at one point, km^2/s^2.
contains(position)Whether the field point lies inside the body.
Outward unit normal of each facet, flattened row-major (M x 3).
facet_solid_angles(position)Signed solid angle each facet subtends at the field point.
mass()Total mass in kg,
density * volume.solid_angle(position)Summed signed solid angle: 0 outside the body, 4*pi inside.
volume()Enclosed volume in km^3; negative when the facets are wound inwards.
References
[1] (1,2)R. A. Werner and D. J. Scheeres, “Exterior gravitation of a polyhedron derived and compared with harmonic and mascon gravitation representations of asteroid 4769 Castalia,” Celestial Mechanics and Dynamical Astronomy, vol. 65, no. 3, pp. 313-344, 1997.
[2]A. Van Oosterom and J. Strackee, “The solid angle of a plane triangle,” IEEE Transactions on Biomedical Engineering, vol. BME-30, no. 2, pp. 125-126, 1983.
- center_of_mass() List[float]#
Centre of mass in the mesh’s own frame, km.
Volume-weighted centroid of the tetrahedra formed by each facet with the origin. A mesh whose centroid is not at the origin carries a dipole term.
- compute(position: ndarray) tuple#
(U, grad_U, grad2_U, laplacian, omega)at one body-fixed point.Units are km^2/s^2, km/s^2 (3), 1/s^2 (9, row-major), 1/s^2, and steradians.
- compute_acceleration(position: ndarray) List[float]#
Gravitational acceleration at one point, km/s^2.
- compute_acceleration_batch(positions: ndarray) List[float]#
Accelerations for (N, 3) field points, flattened row-major.
- compute_jacobian(position: ndarray) List[float]#
Gravity-gradient matrix at one point, 1/s^2, flattened row-major.