The shaft and head placed for the vector (hidden if it is 0).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(VectorHandle), | intent(inout) | :: | self |
subroutine update_arrow(self) class(VectorHandle), intent(inout) :: self real(wp) :: len, head_len, head_radius, u(3), a(3), b(3), m(4,4) if (.not. c_associated(self%switch)) return call arrow_sizes(self, len, head_len, head_radius) call check_status(vkf_switch_set(self%switch, merge(1_c_int, 0_c_int, len > 0.0_wp))) if (len <= 0.0_wp) return u = self%tip() / len a = cross(u, [1.0_wp, 0.0_wp, 0.0_wp]) if (norm2(a) < 1.0e-6_wp) a = cross(u, [0.0_wp, 1.0_wp, 0.0_wp]) a = a / norm2(a) b = cross(u, a) ! (a, b, u right-handed) m = 0.0_wp m(4, 4) = 1.0_wp m(1:3, 1) = 0.4_wp * head_radius * a ! the shaft: 0.4 of the head's radius m(1:3, 2) = 0.4_wp * head_radius * b m(1:3, 3) = (len - head_len) * u call check_status(vkf_transform_set_matrix(self%shaft, m)) m(1:3, 1) = head_radius * a m(1:3, 2) = head_radius * b m(1:3, 3) = head_len * u m(1:3, 4) = (len - head_len) * u call check_status(vkf_transform_set_matrix(self%head, m)) end subroutine update_arrow