vector Function

private pure function vector(self) result(v)

The vector (frame coordinates).

Type Bound

VectorHandle

Arguments

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

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


Source Code

    function new_vector_handle(name, vector, color, scale) result(h)
        character(len=*), intent(in) :: name                !! the frame's name
        real(wp), intent(in), optional :: vector(3)         !! frame coordinates
        real(wp), intent(in), optional :: color(:)          !! [r, g, b] or [r, g, b, a] (0 to 1)
        real(wp), intent(in), optional :: scale             !! display scale (scene units per vector unit; > 0)
        type(VectorHandle) :: h
        h%ReferenceFrame = ReferenceFrame(name, color)
        call h%show_decorations(.false.)
        if (present(vector)) h%vector_ = vector
        if (present(scale)) then
            if (scale > 0.0_wp) h%scale_ = scale
        end if
    end function new_vector_handle

    !> The vector (frame coordinates); can change at any time.
    subroutine set_vector(self, vector)
        class(VectorHandle), intent(inout) :: self
        real(wp), intent(in) :: vector(3)                   !! frame coordinates
        self%vector_ = vector
        call update_arrow(self)
    end subroutine set_vector

    !> The vector (frame coordinates).
    pure function vector(self) result(v)
        class(VectorHandle), intent(in) :: self
        real(wp) :: v(3)
        v = self%vector_
    end function vector