ToolΒΆ

Methods:

class com::leapmotion::leap::Tool

The Tool class represents a tracked tool.

Tools are Pointable objects that the Leap Motion software has classified as a tool.

Get valid Tool objects from a Frame object.

api/../../../images/Leap_Tool.png

Note that Tool objects can be invalid, which means that they do not contain valid tracking data and do not correspond to a physical tool. Invalid Tool objects can be the result of asking for a Tool object using an ID from an earlier frame when no Tool objects with that ID exist in the current frame. A Tool object created from the Tool constructor is also invalid. Test for validity with the Tool::isValid() function.

Since
1.0

Public Functions

Tool()

Constructs a Tool object.

An uninitialized tool is considered invalid. Get valid Tool objects from a Frame object.

Tool frontTool = frame.tools().frontmost();
Tool firstToolInList = frame.tools().get(0);

Since
1.0

Tool(Pointable arg0)

If the specified Pointable object represents a tool, creates a copy of it as a Tool object; otherwise, creates an invalid Tool object.

if (pointable.isTool()) {
    Tool toolFromPointable = new Tool(pointable);
}

Since
1.0

String toString()

A string containing a brief, human readable description of the Tool object.

Return
A description of the Tool object as a string.
Since
1.0

Public Static Functions

Tool invalid()

Returns an invalid Tool object.

You can use the instance returned by this function in comparisons testing whether a given Tool instance is valid or invalid. (You can also use the Tool::isValid() function.)

if (!tool.equals(Tool.invalid())) {
    //Handle valid tool data
}

Return
The invalid Tool instance.
Since
1.0