vkf_handles Module

Handles (not in OpenFrames): things in the scene the mouse drags, to design graphically, e.g. a trajectory's initial position and velocity.

A DragHandle is a frame with a point the mouse can grab (handle_point, in the frame's coordinates) and move (move_handle_point); extensions say what the point is and how they are drawn. Windows drive them (WindowProxy, see vkf_window): the handle under the cursor is hovered (drawn brighter); a left button press on it grabs it (the camera stays where it is: the trackball doesn't see the press), the mouse's moves drag it, and the release lets it go. The window's event handler is told (handle_drag, with DRAG_START, DRAG_MOVE and DRAG_END), e.g. to compute a trajectory again from the new state while the handle is dragged. Handles can also be moved by the program (set_vector), and dragged by it (grab, drag and release, given the cursor's ray).

Where the point goes is where the cursor's ray (cursor_ray) meets the handle's constraint (set_constraint), as it was when the handle was grabbed, plus the point's offset from the cursor then (so the point doesn't jump to the cursor): * HANDLE_FREE (the default): the plane through the point facing the camera; * HANDLE_PLANE: the plane through the point with the normal given; * HANDLE_LINE: the line through the point along the direction given; * HANDLE_RADIAL: the line from the frame's origin through the point (e.g. a vector's length only); * HANDLE_SPHERE: the sphere about the frame's origin through the point (e.g. a vector's direction only), on the side (near or far, from the camera) where it was grabbed; where the ray misses it, its edge nearest the ray. Normals and directions are in the frame's coordinates. A ray parallel to a plane or a line doesn't move the point. Positions go through the frames' first parents to the root (world_matrix).

Handles on the same spot of the screen (e.g. a trajectory's end marker on its state's arrow): the window hovers the one nearest the cursor on the screen; within a few pixels of each other, the one of the highest priority (set_priority; markers, TimeHandle, 1 by default, before arrows, 0), then the nearest to the eye.

A VectorHandle is an arrow from its frame's origin to its tip, the tip being the handle: a vector (set_vector, in the frame's coordinates) times a display scale (set_display_scale: e.g. 1000 s to draw a velocity in km/s as km). Dragging the tip changes the vector. The arrow is in the frame's color, lit as frames' axes (by how it faces the viewer); its head is set_head_size long (scene units; default 0.2 of the arrow, at most half of it). It is built once, as a unit shaft and head scaled and turned by two transforms: a new vector only sets them (cheap enough for every frame of a drag).

