The drawn regions' bounding sphere (frame coordinates).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ShadowCones), | intent(in) | :: | self | |||
| real(kind=wp), | intent(out) | :: | center(3) |
the bounding sphere, frame coordinates (scene units) |
||
| real(kind=wp), | intent(out) | :: | radius |
the bounding sphere, frame coordinates (scene units) |
subroutine shadow_bound(self, center, radius) class(ShadowCones), intent(in) :: self real(wp), intent(out) :: center(3), radius !! the bounding sphere, frame coordinates (scene units) real(wp) :: lo, hi, r integer :: k center = 0.0_wp radius = 0.0_wp lo = huge(1.0_wp) hi = -huge(1.0_wp) r = 0.0_wp do k = 1, n_regions if (.not. self%region(k)%drawn) cycle lo = min(lo, self%region(k)%z0) hi = max(hi, self%region(k)%z1) r = max(r, self%region(k)%r0, self%region(k)%r1) end do if (hi < lo) return center(3) = 0.5_wp * (lo + hi) radius = hypot(0.5_wp * (hi - lo), r) end subroutine shadow_bound