The segments' bounding sphere (frame coordinates).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(CustomLineSegments), | 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 segments_bound(self, center, radius) class(CustomLineSegments), intent(in) :: self real(wp), intent(out) :: center(3), radius !! the bounding sphere, frame coordinates (scene units) real(wp) :: lo(3), hi(3) center = 0.0_wp radius = 0.0_wp if (self%n == 0) return lo = min(minval(self%a, dim=2), minval(self%b, dim=2)) hi = max(maxval(self%a, dim=2), maxval(self%b, dim=2)) center = 0.5_wp * (lo + hi) radius = 0.5_wp * norm2(hi - lo) end subroutine segments_bound