A TimeHandle is a marker at a time along a path (a TimePath: a position for any time, in the coordinates of the handle's parent frame, e.g. a propagator's), dragged along the path to change the time: e.g. a trajectory's end, dragged to make it longer or shorter in time. The path needn't be drawn where the handle goes (beyond a trajectory's last point, the program propagates further). The frame is placed at the path's position for the time (set_time), so its name label (e.g. the time, set_name) goes with it; the marker is the size of MarkerArtist's markers (window units, not shrinking with distance). A drag takes the time within set_time_range whose point is nearest the cursor's ray (as seen from the eye): among the path's points sampled at the grab, then refined between them; where the path passes near itself (orbits), the match nearest in time to the handle's time is taken, so it doesn't jump to another revolution. A TrajectoryPath follows a Trajectory's points (interpolated linearly), within its times.


Uses

  • module~~vkf_handles~~UsesGraph module~vkf_handles vkf_handles iso_c_binding iso_c_binding module~vkf_handles->iso_c_binding module~vkf_artists vkf_artists module~vkf_handles->module~vkf_artists module~vkf_frames vkf_frames module~vkf_handles->module~vkf_frames module~vkf_geometry vkf_geometry module~vkf_handles->module~vkf_geometry module~vkf_layer vkf_layer module~vkf_handles->module~vkf_layer module~vkf_math vkf_math module~vkf_handles->module~vkf_math module~vkf_pick vkf_pick module~vkf_handles->module~vkf_pick module~vkf_trajectory vkf_trajectory module~vkf_handles->module~vkf_trajectory module~vkf_artists->iso_c_binding module~vkf_artists->module~vkf_frames module~vkf_artists->module~vkf_layer module~vkf_artists->module~vkf_math module~vkf_artists->module~vkf_pick module~vkf_artists->module~vkf_trajectory module~vkf_line_chain vkf_line_chain module~vkf_artists->module~vkf_line_chain module~vkf_frames->iso_c_binding module~vkf_frames->module~vkf_geometry module~vkf_frames->module~vkf_layer module~vkf_frames->module~vkf_math module~vkf_frames->module~vkf_pick module~vkf_frames->module~vkf_trajectory module~vkf_follower vkf_follower module~vkf_frames->module~vkf_follower module~vkf_text vkf_text module~vkf_frames->module~vkf_text module~vkf_geometry->iso_c_binding module~vkf_geometry->module~vkf_layer module~vkf_geometry->module~vkf_math module~vkf_layer->iso_c_binding iso_fortran_env iso_fortran_env module~vkf_math->iso_fortran_env module~vkf_pick->module~vkf_math module~vkf_trajectory->iso_c_binding module~vkf_trajectory->module~vkf_math module~vkf_trajectory->iso_fortran_env module~vkf_follower->module~vkf_math module~vkf_follower->module~vkf_trajectory module~vkf_line_chain->iso_c_binding module~vkf_line_chain->module~vkf_layer module~vkf_line_chain->module~vkf_math module~vkf_text->iso_c_binding module~vkf_text->module~vkf_layer module~vkf_text->module~vkf_math module~vkf_files vkf_files module~vkf_text->module~vkf_files

Used by

  • module~~vkf_handles~~UsedByGraph module~vkf_handles vkf_handles module~vkf_window vkf_window module~vkf_window->module~vkf_handles module~vkframes vkframes module~vkframes->module~vkf_handles module~vkframes->module~vkf_window

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: HANDLE_FREE = 0

A handle's constraint (set_constraint; see the module documentation). the plane facing the camera

integer, public, parameter :: HANDLE_LINE = 2

a line (its direction given)

integer, public, parameter :: HANDLE_PLANE = 1

a plane (its normal given)

integer, public, parameter :: HANDLE_RADIAL = 3

the line from the frame's origin through the point

integer, public, parameter :: HANDLE_SPHERE = 4

the sphere about the frame's origin through the point

integer, private, save :: n_shown = 0

handles shown in a window (so far)

integer, private, parameter :: path_samples = 600

a TimeHandle's path sampled at a grab


Interfaces

public interface TimeHandle

The TimeHandle constructor: TimeHandle(...) makes one (see new_time_handle for its arguments).

  • private function new_time_handle(name, path, time, t_min, t_max, color) result(h)

    A time handle (see the module documentation) on path (which must stay alive while used), at time time (default 0) within t_min to t_max (default: the time), in color ([r, g, b] or [r, g, b, a]). Its axes and labels are hidden (its name label can be shown: e.g. the time).

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: name

    the frame's name

    class(TimePath), intent(in), target :: path

    the path it moves along

    real(kind=wp), intent(in), optional :: time

    its time

    real(kind=wp), intent(in), optional :: t_min

    the times a drag may reach

    real(kind=wp), intent(in), optional :: t_max

    the times a drag may reach

    real(kind=wp), intent(in), optional :: color(:)

    [r, g, b] or [r, g, b, a] (0 to 1)

    Return Value type(TimeHandle)

public interface TrajectoryPath

The TrajectoryPath constructor: TrajectoryPath(...) makes one (see new_trajectory_path for its arguments).

  • private function new_trajectory_path(traj) result(path)

    A path along traj (which must stay alive while used).

    Arguments

    Type IntentOptional Attributes Name
    type(Trajectory), intent(in), target :: traj

    the trajectory followed

    Return Value type(TrajectoryPath)

public interface VectorHandle

The VectorHandle constructor: VectorHandle(...) makes one (see new_vector_handle for its arguments).

  • private function new_vector_handle(name, vector, color, scale) result(h)

    A vector handle (see the module documentation): vector in its frame's coordinates (default [1, 0, 0]), drawn scale times as long (default 1), in color ([r, g, b] or [r, g, b, a]). Its axes and labels are hidden.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: name

    the frame's name

    real(kind=wp), intent(in), optional :: vector(3)

    frame coordinates

    real(kind=wp), intent(in), optional :: color(:)

    [r, g, b] or [r, g, b, a] (0 to 1)

    real(kind=wp), intent(in), optional :: scale

    display scale (scene units per vector unit; > 0)

    Return Value type(VectorHandle)


Abstract Interfaces

abstract interface

  • private pure function handle_point_interface(self) result(p)

    The point the mouse grabs (frame coordinates).

    Arguments

    Type IntentOptional Attributes Name
    class(DragHandle), intent(in) :: self

    Return Value real(kind=wp), (3)

abstract interface

  • private subroutine move_handle_point_interface(self, p)

    Move the point to p (frame coordinates), and the drawing with it.

    Arguments

    Type IntentOptional Attributes Name
    class(DragHandle), intent(inout) :: self
    real(kind=wp), intent(in) :: p(3)

    the new point (frame coordinates)

abstract interface

  • private function path_position_interface(self, t) result(p)

    The position at time t (the handle's parent's coordinates).

    Arguments

    Type IntentOptional Attributes Name
    class(TimePath), intent(in) :: self
    real(kind=wp), intent(in) :: t

    the time

    Return Value real(kind=wp), (3)

abstract interface

  • private subroutine show_state_interface(self)

    Draw the handle as hovered, dragged or neither (hovered, dragged).

    Arguments

    Type IntentOptional Attributes Name
    class(DragHandle), intent(inout) :: self

Derived Types

type, public, abstract, extends(ReferenceFrame) ::  DragHandle

A handle the mouse drags (see the module documentation): extensions give its point and draw it.

Components

Type Visibility Attributes Name Initial
real(kind=wp), private :: axis_(3) = [0.0_wp, 0.0_wp, 1.0_wp]

the plane's normal or the line's direction (frame coordinates)

integer, private :: constraint_ = HANDLE_FREE

HANDLE_*

logical, private :: draggable_ = .true.

the mouse may grab it

logical, private :: dragged_ = .false.

grabbed, until released

logical, private :: far_side = .false.

(HANDLE_SPHERE) grabbed on the far side

logical, private :: hovered_ = .false.

under the cursor

real(kind=wp), private :: offset(3) = 0.0_wp

the point's offset from the cursor's

integer, private :: priority_ = 0

over other handles on the same spot (higher first)

real(kind=wp), private :: radius = 0.0_wp

(HANDLE_SPHERE) the sphere's radius

real(kind=wp), private :: ref_axis(3) = 0.0_wp

the plane's normal or the line's direction then

real(kind=wp), private :: ref_point(3) = 0.0_wp

the point when grabbed

Type-Bound Procedures

procedure, public :: add_child
procedure, public :: attitude
procedure, public :: axes_labels_shown
procedure, public :: axes_shown
procedure, public :: axis_label
procedure, public :: bound
procedure, public :: build_contents
procedure, public :: child
procedure, public :: child_index
procedure, public :: color
procedure, public :: constraint
procedure, public :: constraint_axis
procedure, public :: contents_shown
procedure, public :: detach
procedure, public :: drag
procedure, public :: draggable
procedure, public :: dragged
procedure, public :: follow
procedure, public :: follow_frame
procedure, public :: follower
procedure, public :: frame_info
procedure, public :: frame_string
procedure, public :: grab
procedure(handle_point_interface), public, deferred :: handle_point
procedure, public :: has_light_source
procedure, public :: hovered
procedure, public :: is_following
procedure, public :: label_alignment
procedure, public :: label_font
procedure, public :: label_size
procedure, public :: late_update
procedure, public :: light_ambient
procedure, public :: light_diffuse
procedure, public :: light_source_enabled
procedure, public :: light_specular
procedure, public :: local_matrix
procedure, public :: local_matrix_at
procedure, public :: motion_key
procedure(move_handle_point_interface), public, deferred :: move_handle_point
procedure, public :: move_x_axis
procedure, public :: move_y_axis
procedure, public :: move_z_axis
procedure, public :: name
procedure, public :: name_label_on_top
procedure, public :: name_label_shown
procedure, public :: node
procedure, public :: num_children
procedure, public :: num_parents
procedure, public :: parent
procedure, public :: parent_index
procedure, public :: pick
procedure, public :: pickable
procedure, public :: position
procedure, public :: position_of
procedure, public :: priority
procedure, public :: realize
procedure, public :: release
procedure, public :: remove_child
procedure, public :: reposition_axes
procedure, public :: set_attitude
procedure, public :: set_color
procedure, public :: set_constraint
procedure, public :: set_draggable
procedure, public :: set_hovered
procedure, public :: set_label_alignment
procedure, public :: set_label_font
procedure, public :: set_label_size
procedure, public :: set_light_ambient
procedure, public :: set_light_diffuse
procedure, public :: set_light_source_enabled
procedure, public :: set_light_specular
procedure, public :: set_name
procedure, public :: set_name_label_on_top
procedure, public :: set_pickable
procedure, public :: set_position
procedure, public :: set_priority
procedure, public :: set_x_label
procedure, public :: set_y_label
procedure, public :: set_z_label
procedure, public :: show_axes
procedure, public :: show_axes_labels
procedure, public :: show_contents
procedure, public :: show_decorations
procedure, public :: show_name_label
procedure(show_state_interface), public, deferred :: show_state
procedure, public :: sync
procedure, public :: unfollow
procedure, public :: update
procedure, public :: world_matrix
procedure, public :: world_matrix_at

type, public, extends(DragHandle) ::  TimeHandle

A marker dragged along a path to change its time (see the module documentation).

Components

Type Visibility Attributes Name Initial
type(c_ptr), private :: marker = c_null_ptr

the marker node (at the frame's origin)

class(TimePath), private, pointer :: path_ => null()

the path (not owned)

real(kind=wp), private, allocatable :: sample_p(:,:)
real(kind=wp), private, allocatable :: sample_t(:)
integer, private :: shape_ = MARKER_DISK

a MARKER_* shape

real(kind=wp), private :: size_ = 14.0_wp

the marker's size (window units)

real(kind=wp), private :: t_max = 1.0_wp

the times a drag may reach

real(kind=wp), private :: t_min = 0.0_wp

the times a drag may reach

real(kind=wp), private :: time_ = 0.0_wp

the time (its point: the frame's position)

Constructor

The TimeHandle constructor: TimeHandle(...) makes one (see new_time_handle for its arguments).

private function new_time_handle (name, path, time, t_min, t_max, color)

A time handle (see the module documentation) on path (which must stay alive while used), at time time (default 0) within t_min to t_max (default: the time), in color ([r, g, b] or [r, g, b, a]). Its axes and labels are hidden (its name label can be shown: e.g. the time).

Type-Bound Procedures

procedure, public :: add_child
procedure, public :: attitude
procedure, public :: axes_labels_shown
procedure, public :: axes_shown
procedure, public :: axis_label
procedure, public :: bound => time_bound
procedure, public :: build_contents => time_build_contents
procedure, public :: child
procedure, public :: child_index
procedure, public :: color
procedure, public :: constraint
procedure, public :: constraint_axis
procedure, public :: contents_shown
procedure, public :: detach
procedure, public :: drag => time_drag
procedure, public :: draggable
procedure, public :: dragged
procedure, public :: follow
procedure, public :: follow_frame
procedure, public :: follower
procedure, public :: frame_info => time_frame_info
procedure, public :: frame_string
procedure, public :: grab => time_grab
procedure, public :: handle_point => time_handle_point
procedure, public :: has_light_source
procedure, public :: hovered
procedure, public :: is_following
procedure, public :: label_alignment
procedure, public :: label_font
procedure, public :: label_size
procedure, public :: late_update
procedure, public :: light_ambient
procedure, public :: light_diffuse
procedure, public :: light_source_enabled
procedure, public :: light_specular
procedure, public :: local_matrix
procedure, public :: local_matrix_at
procedure, public :: marker_shape
procedure, public :: marker_size
procedure, public :: motion_key
procedure, public :: move_handle_point => time_move_handle_point
procedure, public :: move_x_axis
procedure, public :: move_y_axis
procedure, public :: move_z_axis
procedure, public :: name
procedure, public :: name_label_on_top
procedure, public :: name_label_shown
procedure, public :: node
procedure, public :: num_children
procedure, public :: num_parents
procedure, public :: parent
procedure, public :: parent_index
procedure, public :: pick => time_pick
procedure, public :: pickable
procedure, public :: position
procedure, public :: position_of
procedure, public :: priority
procedure, public :: realize
procedure, public :: release
procedure, public :: remove_child
procedure, public :: reposition_axes
procedure, public :: set_attitude
procedure, public :: set_color => time_set_color
procedure, public :: set_constraint
procedure, public :: set_draggable
procedure, public :: set_hovered
procedure, public :: set_label_alignment
procedure, public :: set_label_font
procedure, public :: set_label_size
procedure, public :: set_light_ambient
procedure, public :: set_light_diffuse
procedure, public :: set_light_source_enabled
procedure, public :: set_light_specular
procedure, public :: set_marker_shape
procedure, public :: set_marker_size
procedure, public :: set_name
procedure, public :: set_name_label_on_top
procedure, public :: set_path
procedure, public :: set_pickable
procedure, public :: set_position
procedure, public :: set_priority
procedure, public :: set_time
procedure, public :: set_time_range
procedure, public :: set_x_label
procedure, public :: set_y_label
procedure, public :: set_z_label
procedure, public :: show_axes
procedure, public :: show_axes_labels
procedure, public :: show_contents
procedure, public :: show_decorations
procedure, public :: show_name_label
procedure, public :: show_state => time_show_state
procedure, public :: sync
procedure, public :: time
procedure, public :: time_range
procedure, public :: unfollow
procedure, public :: update
procedure, public :: world_matrix
procedure, public :: world_matrix_at

type, public, abstract ::  TimePath

A path for a TimeHandle (see the module documentation): a position for any time.

Type-Bound Procedures

procedure(path_position_interface), public, deferred :: position

type, public, extends(TimePath) ::  TrajectoryPath

A TimePath along a Trajectory's points, interpolated linearly (before its first time: its first point; after its last: its last).

Components

Type Visibility Attributes Name Initial
type(Trajectory), public, pointer :: trajectory => null()

the trajectory followed (not owned)

Constructor

The TrajectoryPath constructor: TrajectoryPath(...) makes one (see new_trajectory_path for its arguments).

private function new_trajectory_path (traj)

A path along traj (which must stay alive while used).

Type-Bound Procedures

procedure, public :: position => trajectory_path_position

type, public, extends(DragHandle) ::  VectorHandle

An arrow whose tip the mouse drags (see the module documentation).

Components

Type Visibility Attributes Name Initial
type(c_ptr), private :: head = c_null_ptr

the transforms of the unit shaft and head

type(c_ptr), private :: head_mesh = c_null_ptr

the unit shaft and head (colored by their materials)

real(kind=wp), private :: head_size_ = 0.0_wp

the head's length (scene units; 0: 0.2 of the arrow)

real(kind=wp), private :: scale_ = 1.0_wp

drawn as scale * vector (scene units)

type(c_ptr), private :: shaft = c_null_ptr

the transforms of the unit shaft and head

type(c_ptr), private :: shaft_mesh = c_null_ptr

the unit shaft and head (colored by their materials)

type(c_ptr), private :: switch = c_null_ptr

shows the arrow (not when the vector is 0)

real(kind=wp), private :: vector_(3) = [1.0_wp, 0.0_wp, 0.0_wp]

the vector (frame coordinates)

Constructor

The VectorHandle constructor: VectorHandle(...) makes one (see new_vector_handle for its arguments).

private function new_vector_handle (name, vector, color, scale)

A vector handle (see the module documentation): vector in its frame's coordinates (default [1, 0, 0]), drawn scale times as long (default 1), in color ([r, g, b] or [r, g, b, a]). Its axes and labels are hidden.

Type-Bound Procedures

procedure, public :: add_child
procedure, public :: attitude
procedure, public :: axes_labels_shown
procedure, public :: axes_shown
procedure, public :: axis_label
procedure, public :: bound => vector_bound
procedure, public :: build_contents => vector_build_contents
procedure, public :: child
procedure, public :: child_index
procedure, public :: color
procedure, public :: constraint
procedure, public :: constraint_axis
procedure, public :: contents_shown
procedure, public :: detach
procedure, public :: display_scale
procedure, public :: drag
procedure, public :: draggable
procedure, public :: dragged
procedure, public :: follow
procedure, public :: follow_frame
procedure, public :: follower
procedure, public :: frame_info => vector_frame_info
procedure, public :: frame_string
procedure, public :: grab
procedure, public :: handle_point => vector_handle_point
procedure, public :: has_light_source
procedure, public :: head_size
procedure, public :: hovered
procedure, public :: is_following
procedure, public :: label_alignment
procedure, public :: label_font
procedure, public :: label_size
procedure, public :: late_update
procedure, public :: light_ambient
procedure, public :: light_diffuse
procedure, public :: light_source_enabled
procedure, public :: light_specular
procedure, public :: local_matrix
procedure, public :: local_matrix_at
procedure, public :: motion_key
procedure, public :: move_handle_point => vector_move_handle_point
procedure, public :: move_x_axis
procedure, public :: move_y_axis
procedure, public :: move_z_axis
procedure, public :: name
procedure, public :: name_label_on_top
procedure, public :: name_label_shown
procedure, public :: node
procedure, public :: num_children
procedure, public :: num_parents
procedure, public :: parent
procedure, public :: parent_index
procedure, public :: pick => vector_pick
procedure, public :: pickable
procedure, public :: position
procedure, public :: position_of
procedure, public :: priority
procedure, public :: realize
procedure, public :: release
procedure, public :: remove_child
procedure, public :: reposition_axes
procedure, public :: set_attitude
procedure, public :: set_color => vector_set_color
procedure, public :: set_constraint
procedure, public :: set_display_scale
procedure, public :: set_draggable
procedure, public :: set_head_size
procedure, public :: set_hovered
procedure, public :: set_label_alignment
procedure, public :: set_label_font
procedure, public :: set_label_size
procedure, public :: set_light_ambient
procedure, public :: set_light_diffuse
procedure, public :: set_light_source_enabled
procedure, public :: set_light_specular
procedure, public :: set_name
procedure, public :: set_name_label_on_top
procedure, public :: set_pickable
procedure, public :: set_position
procedure, public :: set_priority
procedure, public :: set_vector
procedure, public :: set_x_label
procedure, public :: set_y_label
procedure, public :: set_z_label
procedure, public :: show_axes
procedure, public :: show_axes_labels
procedure, public :: show_contents
procedure, public :: show_decorations
procedure, public :: show_name_label
procedure, public :: show_state => vector_show_state
procedure, public :: sync
procedure, public :: tip
procedure, public :: unfollow
procedure, public :: update
procedure, public :: vector
procedure, public :: world_matrix
procedure, public :: world_matrix_at

Functions

private function constrained(self, origin, dir, m, h) result(ok)

Where the ray (origin, unit dir; root frame) meets the constraint taken at the grab, the frame at transform m to the root: h, in the frame's coordinates. False if it doesn't.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self
real(kind=wp), intent(in) :: origin(3)

the cursor's ray: its origin (root frame)

real(kind=wp), intent(in) :: dir(3)

its direction (a unit vector)

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

the frame's transform to the root

real(kind=wp), intent(out) :: h(3)

where it meets the constraint (frame coordinates)

Return Value logical

private pure function constraint(self)

The handle's constraint (HANDLE_*).

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self

Return Value integer

private pure function constraint_axis(self) result(axis)

The constraint's normal or direction (unit vector, frame coordinates).

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self

Return Value real(kind=wp), (3)

private pure function display_scale(self)

The display scale.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self

Return Value real(kind=wp)

private function drag(self, origin, dir) result(moved)

Drag the grabbed handle to the cursor's ray (origin, unit dir; root frame), held to its constraint. False (and not moved) if it isn't grabbed or the ray doesn't meet the constraint.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
real(kind=wp), intent(in) :: origin(3)

the cursor's ray (root frame)

real(kind=wp), intent(in) :: dir(3)

the cursor's ray (root frame)

Return Value logical

private pure function draggable(self)

Whether the mouse may grab the handle.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self

Return Value logical

private pure function dragged(self)

The handle is grabbed (until released).

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self

Return Value logical

private function grab(self, origin, dir) result(ok)

Grab the handle with the cursor's ray (origin, unit dir; root frame): its constraint is taken as it is now, and the point's offset from where the ray meets it. False if it isn't draggable.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
real(kind=wp), intent(in) :: origin(3)

the cursor's ray (root frame)

real(kind=wp), intent(in) :: dir(3)

the cursor's ray (root frame)

Return Value logical

public function handles_shown()

Whether any handle has been shown in a window (so windows look for handles under the cursor).

Arguments

None

Return Value logical

private pure function head_size(self)

The head's length set (0: 0.2 of the arrow's).

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self

Return Value real(kind=wp)

private pure function hovered(self)

The handle is under the cursor.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self

Return Value logical

private pure function marker_shape(self)

The marker's shape (MARKER_*).

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self

Return Value integer

private pure function marker_size(self)

The marker's size (window units).

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self

Return Value real(kind=wp)

private function new_time_handle(name, path, time, t_min, t_max, color) result(h)

A time handle (see the module documentation) on path (which must stay alive while used), at time time (default 0) within t_min to t_max (default: the time), in color ([r, g, b] or [r, g, b, a]). Its axes and labels are hidden (its name label can be shown: e.g. the time).

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

the frame's name

class(TimePath), intent(in), target :: path

the path it moves along

real(kind=wp), intent(in), optional :: time

its time

real(kind=wp), intent(in), optional :: t_min

the times a drag may reach

real(kind=wp), intent(in), optional :: t_max

the times a drag may reach

real(kind=wp), intent(in), optional :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)

Return Value type(TimeHandle)

private function new_trajectory_path(traj) result(path)

A path along traj (which must stay alive while used).

Arguments

Type IntentOptional Attributes Name
type(Trajectory), intent(in), target :: traj

the trajectory followed

Return Value type(TrajectoryPath)

private function new_vector_handle(name, vector, color, scale) result(h)

A vector handle (see the module documentation): vector in its frame's coordinates (default [1, 0, 0]), drawn scale times as long (default 1), in color ([r, g, b] or [r, g, b, a]). Its axes and labels are hidden.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

the frame's name

real(kind=wp), intent(in), optional :: vector(3)

frame coordinates

real(kind=wp), intent(in), optional :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)

