A sphere around points v (3, n): their box's center, out to the farthest (zero for none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | v(:,:) |
(3, n) points |
||
| real(kind=wp), | intent(out) | :: | center(3) |
the sphere's center and radius |
||
| real(kind=wp), | intent(out) | :: | radius |
the sphere's center and radius |
pure subroutine vertices_sphere(v, center, radius) real(wp), intent(in) :: v(:,:) !! (3, n) points real(wp), intent(out) :: center(3), radius !! the sphere's center and radius integer :: i center = 0.0_wp radius = 0.0_wp if (size(v, 2) == 0) return center = 0.5_wp * (minval(v, dim=2) + maxval(v, dim=2)) do i = 1, size(v, 2) radius = max(radius, norm2(v(:, i) - center)) end do end subroutine vertices_sphere