Picked at its tip and along its head (within the tolerance, plus a few pixels), as PICK_HANDLE; else the frame's origin.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(VectorHandle), | intent(in), | target | :: | self | ||
| type(PickCamera), | intent(in) | :: | cam |
the camera and cursor of the pick |
||
| real(kind=wp), | intent(in) | :: | to_root(4,4) |
the frame's transform to the root frame |
||
| type(PickHit), | intent(inout), | allocatable | :: | hits(:) |
hits so far, in hits(1:n); added to |
|
| integer, | intent(inout) | :: | n |
number of hits |
subroutine vector_pick(self, cam, to_root, hits, n) class(VectorHandle), intent(in), target :: self type(PickCamera), intent(in) :: cam !! the camera and cursor of the pick real(wp), intent(in) :: to_root(4,4) !! the frame's transform to the root frame type(PickHit), allocatable, intent(inout) :: hits(:) !! hits so far, in hits(1:n); added to integer, intent(inout) :: n !! number of hits type(PickHit) :: h real(wp) :: p(3), base(3), len, head_len, radius, pixels, depth, s, head_pixels, head_depth logical :: at_tip, on_head call self%ReferenceFrame%pick(cam, to_root, hits, n) if (.not. (self%draggable() .and. self%contents_shown() .and. wants(cam, PICK_HANDLE))) return call arrow_sizes(self, len, head_len, radius) if (len <= 0.0_wp) return p = matmul(to_root(1:3, 1:3), self%tip()) + to_root(1:3, 4) base = matmul(to_root(1:3, 1:3), self%tip() * (1.0_wp - head_len / len)) + to_root(1:3, 4) at_tip = point_pick(cam, p, pixels, depth, extra=6.0_wp * cam%pixel_ratio) on_head = segment_pick(cam, base, p, head_pixels, s, head_depth, extra=4.0_wp * cam%pixel_ratio) if (.not. (at_tip .or. on_head)) return if (on_head .and. (.not. at_tip .or. head_pixels < pixels)) then pixels = head_pixels depth = head_depth end if h%kind = PICK_HANDLE h%frame => self h%position = p h%local = self%tip() h%distance = depth h%pixels = pixels call add_pick_hit(hits, n, h) end subroutine vector_pick