real(kind=wp), intent(in), optional :: scale

display scale (scene units per vector unit; > 0)

Return Value type(VectorHandle)

private pure function priority(self)

The handle's priority over others on the same spot.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(in) :: self

Return Value integer

private pure function time(self)

The handle's time.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self

Return Value real(kind=wp)

private function time_drag(self, origin, dir) result(moved)

Drag the grabbed handle to the cursor's ray (origin, unit dir; root frame): its time where the path is nearest the ray (see the module documentation). False (not moved) if it isn't grabbed or the path is all behind the eye.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: origin(3)

the cursor's ray (root frame)

real(kind=wp), intent(in) :: dir(3)

the cursor's ray (root frame)

Return Value logical

private function time_frame_info(self) result(info)

What kind of frame this is: 'TimeHandle'.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self

Return Value character(len=:), allocatable

private function time_grab(self, origin, dir) result(ok)

Grab the handle with the cursor's ray (origin, unit dir; root frame): the path sampled over the time range. False if it isn't draggable or has no path.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: origin(3)

the cursor's ray (root frame)

real(kind=wp), intent(in) :: dir(3)

the cursor's ray (root frame)

Return Value logical

private pure function time_handle_point(self) result(p)

The point the mouse grabs: the marker, at the frame's origin.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self

