find_first_hit Subroutine

public subroutine find_first_hit(mesh, p0, p1, hit, sim, box_min, box_max, require_elem_inside)

線分 [p0,p1] に対して最初に衝突する三角形要素を探索し、命中情報を返す。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(in) :: mesh

三角形要素とAABB情報を保持した衝突判定対象メッシュ。

real(kind=dp), intent(in) :: p0(3)
real(kind=dp), intent(in) :: p1(3)
type(hit_info), intent(out) :: hit

最初に命中した要素インデックス・命中位置・線分パラメータを格納。

type(sim_config), intent(in), optional :: sim
real(kind=dp), intent(in), optional :: box_min(3)
real(kind=dp), intent(in), optional :: box_max(3)
logical, intent(in), optional :: require_elem_inside

Calls

proc~~find_first_hit~~CallsGraph proc~find_first_hit find_first_hit proc~find_first_hit_base find_first_hit_base proc~find_first_hit->proc~find_first_hit_base proc~find_first_hit_periodic2 find_first_hit_periodic2 proc~find_first_hit->proc~find_first_hit_periodic2 proc~resolve_periodic2_collision_config resolve_periodic2_collision_config proc~find_first_hit->proc~resolve_periodic2_collision_config proc~find_first_hit_base_grid find_first_hit_base_grid proc~find_first_hit_base->proc~find_first_hit_base_grid proc~find_first_hit_base_linear find_first_hit_base_linear proc~find_first_hit_base->proc~find_first_hit_base_linear proc~initialize_hit initialize_hit proc~find_first_hit_base->proc~initialize_hit proc~resolve_box_filter_args resolve_box_filter_args proc~find_first_hit_base->proc~resolve_box_filter_args proc~find_first_hit_periodic2->proc~find_first_hit_base proc~find_first_hit_periodic2->proc~resolve_periodic2_collision_config proc~compute_periodic_shift_bounds compute_periodic_shift_bounds proc~find_first_hit_periodic2->proc~compute_periodic_shift_bounds proc~find_first_hit_periodic2->proc~initialize_hit proc~point_inside_box_periodic2 point_inside_box_periodic2 proc~find_first_hit_periodic2->proc~point_inside_box_periodic2 proc~prefer_periodic_candidate prefer_periodic_candidate proc~find_first_hit_periodic2->proc~prefer_periodic_candidate proc~find_first_hit_periodic2->proc~resolve_box_filter_args proc~wrap_periodic2_point wrap_periodic2_point proc~find_first_hit_periodic2->proc~wrap_periodic2_point proc~lower_ascii lower_ascii proc~resolve_periodic2_collision_config->proc~lower_ascii proc~bbox_inside_box bbox_inside_box proc~find_first_hit_base_grid->proc~bbox_inside_box proc~cell_id cell_id proc~find_first_hit_base_grid->proc~cell_id proc~coord_to_cell coord_to_cell proc~find_first_hit_base_grid->proc~coord_to_cell proc~point_inside_box point_inside_box proc~find_first_hit_base_grid->proc~point_inside_box proc~segment_aabb_intersection_t segment_aabb_intersection_t proc~find_first_hit_base_grid->proc~segment_aabb_intersection_t proc~segment_bbox_overlap_precomputed segment_bbox_overlap_precomputed proc~find_first_hit_base_grid->proc~segment_bbox_overlap_precomputed proc~segment_triangle_intersect segment_triangle_intersect proc~find_first_hit_base_grid->proc~segment_triangle_intersect proc~find_first_hit_base_linear->proc~bbox_inside_box proc~find_first_hit_base_linear->proc~point_inside_box proc~find_first_hit_base_linear->proc~segment_bbox_overlap_precomputed proc~find_first_hit_base_linear->proc~segment_triangle_intersect proc~cross cross proc~segment_triangle_intersect->proc~cross

Called by

proc~~find_first_hit~~CalledByGraph proc~find_first_hit find_first_hit proc~sample_photo_raycast_particles sample_photo_raycast_particles proc~sample_photo_raycast_particles->proc~find_first_hit proc~sample_photo_species_state sample_photo_species_state proc~sample_photo_species_state->proc~sample_photo_raycast_particles proc~init_particle_batch_from_config init_particle_batch_from_config proc~init_particle_batch_from_config->proc~sample_photo_species_state

Source Code

  subroutine find_first_hit(mesh, p0, p1, hit, sim, box_min, box_max, require_elem_inside)
    type(mesh_type), intent(in) :: mesh
    real(dp), intent(in) :: p0(3), p1(3)
    type(hit_info), intent(out) :: hit
    type(sim_config), intent(in), optional :: sim
    real(dp), intent(in), optional :: box_min(3), box_max(3)
    logical, intent(in), optional :: require_elem_inside

    logical :: use_periodic2
    integer(i32) :: periodic_axes(2)
    real(dp) :: periodic_len(2)

    use_periodic2 = .false.
    periodic_axes = 0_i32
    periodic_len = 0.0d0
    if (present(sim)) then
      call resolve_periodic2_collision_config(sim, use_periodic2, periodic_axes, periodic_len)
    end if

    if (use_periodic2) then
      call find_first_hit_periodic2(mesh, p0, p1, hit, sim, box_min, box_max, require_elem_inside)
    else
      call find_first_hit_base(mesh, p0, p1, hit, box_min, box_max, require_elem_inside)
    end if
  end subroutine find_first_hit