terrain_pick Subroutine

private subroutine terrain_pick(self, cam, to_root, hits, n)

Picked on a sphere of the body's radius (not the terrain's heights), with the latitude and longitude of the point hit; else the frame's origin.

Type Bound

TerrainBody

Arguments

Type IntentOptional Attributes Name
class(TerrainBody), intent(in), target :: self
type(PickCamera), intent(in) :: cam

the cursor's ray and the pick's settings

real(kind=wp), intent(in) :: to_root(4,4)

the frame's transform to the root frame

type(PickHit), intent(inout), allocatable :: hits(:)

hits so far (grown as needed)

integer, intent(inout) :: n

number of hits in hits


Calls

proc~~terrain_pick~~CallsGraph proc~terrain_pick TerrainBody%terrain_pick proc~body_radius~2 TerrainBody%body_radius proc~terrain_pick->proc~body_radius~2 proc~contents_shown ReferenceFrame%contents_shown proc~terrain_pick->proc~contents_shown proc~identity_matrix identity_matrix proc~terrain_pick->proc~identity_matrix proc~pick ReferenceFrame%pick proc~terrain_pick->proc~pick proc~pick_ellipsoid pick_ellipsoid proc~terrain_pick->proc~pick_ellipsoid proc~add_pick_hit add_pick_hit proc~pick->proc~add_pick_hit proc~point_pick point_pick proc~pick->proc~point_pick proc~wants wants proc~pick->proc~wants proc~pick_ellipsoid->proc~add_pick_hit proc~ray ray proc~pick_ellipsoid->proc~ray proc~ray_ellipsoid ray_ellipsoid proc~pick_ellipsoid->proc~ray_ellipsoid proc~pick_ellipsoid->proc~wants proc~project project proc~point_pick->proc~project

Source Code

    subroutine terrain_pick(self, cam, to_root, hits, n)
        class(TerrainBody), intent(in), target :: self
        type(PickCamera), intent(in) :: cam                 !! the cursor's ray and the pick's settings
        real(wp), intent(in) :: to_root(4,4)                !! the frame's transform to the root frame
        type(PickHit), allocatable, intent(inout) :: hits(:)  !! hits so far (grown as needed)
        integer, intent(inout) :: n                         !! number of hits in hits
        real(wp) :: r, m(4,4)
        r = self%body_radius()
        if (self%contents_shown() .and. r > 0.0_wp) then
            m = identity_matrix()
            if (pick_ellipsoid(self, cam, to_root, [0.0_wp, 0.0_wp, 0.0_wp], m(1:3, 1:3), [r, r, r], .true., hits, n)) return
        end if
        call self%ReferenceFrame%pick(cam, to_root, hits, n)
    end subroutine terrain_pick