pyRTX.core.physical_utils

Functions

compute_srp(flux, mesh_obj, index_tri, ...)

Computes the total solar radiation pressure force on a spacecraft.

preprocess_RTX_geometry(mesh_obj)

Preprocesses the geometry of a mesh object for ray-tracing.

preprocess_materials(material_dict)

Preprocesses a dictionary of material properties into a numpy array.

srp_core(flux, indexes_tri, indexes_ray, N, ...)

Core computation of the solar radiation pressure force (vectorized).

pyRTX.core.physical_utils.preprocess_RTX_geometry(mesh_obj)[source]

Preprocesses the geometry of a mesh object for ray-tracing.

Parameters:

mesh_obj (trimesh.Trimesh) – The mesh object to preprocess.

Returns:

A tuple containing the vertices, faces, face normals, and face areas of the mesh.

Return type:

tuple

pyRTX.core.physical_utils.preprocess_materials(material_dict)[source]

Preprocesses a dictionary of material properties into a numpy array.

Parameters:

material_dict (dict) –

A dictionary with the following structure:

{
    'props': {
        'material_name_1': {'specular': float, 'diffuse': float},
        ...
    },
    'idxs': [
        [start_idx_1, end_idx_1],
        ...
    ]
}

Returns:

A (N, 2) numpy array where N is the number of faces in the mesh. Each row contains the [specular, diffuse] coefficients for the corresponding face.

Return type:

numpy.ndarray

pyRTX.core.physical_utils.srp_core(flux, indexes_tri, indexes_ray, N, S, norm_factor, mesh_obj, materials='None', diffusion=False, num_diffuse=None, diffusion_pack=None)[source]

Core computation of the solar radiation pressure force (vectorized).

Parameters:
  • flux (float) – The incident solar flux in W/m^2.

  • indexes_tri (numpy.ndarray) – The indices of the intersected triangles.

  • indexes_ray (numpy.ndarray) – The indices of the intersecting rays.

  • N (numpy.ndarray) – The normal vectors of the mesh faces.

  • S (numpy.ndarray) – The incident ray direction vectors.

  • norm_factor (float) – The normalization factor computed from ray spacing.

  • mesh_obj (trimesh.Trimesh) – The trimesh object representing the spacecraft.

  • materials (str or numpy.ndarray, default 'None') – A (N, 2) numpy array of material properties for each face.

  • diffusion (bool, default False) – If True, computes diffuse reflection forces.

  • num_diffuse (int, optional) – The number of diffuse rays to sample per intersection.

  • diffusion_pack (list, optional) – A list containing data from the diffusion ray-tracing pass.

Returns:

A tuple containing the SRP force vector and the new flux for the next bounce.

Return type:

tuple

pyRTX.core.physical_utils.compute_srp(flux, mesh_obj, index_tri, index_ray, location, ray_origins, ray_directions, pixel_spacing, materials='None', grouped=True, diffusion=False, num_diffuse=None, diffusion_pack=None)[source]

Computes the total solar radiation pressure force on a spacecraft.

Parameters:
  • flux (float) – The incident solar flux in W/m^2.

  • mesh_obj (trimesh.Trimesh) – The spacecraft’s mesh model.

  • index_tri (list of numpy.ndarray) – A list of arrays of intersected triangle indices for each bounce.

  • index_ray (list of numpy.ndarray) – A list of arrays of intersecting ray indices for each bounce.

  • location (list of numpy.ndarray) – A list of arrays of intersection locations for each bounce.

  • ray_origins (list of numpy.ndarray) – A list of arrays of ray origins for each bounce.

  • ray_directions (list of numpy.ndarray) – A list of arrays of ray directions for each bounce.

  • pixel_spacing (float) – The spacing between rays, used for normalization.

  • materials (str or numpy.ndarray, default 'None') – A (N, 2) numpy array of material properties for each face.

  • grouped (bool, default True) – If True, returns the total force vector.

  • diffusion (bool, default False) – If True, computes diffuse reflection forces.

  • num_diffuse (int, optional) – The number of diffuse rays to sample per intersection.

  • diffusion_pack (list, optional) – A list containing data from the diffusion ray-tracing pass.

Returns:

The total SRP force vector, or a list of per-face forces if grouped is False.

Return type:

numpy.ndarray or list