Follow traj (in addition to trajectories already followed, if add
is true), with what to follow (data: FOLLOW_POSITION and/or
FOLLOW_ATTITUDE; default both) and how (mode: FOLLOW_LOOP, the
default, or FOLLOW_LIMIT). traj must stay alive while followed.
The followed data are in the parent's coordinates, unless data_frame
(a frame of the same tree) says which frame they are in: e.g. a
spacecraft's inertial trajectory followed by a frame shown in a
rotating frame, placed (and turned) by both frames' poses at each time
(see world_matrix_at), so that it rides on the trajectory drawn in
that frame (DrawableTrajectory's set_data_frame). data_frame must not
depend on this frame (be it or one of its descendants).
call craft%follow(orbit) ! position (and attitude, if any), looping
call craft%follow(orbit, data=FOLLOW_POSITION, mode=FOLLOW_LIMIT) ! position only, held at the ends
call craft%follow(flyby, data_frame=eci) ! inertial data, the craft under a rotating frame
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ReferenceFrame), | intent(inout) | :: | self | |||
| type(Trajectory), | intent(in), | target | :: | traj |
the trajectory to follow (not owned) |
|
| integer, | intent(in), | optional | :: | data |
FOLLOW_POSITION/FOLLOW_ATTITUDE; FOLLOW_LOOP/FOLLOW_LIMIT |
|
| integer, | intent(in), | optional | :: | mode |
FOLLOW_POSITION/FOLLOW_ATTITUDE; FOLLOW_LOOP/FOLLOW_LIMIT |
|
| logical, | intent(in), | optional | :: | add |
(true: in addition to those followed (default false)) |
|
| class(ReferenceFrame), | intent(in), | optional, | target | :: | data_frame |
the frame the data are in (default: the parent) |
subroutine follow(self, traj, data, mode, add, data_frame) class(ReferenceFrame), intent(inout) :: self type(Trajectory), intent(in), target :: traj !! the trajectory to follow (not owned) integer, intent(in), optional :: data, mode !! FOLLOW_POSITION/FOLLOW_ATTITUDE; FOLLOW_LOOP/FOLLOW_LIMIT logical, intent(in), optional :: add !! (true: in addition to those followed (default false)) class(ReferenceFrame), intent(in), target, optional :: data_frame !! the frame the data are in (default: the parent) type(Trajectory), pointer :: p integer :: d, m logical :: adding p => traj adding = .false. if (present(add)) adding = add d = ior(FOLLOW_POSITION, FOLLOW_ATTITUDE) m = FOLLOW_LOOP if (present(data)) d = data if (present(mode)) m = mode if (adding) then call self%follower_%add_trajectory(p) else call self%follower_%set_trajectory(p) end if call self%follower_%set_follow_type(d, m) self%following = .true. self%follow_frame_ => null() if (present(data_frame)) self%follow_frame_ => data_frame self%stamp_ = next_motion_stamp() end subroutine follow