unit_part Function

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)


Calls

proc~~unit_part~~CallsGraph proc~unit_part unit_part interface~vkf_mesh_create vkf_mesh_create proc~unit_part->interface~vkf_mesh_create proc~arrow arrow proc~unit_part->proc~arrow proc~arrow_size arrow_size proc~unit_part->proc~arrow_size proc~mesh_arrays mesh_arrays proc~unit_part->proc~mesh_arrays proc~cross cross proc~arrow->proc~cross interface~vkf_mesh_array vkf_mesh_array proc~mesh_arrays->interface~vkf_mesh_array

Called by

proc~~unit_part~~CalledByGraph proc~unit_part unit_part proc~vector_build_contents VectorHandle%vector_build_contents proc~vector_build_contents->proc~unit_part

Source Code

    function unit_part(body_length, head_length, body_radius, head_radius) result(mesh)
        real(c_double), intent(in) :: body_length           !! the shaft's length (0: none)
        real(c_double), intent(in) :: head_length           !! the head's length (0: a flat top)
        real(c_double), intent(in) :: body_radius           !! the shaft's radius
        real(c_double), intent(in) :: head_radius           !! the head's radius at its base
        type(c_ptr) :: mesh
        integer, parameter :: segments = 24
        real(c_float), dimension(:,:), pointer :: xyz, normals, uv
        integer(c_int32_t), dimension(:), pointer :: indices
        integer :: n_vertices, n_indices
        call arrow_size(segments, n_vertices, n_indices)
        mesh = vkf_mesh_create(int(n_vertices, c_int), int(n_indices, c_int), &
                               [1.0_c_float, 1.0_c_float, 1.0_c_float, 1.0_c_float], c_null_ptr, c_null_ptr, 2_c_int)
        if (.not. c_associated(mesh)) return
        call mesh_arrays(mesh, n_vertices, n_indices, xyz, normals, uv, indices)
        call arrow([0.0_c_double, 0.0_c_double, 0.0_c_double], [0.0_c_double, 0.0_c_double, 1.0_c_double], &
                   body_length, head_length, body_radius, head_radius, segments, xyz, normals, uv, indices)
    end function unit_part