Return Value real(kind=wp), (3)

private pure function tip(self) result(p)

The arrow's tip: the display scale times the vector (frame coordinates).

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self

Return Value real(kind=wp), (3)

private function trajectory_path_position(self, t) result(p)

The trajectory's position at time t (point_at: linear between its points, its first or last point outside its times; 0 if it has none).

Arguments

Type IntentOptional Attributes Name
class(TrajectoryPath), intent(in) :: self
real(kind=wp), intent(in) :: t

the time

Return Value real(kind=wp), (3)

private function unit_part(body_length, head_length, body_radius, head_radius) result(mesh)

A unit part of an arrow along z from the origin (vkf_geometry's arrow: body and head lengths and radii), white (colored by its material), lit as frames' axes. Null on failure.

Arguments

Type IntentOptional Attributes Name
real(kind=c_double), intent(in) :: body_length

the shaft's length (0: none)

real(kind=c_double), intent(in) :: head_length

the head's length (0: a flat top)

real(kind=c_double), intent(in) :: body_radius

the shaft's radius

real(kind=c_double), intent(in) :: head_radius

the head's radius at its base

Return Value type(c_ptr)

private pure function vector(self) result(v)

The vector (frame coordinates).

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self

Return Value real(kind=wp), (3)

private function vector_frame_info(self) result(info)

What kind of frame this is: 'VectorHandle'.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self

Return Value character(len=:), allocatable

private pure function vector_handle_point(self) result(p)

The point the mouse grabs: the tip.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self

Return Value real(kind=wp), (3)


Subroutines

private pure subroutine arrow_sizes(self, len, head_len, head_radius)

The arrow's length, its head's length and radius (scene units).

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self
real(kind=wp), intent(out) :: len

the arrow's length (the tip's distance)

