線分 [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 |
最初に命中した要素インデックス・命中位置・線分パラメータを格納。 |
||
| class(particle_domain_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 | ||
| integer(kind=i32), | intent(out) | :: | status |
照会完了状態。不完全な照会は |
subroutine find_first_hit(mesh, p0, p1, hit, sim, 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 class(particle_domain_config), intent(in), optional :: sim real(dp), intent(in), optional :: box_min(3), box_max(3) logical, intent(in), optional :: require_elem_inside integer(i32), intent(out) :: status logical :: use_periodic2 use_periodic2 = .false. if (any(.not. ieee_is_finite(p0)) .or. any(.not. ieee_is_finite(p1))) then call initialize_hit(hit) status = collision_query_invalid_segment return end if ! periodic2 の周期軸と周期長は prepare_periodic2_collision_mesh が mesh に解決済み。query ごとに解き直さない。 if (present(sim)) use_periodic2 = trim(sim%field_bc_mode) == 'periodic2' if (use_periodic2) then call find_first_hit_periodic2( & mesh, p0, p1, hit, sim, box_min, box_max, require_elem_inside, status & ) else call find_first_hit_base(mesh, p0, p1, hit, box_min, box_max, require_elem_inside, status) end if end subroutine find_first_hit