The body's radius used (0: none known).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ShadowCones), | intent(in) | :: | self |
function new_shadow_cones(name, body, light, body_radius, light_radius) result(s) character(len=*), intent(in) :: name !! the frame's name class(ReferenceFrame), intent(in), target, optional :: body, light !! the body casting the shadow, the light (not owned) real(wp), intent(in), optional :: body_radius, light_radius !! scene units (default: the frames' own) type(ShadowCones) :: s s%ReferenceFrame = ReferenceFrame(name) call s%show_axes(NO_AXES) call s%show_axes_labels(NO_AXES) call s%show_name_label(.false.) if (present(body)) s%body_ => body if (present(light)) s%light_ => light if (present(body_radius)) call s%set_body_radius(body_radius) if (present(light_radius)) call s%set_light_radius(light_radius) s%region(umbra)%color = [0.95_wp, 0.25_wp, 0.2_wp, 0.25_wp] s%region(penumbra)%color = [0.95_wp, 0.75_wp, 0.25_wp, 0.08_wp] s%region(antumbra)%color = [0.35_wp, 0.5_wp, 1.0_wp, 0.25_wp] end function new_shadow_cones !> The body casting the shadow (it must stay alive while set), and its !> radius (optional: see set_body_radius). subroutine set_body(self, body, radius) class(ShadowCones), intent(inout) :: self class(ReferenceFrame), intent(in), target :: body !! the body casting the shadow (not owned) real(wp), intent(in), optional :: radius !! scene units (see set_body_radius) self%body_ => body if (present(radius)) call self%set_body_radius(radius) end subroutine set_body !> The body casting the shadow (null if not set). function body(self) result(p) class(ShadowCones), intent(in) :: self class(ReferenceFrame), pointer :: p p => self%body_ end function body !> The light (e.g. the Sun; it must stay alive while set), and its radius !> (optional: see set_light_radius). subroutine set_light(self, light, radius) class(ShadowCones), intent(inout) :: self class(ReferenceFrame), intent(in), target :: light !! the light, e.g. the Sun (not owned) real(wp), intent(in), optional :: radius !! scene units (see set_light_radius) self%light_ => light if (present(radius)) call self%set_light_radius(radius) end subroutine set_light !> The light (null if not set). function light(self) result(p) class(ShadowCones), intent(in) :: self class(ReferenceFrame), pointer :: p p => self%light_ end function light !> The body's radius (scene units; 0: the body's own, a Sphere's !> equatorial radius or a TerrainBody's). subroutine set_body_radius(self, radius) class(ShadowCones), intent(inout) :: self real(wp), intent(in) :: radius !! scene units (0: the body's own) self%body_radius_ = max(0.0_wp, radius) end subroutine set_body_radius !> The light's radius (scene units; 0: the light's own, if a Sphere). subroutine set_light_radius(self, radius) class(ShadowCones), intent(inout) :: self real(wp), intent(in) :: radius !! scene units (0: the light's own) self%light_radius_ = max(0.0_wp, radius) end subroutine set_light_radius !> The body's radius used (0: none known). real(wp) function body_radius(self) class(ShadowCones), intent(in) :: self body_radius = self%body_radius_ if (body_radius > 0.0_wp .or. .not. associated(self%body_)) return body_radius = frame_radius(self%body_) end function body_radius