Declared in LeapObjectiveC.h

Overview

The LeapScreenList category supplies methods for getting a screen from
an NSArray containing LeapScreen objects based on the relationship between
the screens and a LeapPointable object or point.

Tasks

Instance Methods

closestScreen:

Gets the LeapScreen closest to the specified position.

- (LeapScreen *)closestScreen:(LeapVector *)position

Parameters

position

The position from which to check for screen projection.

Return Value

The closest LeapScreen onto which the specified position is projected.

Discussion

Gets the LeapScreen closest to the specified position.

    if ([frame.pointables count] > 0) {  
        LeapPointable *pointable = [frame.pointables objectAtIndex:0];  
        NSArray *screens = controller.calibratedScreens;  

        LeapScreen *screen = [screens closestScreen:pointable.tipPosition];  
        NSLog(@"ClosestScreen(ortho) ID: %d; Size: %d, %d", screen.id, screen.widthPixels, screen.heightPixels);  
    }  

The specified position is projected along each screen’s normal vector
onto the screen’s plane. The screen whose projected point is closest to
the specified position is returned. Call <[LeapScreen project:position normalize:NO clampRatio:1.0f]>
on the returned LeapScreen object to find the projected point.

Declared In

LeapObjectiveC.h

closestScreenHit:

Gets the closest LeapScreen intercepting a ray projecting from the specified
Pointable object.

- (LeapScreen *)closestScreenHit:(LeapPointable *)pointable

Parameters

pointable

The LeapPointable object to check for screen intersection.

Return Value

The closest LeapScreen toward which the specified LeapPointable object
is pointing, or, if the pointable is not pointing in the direction of
any known screen, an invalid LeapScreen object.

Discussion

Gets the closest LeapScreen intercepting a ray projecting from the specified
Pointable object.

The projected ray emanates from the Pointable tipPosition along the
Pointable’s direction vector. If the projected ray does not intersect
any screen surface directly, then the Leap checks for intersection with
the planes extending from the surfaces of the known screens
and returns the LeapScreen with the closest intersection.

    if ([frame.pointables count] > 0) {  
        LeapPointable *pointable = [frame.pointables objectAtIndex:0];  
        NSArray *screens = controller.calibratedScreens;  
        LeapScreen *screen = [screens closestScreenHit:pointable];  
        NSLog(@"ClosestScreenHit ID: %d; Size: %d, %d", screen.id, screen.widthPixels, screen.heightPixels);  
    }  

If no intersections are found (i.e. the ray is directed parallel to or
away from all known screens), then an invalid LeapScreen object is returned.

Note: Be sure to test whether the LeapScreen object returned by this method
is valid. Attempting to use an invalid LeapScreen object will lead to
incorrect results.

Declared In

LeapObjectiveC.h

closestScreenHit:direction:

Gets the closest LeapScreen intercepting a ray projecting from the specified
position in the specified direction.

- (LeapScreen *)closestScreenHit:(const LeapVector *)position direction:(const LeapVector *)direction

Parameters

position

The position from which to check for screen intersection.

direction

The direction in which to check for screen intersection.

Return Value

The closest LeapScreen toward which the specified ray is pointing,
or, if the ray is not pointing in the direction of any known screen,
an invalid LeapScreen object.

Discussion

Gets the closest LeapScreen intercepting a ray projecting from the specified
position in the specified direction.

The projected ray emanates from the position along the direction vector.
If the projected ray does not intersect any screen surface directly,
then the Leap checks for intersection with the planes extending from the
surfaces of the known screens and returns the LeapScreen with the closest
intersection.

If no intersections are found (i.e. the ray is directed parallel to or
away from all known screens), then an invalid LeapScreen object is returned.

Note: Be sure to test whether the LeapScreen object returned by this method
is valid. Attempting to use an invalid LeapScreen object will lead to
incorrect results.

Declared In

LeapObjectiveC.h