real(kind=wp), intent(out) :: head_len

its head's length

real(kind=wp), intent(out) :: head_radius

its head's radius

private subroutine release(self)

Let the handle go.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self

private subroutine set_constraint(self, constraint, axis)

Where the handle can be dragged (HANDLE_*; see the module documentation), with axis: the plane's normal (HANDLE_PLANE) or the line's direction (HANDLE_LINE), in the frame's coordinates. Taken when the handle is next grabbed.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
integer, intent(in) :: constraint

HANDLE_*

real(kind=wp), intent(in), optional :: axis(3)

(frame coordinates; any length but 0)

private subroutine set_display_scale(self, scale)

Scene units per unit of the vector (> 0; default 1): the arrow is scale * vector.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self
real(kind=wp), intent(in) :: scale

scene units per vector unit (> 0; else ignored)

private subroutine set_draggable(self, draggable)

Whether the mouse may grab the handle (default true).

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
logical, intent(in) :: draggable

true: the mouse may grab it

private subroutine set_head_size(self, size)

The head's length (scene units; at most half the arrow); 0 (the default): 0.2 of the arrow's length.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self
real(kind=wp), intent(in) :: size

the head's length (scene units; 0: 0.2 of the arrow)

private subroutine set_hovered(self, hovered)

The handle is under the cursor (set by the window), or not.

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
logical, intent(in) :: hovered

