通常メッシュに対する最初の命中要素探索を行う。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(in) | :: | mesh | |||
| real(kind=dp), | intent(in) | :: | p0(3) | |||
| real(kind=dp), | intent(in) | :: | p1(3) | |||
| type(hit_info), | intent(out) | :: | hit | |||
| 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 | ||
| integer(kind=i32), | intent(out), | optional | :: | status |
subroutine find_first_hit_base(mesh, p0, p1, hit, box_min, box_max, require_elem_inside, status) type(mesh_type), intent(in) :: mesh real(dp), intent(in) :: p0(3), p1(3) type(hit_info), intent(out) :: hit real(dp), intent(in), optional :: box_min(3), box_max(3) logical, intent(in), optional :: require_elem_inside integer(i32), intent(out), optional :: status real(dp) :: d(3), seg_min(3), seg_max(3), best_t real(dp) :: box_min_local(3), box_max_local(3), box_tol logical :: use_box_filter, require_inside_elem integer(i32) :: query_status call initialize_hit(hit) query_status = collision_query_ok d = p1 - p0 seg_min = min(p0, p1) seg_max = max(p0, p1) best_t = huge(1.0d0) call resolve_box_filter_args( & box_min, box_max, require_elem_inside, use_box_filter, box_min_local, box_max_local, box_tol, require_inside_elem & ) if (mesh%use_collision_grid) then call find_first_hit_base_grid( & mesh, p0, p1, d, seg_min, seg_max, hit, best_t, & use_box_filter, box_min_local, box_max_local, box_tol, require_inside_elem, query_status & ) else call find_first_hit_base_linear( & mesh, p0, p1, seg_min, seg_max, hit, best_t, & use_box_filter, box_min_local, box_max_local, box_tol, require_inside_elem & ) end if call finalize_collision_query(query_status, status) end subroutine find_first_hit_base