add_color Subroutine

private subroutine add_color(self, color, ok)

Add a color ([r, g, b], alpha 1, or [r, g, b, a], 0 to 1) for the next time that has none. ok is false if every time already has a color.

Type Bound

Trajectory

Arguments

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

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

logical, intent(out), optional :: ok

false if not added


Calls

proc~~add_color~~CallsGraph proc~add_color Trajectory%add_color proc~grow_colors grow_colors proc~add_color->proc~grow_colors proc~to_float_rgba to_float_rgba proc~add_color->proc~to_float_rgba proc~new_capacity new_capacity proc~grow_colors->proc~new_capacity

Called by

proc~~add_color~~CalledByGraph proc~add_color Trajectory%add_color proc~add_point Trajectory%add_point proc~add_point->proc~add_color

Source Code

    subroutine add_color(self, color, ok)
        class(Trajectory), intent(inout) :: self
        real(wp), intent(in) :: color(:)        !! [r, g, b] or [r, g, b, a] (0 to 1)
        logical, intent(out), optional :: ok    !! false if not added
        if (present(ok)) ok = .false.
        if (self%n_col >= self%n_times) return
        call grow_colors(self, self%n_col + 1)
        self%n_col = self%n_col + 1
        call to_float_rgba(self%col(:, self%n_col), color)
        self%revision_ = self%revision_ + 1
        if (present(ok)) ok = .true.
    end subroutine add_color