true: under the cursor

private subroutine set_marker_shape(self, shape)

The marker's shape (a MARKER_* shape of vkf_artists but MARKER_IMAGE; default MARKER_DISK).

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
integer, intent(in) :: shape

a MARKER_* shape

private subroutine set_marker_size(self, size)

The marker's size (window units, > 0; default 14).

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: size

window units

private subroutine set_path(self, path)

The path the handle moves along (which must stay alive while used); its time kept (the frame placed on the new path).

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
class(TimePath), intent(in), target :: path

the path

private subroutine set_priority(self, priority)

The handle's priority over others on the same spot of the screen (higher first; default 0, a TimeHandle's 1; see the module documentation).

Arguments

Type IntentOptional Attributes Name
class(DragHandle), intent(inout) :: self
integer, intent(in) :: priority

higher: hovered first

private subroutine set_time(self, time)

The handle's time (kept within its time range): the frame placed at the path's point for it.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: time

the time

private subroutine set_time_range(self, t_min, t_max)

The times a drag may reach (t_min <= t_max; else swapped); the handle's time brought within them. Taken at the next grab.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: t_min

the earliest and latest times

real(kind=wp), intent(in) :: t_max

the earliest and latest times

private subroutine set_vector(self, vector)

The vector (frame coordinates); can change at any time.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self
real(kind=wp), intent(in) :: vector(3)

