RibbonArtist Derived Type

type, public, extends(ChainArtist) :: RibbonArtist

Draws a translucent surface swept between two points at each point of a trajectory (not in OpenFrames): from the point given by the start data sources to the one given by the end data sources, with a quad between each point's pair and the next's. Default: from the frame's origin to the positions, sweeping out an orbit's plane (a fan, as the radius vectors of a SegmentArtist would fill it); other sources give e.g. a curtain from the positions down to a ground track stored as an optional. Unlit, seen from both sides, depth tested but writing no depth (as the equatorial plane of a RadialPlane), drawn to double precision as the curves (its edge on a CurveArtist's line through the same points).

Trace mode draws the surface up to the current time: the quads passed (a draw range, no upload) and one from the last point passed to the point interpolated at the time. Point colors: a trajectory with colors colors the surface, each point's pair in its color, with the artist's opacity (its alpha times theirs); see set_point_colors. A trajectory going round several times covers the surface again each time, so it gets more opaque: trace one revolution, or lower the alpha.


Inherits

type~~ribbonartist~~InheritsGraph type~ribbonartist RibbonArtist type~chainartist ChainArtist type~ribbonartist->type~chainartist type~datasource DataSource type~ribbonartist->type~datasource start_, end_ c_ptr c_ptr type~chainartist->c_ptr group, tail type~linechain LineChain type~chainartist->type~linechain chain type~trajectoryartist TrajectoryArtist type~chainartist->type~trajectoryartist type~linechain->c_ptr group, image type~linechunk LineChunk type~linechain->type~linechunk chunks type~referenceframe ReferenceFrame type~trajectoryartist->type~referenceframe shown_in, data_frame, seen_data_frame type~trajectory Trajectory type~trajectoryartist->type~trajectory traj type~linechunk->c_ptr line type~lodlevel LodLevel type~linechunk->type~lodlevel lod type~referenceframe->c_ptr light_node, light_switch, node_, contents_node, axis_node, axis_label_node, axis_arrow, axis_text, name_label_node, name_text type~referenceframe->type~referenceframe follow_frame_ type~framepointer FramePointer type~referenceframe->type~framepointer children, parents type~trajectoryfollower TrajectoryFollower type~referenceframe->type~trajectoryfollower follower_ type~framepointer->type~referenceframe p type~trajectoryfollower->type~datasource sources_ type~trajectorypointer TrajectoryPointer type~trajectoryfollower->type~trajectorypointer trajs type~trajectorypointer->type~trajectory p

Components

Type Visibility Attributes Name Initial
real(kind=wp), private :: color_(4) = [1.0_wp, 1.0_wp, 1.0_wp, 0.25_wp]

surface color (default white, alpha 0.25)

logical, private :: default_data = .true.

sources not set: the origin to the positions, per the DOF

type(DataSource), private :: end_(3)

start and end points' x, y, z data sources

type(DataSource), private :: start_(3)

start and end points' x, y, z data sources


Constructor

public interface RibbonArtist

The RibbonArtist constructor: RibbonArtist(...) makes one (see new_ribbon_artist for its arguments).

  • private function new_ribbon_artist(traj, color) result(a)

    A ribbon artist for traj (optional), of color color ([r, g, b], alpha unchanged, or [r, g, b, a]; default white, alpha 0.25), from the frame's origin to the positions (see set_start_x_data, ... for others).

    Arguments

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

    the trajectory to draw (not owned)

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

    [r, g, b] or [r, g, b, a] (0 to 1; default white, alpha 0.25)

    Return Value type(RibbonArtist)


Type-Bound Procedures

procedure, public :: apply_style => ribbon_style

  • private subroutine ribbon_style(self)

    The style: the artist's color, or white with its alpha if the points' colors are drawn (the shader multiplies them by it).

    Arguments

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

procedure, public :: build => chain_build

  • private subroutine chain_build(self, viewer, group)

    Create the chain of buffers (sized for the points now) and the trace tail under group.

    Arguments

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

    compiles what is made later (null: nothing to)

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

    the artist's group

procedure, public :: chain_kind => ribbon_chain_kind

  • private pure function ribbon_chain_kind(self)

    The chain: a surface (a pair of points per trajectory point).

    Arguments

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

    Return Value integer

procedure, public :: color => ribbon_color

  • private pure function ribbon_color(self) result(c)

    The surface's color [r, g, b, a].

    Arguments

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

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

procedure, public :: draw_tail => update_ribbon_tail

  • private subroutine update_ribbon_tail(self, t, k, k2)

    The tail: the quad from the pair at point k to the pair interpolated at time t toward point k2 (as the curve's tail: none if either isn't a point written).

    Arguments

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

    the current time

    integer, intent(in) :: k

    the tail's ends (0: none)

    integer, intent(in) :: k2

    the tail's ends (0: none)

procedure, public :: drawn_color => ribbon_drawn_color

  • private function ribbon_drawn_color(self, i) result(rgba)

    The color of the pair at trajectory point i as drawn (rgba: the trajectory's color times the artist's alpha, or the artist's color).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(in) :: self
    integer, intent(in) :: i

    the trajectory point

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

procedure, public :: drawn_pair

  • private subroutine drawn_pair(self, i, a, b)

    The pair at trajectory point i (1 to num_drawn) as drawn, its start a and end b: read back from the buffers.

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(in) :: self
    integer, intent(in) :: i

    the trajectory point (1 to num_drawn)

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

    the pair's start and end (frame coordinates)

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

    the pair's start and end (frame coordinates)

procedure, public :: end_data_sources => ribbon_end_data_sources

  • private pure function ribbon_end_data_sources(self) result(s)

    The x, y and z data sources of the surface's end points.

    Arguments

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

    Return Value type(DataSource), (3)

procedure, public :: first_drawn

  • private pure function first_drawn(self)

    The first point drawn (1, or in trace mode of decreasing times the earliest point passed): points first_drawn .. first_drawn + num_drawn - 1.

    Arguments

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

    Return Value integer

procedure, public :: get_trajectory

  • private function get_trajectory(self) result(traj)

    The trajectory drawn (null if none).

    Arguments

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

    Return Value type(Trajectory), pointer

procedure, public :: init_chain => chain_init

  • private subroutine chain_init(self)

    The chain, colored if the trajectory's colors are drawn.

    Arguments

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

procedure, public :: new_tail => ribbon_new_tail

  • private function ribbon_new_tail(self) result(node)

    The trace tail: a quad (white unless the points' colors are drawn).

    Arguments

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

    Return Value type(c_ptr)

procedure, public :: num_chunks

  • private pure function num_chunks(self)

    Number of buffers the artist is drawn with (0 until built).

    Arguments

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

    Return Value integer

procedure, public :: num_drawn

  • private pure function num_drawn(self)

    Number of trajectory points drawn now (all of them, or in trace mode those passed).

    Arguments

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

    Return Value integer

procedure, public :: pickable => artist_pickable

  • private pure function artist_pickable(self)

    Whether pick tests what this artist draws.

    Arguments

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

    Return Value logical

procedure, public :: point_colors

  • private pure function point_colors(self)

    Whether a trajectory's colors are drawn.

    Arguments

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

    Return Value logical

procedure, public :: points => ribbon_points

  • private function ribbon_points(self) result(n)

    Number of trajectory points to draw the surface through (none if all sources are zero).

    Arguments

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

    Return Value integer

procedure, public :: release => chain_release

  • private subroutine chain_release(self)

    Forget the render nodes: the chain and the tail (see artist_release).

    Arguments

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

procedure, public :: set_color => ribbon_set_color

  • private subroutine ribbon_set_color(self, color)

    The surface's color: [r, g, b] (alpha unchanged) or [r, g, b, a]; its alpha is the surface's opacity (also with the trajectory's colors).

    Arguments

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

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

procedure, public :: set_end_x_data => ribbon_set_end_x_data

  • private function ribbon_set_end_x_data(self, src) result(valid)

    Where the x of the surface's end points come from (see set_start_x_data).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(DataSource), intent(in) :: src

    the end points' x data source

    Return Value logical

procedure, public :: set_end_y_data => ribbon_set_end_y_data

  • private function ribbon_set_end_y_data(self, src) result(valid)

    Where the y of the surface's end points come from (see set_start_x_data).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(DataSource), intent(in) :: src

    the end points' y data source

    Return Value logical

procedure, public :: set_end_z_data => ribbon_set_end_z_data

  • private function ribbon_set_end_z_data(self, src) result(valid)

    Where the z of the surface's end points come from (see set_start_x_data).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(DataSource), intent(in) :: src

    the end points' z data source

    Return Value logical

procedure, public :: set_pickable => artist_set_pickable

  • private subroutine artist_set_pickable(self, pickable)

    Whether pick tests what this artist draws (default true; e.g. false for a spacecraft's marker beside its orbit's curve).

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(inout) :: self
    logical, intent(in) :: pickable

    true: picked (default)

procedure, public :: set_point_colors

  • private subroutine set_point_colors(self, enabled)

    Whether a trajectory with colors is drawn in them (default true); points without a color yet (colors arriving after positions) in the artist's color. A curve: each segment blended from its first point's color to its second's (with level of detail, a color lasting fewer points than are skipped may not show from far away); a surface: each point's pair in its color, times the artist's alpha. False: all in the artist's color.

    Arguments

    Type IntentOptional Attributes Name
    class(ChainArtist), intent(inout) :: self
    logical, intent(in) :: enabled

    true: the trajectory's colors

procedure, public :: set_start_x_data => ribbon_set_start_x_data

  • private function ribbon_set_start_x_data(self, src) result(valid)

    Where the x (y, z) of the surface's start (end) points come from. Returns whether the trajectory has the data of all sources.

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(DataSource), intent(in) :: src

    the start points' x data source

    Return Value logical

procedure, public :: set_start_y_data => ribbon_set_start_y_data

  • private function ribbon_set_start_y_data(self, src) result(valid)

    Where the y of the surface's start points come from (see set_start_x_data).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(DataSource), intent(in) :: src

    the start points' y data source

    Return Value logical

procedure, public :: set_start_z_data => ribbon_set_start_z_data

  • private function ribbon_set_start_z_data(self, src) result(valid)

    Where the z of the surface's start points come from (see set_start_x_data).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(DataSource), intent(in) :: src

    the start points' z data source

    Return Value logical

procedure, public :: set_trace_mode

  • private subroutine set_trace_mode(self, enabled)

    Draw only the part up to the current time (see the module documentation).

    Arguments

    Type IntentOptional Attributes Name
    class(TrajectoryArtist), intent(inout) :: self
    logical, intent(in) :: enabled

    true: draw only up to the current time

procedure, public :: set_trajectory => ribbon_set_trajectory

  • private subroutine ribbon_set_trajectory(self, traj)

    Draw traj; with the default data sources, from the origin to its positions (per its DOF).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    type(Trajectory), intent(in), target :: traj

    the trajectory to draw (not owned)

procedure, public :: start_data_sources => ribbon_start_data_sources

  • private pure function ribbon_start_data_sources(self) result(s)

    The x, y and z data sources of the surface's start points.

    Arguments

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

    Return Value type(DataSource), (3)

procedure, public :: trace_end => ribbon_trace_end

  • private function ribbon_trace_end(self, a, b)

    In trace mode, the pair at the current time (the tail's end) as drawn; false if no tail is drawn.

    Arguments

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

    the pair's start (frame coordinates)

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

    its end

    Return Value logical

procedure, public :: trace_mode

  • private pure function trace_mode(self)

    Whether only the part up to the current time is drawn.

    Arguments

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

    Return Value logical

procedure, public :: update => chain_update

  • private subroutine chain_update(self, t)

    Write the points added (all of them on a redraw), and draw them all or, in trace mode, those passed and the tail to the point at time t.

    Arguments

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

    the current time

procedure, public :: write_points => write_ribbon

  • private subroutine write_ribbon(self, i1, i2)

    Write the pairs of trajectory points i1 .. i2 into the chain, with their colors (and upload the chunks written to).

    Arguments

    Type IntentOptional Attributes Name
    class(RibbonArtist), intent(inout) :: self
    integer, intent(in) :: i1

    the trajectory points

    integer, intent(in) :: i2

    the trajectory points

Source Code

    type, extends(ChainArtist), public :: RibbonArtist
        private
        type(DataSource) :: start_(3), end_(3)      !! start and end points' x, y, z data sources
        logical :: default_data = .true.            !! sources not set: the origin to the positions, per the DOF
        real(wp) :: color_(4) = [1.0_wp, 1.0_wp, 1.0_wp, 0.25_wp]  !! surface color (default white, alpha 0.25)
        ! rendering: the chain a surface, trajectory point i its points 2i-1 (start) and 2i (end); the tail a quad
    contains
        procedure :: set_trajectory => ribbon_set_trajectory
        procedure :: set_start_x_data => ribbon_set_start_x_data, set_start_y_data => ribbon_set_start_y_data
        procedure :: set_start_z_data => ribbon_set_start_z_data
        procedure :: set_end_x_data => ribbon_set_end_x_data, set_end_y_data => ribbon_set_end_y_data
        procedure :: set_end_z_data => ribbon_set_end_z_data
        procedure :: start_data_sources => ribbon_start_data_sources, end_data_sources => ribbon_end_data_sources
        procedure :: set_color => ribbon_set_color, color => ribbon_color
        procedure :: drawn_pair, drawn_color => ribbon_drawn_color, trace_end => ribbon_trace_end
        procedure :: chain_kind => ribbon_chain_kind
        procedure :: points => ribbon_points
        procedure :: new_tail => ribbon_new_tail
        procedure :: apply_style => ribbon_style
        procedure :: write_points => write_ribbon
        procedure :: draw_tail => update_ribbon_tail
    end type RibbonArtist