artist.raytracing.geometry ========================== .. py:module:: artist.raytracing.geometry Functions --------- .. autoapisummary:: artist.raytracing.geometry.reflect artist.raytracing.geometry.line_plane_intersections artist.raytracing.geometry.line_cylinder_intersections Module Contents --------------- .. py:function:: reflect(incident_ray_directions: torch.Tensor, reflection_surface_normals: torch.Tensor) -> torch.Tensor Reflect incoming rays given the normals of reflective surfaces. Parameters ---------- incident_ray_directions : torch.Tensor Direction of the incident ray as seen from the heliostats. Shape is ``[number_of_active_heliostats, 1, 4]``. reflection_surface_normals : torch.Tensor Normals of the reflective surfaces. Shape is ``[number_of_active_heliostats, number_of_combined_surface_normals_all_facets, 4]``. Returns ------- torch.Tensor Reflected rays. Shape is ``[number_of_active_heliostats, number_of_combined_surface_normals_all_facets, 4]``. .. py:function:: line_plane_intersections(rays: artist.scene.rays.Rays, points_at_ray_origins: torch.Tensor, target_areas: artist.field.tower_target_areas_planar.TowerTargetAreasPlanar, target_area_indices: torch.Tensor | None = None, bitmap_resolution: torch.Tensor = torch.tensor([256, 256]), device: torch.device | None = None) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] Compute line-plane intersections of the rays (lines) and the target areas (planes). Parameters ---------- rays : Rays Rays with directions and magnitudes, the directions must be normalized. points_at_ray_origins : torch.Tensor Origins of the rays, which coincide with the surface points of the heliostats. Shape is ``[number_of_active_heliostats, number_of_combined_surface_points_all_facets, 4]``. target_areas : TowerTargetAreas All planar tower target areas. target_area_indices : torch.Tensor | None Indices of target areas corresponding to each heliostat (default is None). If none are provided, the first target area of the scenario will be linked to all heliostats. Shape is ``[number_of_active_heliostats]``. bitmap_resolution : torch.Tensor | None Bitmap resolution (default is ``torch.tensor([256,256])``). device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Returns ------- torch.Tensor East components of the bitmap intersections. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. torch.Tensor Up components of the bitmap intersections. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. torch.Tensor Intersection distances. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. torch.Tensor Absolute intensities of the rays hitting the target planes. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. .. py:function:: line_cylinder_intersections(rays: artist.scene.rays.Rays, points_at_ray_origins: torch.Tensor, target_areas: artist.field.tower_target_areas_cylindrical.TowerTargetAreasCylindrical, target_area_indices: torch.Tensor | None = None, bitmap_resolution: torch.Tensor = torch.tensor([256, 256]), device: torch.device | None = None) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] Compute ray intersections with cylindrical receiver target areas and map hits into bitmap coordinates. This routine transforms rays from world space into each target cylinder's local frame, computes intersections with the infinite cylinder side surface, filters intersections to the finite cylinder sector (height + opening angle), and returns per-ray bitmap coordinates, intersection distances, and Lambert-weighted intensities. Pipeline: 1. Select target area per heliostat (or default to index 0). 2. Build local cylinder frame and transform ray origins/directions into that frame. 3. Solve quadratic for intersections with the infinite cylinder (x^2 + y^2 = r^2). 4. Select the smallest strictly positive intersection distance per ray. 5. Compute local intersection points, surface normals, and cosine-based intensity factor. 6. Filter to finite cylinder patch bounds: - height range [0, h] - angle range [0, opening_angle] 7. Convert valid local coordinates to continuous bitmap coordinates. Parameters ---------- rays : Rays Rays with directions and magnitudes, the directions must be normalized. points_at_ray_origins : torch.Tensor Ray origins in world space. Shape is ``[number_of_active_heliostats, number_of_combined_surface_points_all_facets, 4]``. target_areas : TowerTargetAreasCylindrical Cylindrical receiver definitions (centers, axes, normals, radii, heights, opening angles). target_area_indices : torch.Tensor | None Indices of target areas corresponding to each heliostat (default is None). If none are provided, the first target area of the scenario will be linked to all heliostats. Shape is ``[number_of_active_heliostats]``. bitmap_resolution : torch.Tensor Bitmap resolution (default is ``torch.tensor([256,256])``). device : torch.device | None The device on which to perform computations or load tensors and models (default is None). If None, ``ARTIST`` will automatically select the most appropriate device (CUDA or CPU) based on availability and OS. Returns ------- torch.Tensor Continuous E (horizontal/unwrapped-angle) bitmap coordinates in pixel units. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. Invalid rays are 0. torch.Tensor Continuous U (vertical/height) bitmap coordinates in pixel units. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. Invalid rays are 0. torch.Tensor Ray parameter distance t to the selected cylinder intersection. Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. Invalid rays are 0. torch.Tensor Lambert-weighted hit intensities: ray_magnitudes * max(0, -dot(ray_dir_local, normal_local)). Shape is ``[number_of_active_heliostats, number_of_rays, number_of_combined_surface_points_all_facets]``. Invalid rays are 0.