frame coordinates

private subroutine time_bound(self, center, radius)

The marker's bounding sphere: the frame's origin.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self
real(kind=wp), intent(out) :: center(3)

the bound's center (frame coordinates)

real(kind=wp), intent(out) :: radius

its radius (scene units: 0, the marker sized on the screen)

private subroutine time_build_contents(self, viewer, group)

The marker: one point at the frame's origin.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
type(c_ptr), intent(in) :: viewer

a window's viewer (null: headless)

type(c_ptr), intent(in) :: group

the frame's contents group

private subroutine time_move_handle_point(self, p)

The handle moved to the sampled point of the path nearest p (frame coordinates; after a grab: the path's points are sampled then).

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: p(3)

the point (frame coordinates)

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

Picked at its marker (within the tolerance plus half its size), as PICK_HANDLE; else the frame's origin.

Arguments

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

the camera and cursor of the pick

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, in hits(1:n); added to

integer, intent(inout) :: n

number of hits

private pure subroutine time_range(self, t_min, t_max)

The times a drag may reach.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(in) :: self
real(kind=wp), intent(out) :: t_min

the earliest and latest times

real(kind=wp), intent(out) :: t_max

the earliest and latest times

private subroutine time_set_color(self, color)

The marker's color; [r, g, b] or [r, g, b, a].

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self
real(kind=wp), intent(in) :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)

