Point p (root frame) is within the tolerance (plus extra pixels, e.g.
half a marker's size) of the cursor: its distance from it (pixels) and
its depth.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(PickCamera), | intent(in) | :: | cam |
the camera and cursor of the pick |
||
| real(kind=wp), | intent(in) | :: | p(3) |
the point (root frame) |
||
| real(kind=wp), | intent(out) | :: | pixels |
distance from the cursor (framebuffer pixels) |
||
| real(kind=wp), | intent(out) | :: | depth |
(scene units) |
||
| real(kind=wp), | intent(in), | optional | :: | extra |
added to the tolerance (framebuffer pixels) |
logical function point_pick(cam, p, pixels, depth, extra) result(hit) type(PickCamera), intent(in) :: cam !! the camera and cursor of the pick real(wp), intent(in) :: p(3) !! the point (root frame) real(wp), intent(out) :: pixels !! distance from the cursor (framebuffer pixels) real(wp), intent(out) :: depth !! (scene units) real(wp), intent(in), optional :: extra !! added to the tolerance (framebuffer pixels) real(wp) :: sx, sy, reach hit = .false. pixels = huge(1.0_wp) if (.not. project(cam, p, sx, sy, depth)) return pixels = hypot(sx, sy) reach = cam%tolerance if (present(extra)) reach = reach + extra hit = pixels <= reach .and. depth <= cam%max_depth end function point_pick