線分 [p0,p1] に対して最初に衝突する三角形要素を探索し、命中情報を返す。
| Type | Intent | Optional | 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 |
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