private subroutine time_show_state(self)

The marker's color and size: brighter and larger when hovered, more when dragged.

Arguments

Type IntentOptional Attributes Name
class(TimeHandle), intent(inout) :: self

private subroutine update_arrow(self)

The shaft and head placed for the vector (hidden if it is 0).

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self

private subroutine vector_bound(self, center, radius)

The arrow's bounding sphere (frame coordinates).

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(in) :: self
real(kind=wp), intent(out) :: center(3)

the bound's center (frame coordinates)

real(kind=wp), intent(out) :: radius

its radius (scene units)

private subroutine vector_build_contents(self, viewer, group)

The arrow: a unit shaft and head under their transforms, in a switch.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self
type(c_ptr), intent(in) :: viewer

a window's viewer (null: headless)

type(c_ptr), intent(in) :: group

the frame's contents group

private subroutine vector_move_handle_point(self, p)

The tip dragged to p: the vector p / the display scale.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self
real(kind=wp), intent(in) :: p(3)

the tip's new place (frame coordinates)

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

Picked at its tip and along its head (within the tolerance, plus a few pixels), as PICK_HANDLE; else the frame's origin.

Arguments

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

the camera and cursor of the pick

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, in hits(1:n); added to

integer, intent(inout) :: n

number of hits

private subroutine vector_set_color(self, color)

The arrow's color; [r, g, b] or [r, g, b, a].

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self
real(kind=wp), intent(in) :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)

private subroutine vector_show_state(self)

The arrow's color, brighter when hovered and more when dragged.

Arguments

Type IntentOptional Attributes Name
class(VectorHandle), intent(inout) :: self