C++ Java Unity
Java Reference
MultiTarget Class Reference

Detailed Description

A type of ObjectTarget that represents an object constructed from multiple component Trackables.

A MultiTarget is useful when you want to construct a Trackable using multiple component Trackables arranged in a fixed spatial relationship to each other.

To build a MultiTarget, you typically initialize and load a DataSet containing the Trackables you want to combine (usually ImageTargets), then call DataSet::createMultiTarget() to get a new MultiTarget object. Loop through the Trackables using DataSet::getTrackable() and add them to the new MultiTarget using addPart(), calling setPartOffset() to define the offset (position and rotation) for each added Trackable.

For example, suppose you want to be able to recognise and track a cereal box. You also want to be able to initialize the tracking from both sides of the box - it shouldn't matter if the front or the back of the box is facing the user, your application should be able to recognise and track both sides.

You would need to start by building two ImageTargets, one to track the front side of the box, and another to track the back side. Normally, you would need to track both of the ImageTargets separately in your application. But if you build a MultiTarget and use addPart() and setPartOffset() to define a spatial relationship between the two targets that matches the spatial relationship of the front and back sides of your real-world cereal box, Vuforia takes care of tracking both of the ImageTargets as one, and returns TrackableResults as though you had just a single Trackable.

Note: It is not possible to modify a MultiTarget while its DataSet is active. See the DataSet class for more information.

Inheritance diagram for MultiTarget:
ObjectTarget Trackable

Public Member Functions

boolean equals (Object obj)
 
TrackableList getParts ()
 Returns the list of Trackables that form the MultiTarget. More...
 
Trackable getPart (String name)
 Get a Trackable part by name. More...
 
int addPart (Trackable trackable)
 Add a Trackable part to this MultiTarget. More...
 
boolean removePart (int idx)
 Remove a Trackable part from this MultiTarget. More...
 
boolean setPartOffset (int idx, Matrix34F offset)
 Set the offset transform of a part, relative to the MultiTarget's origin. More...
 
boolean getPartOffset (int idx, Matrix34F offset)
 Get the offset transform of a part, relative to the MultiTarget's origin. More...
 
- Public Member Functions inherited from ObjectTarget
boolean equals (Object obj)
 
String getUniqueTargetId ()
 Get the persistent system-wide unique id for this target. More...
 
Vec3F getSize ()
 Get the size of this target. More...
 
boolean setSize (Vec3F size)
 Apply a uniform scale to this target that makes it the given size. More...
 
boolean setMotionHint (int hint)
 Set the motion hint to indicate how the target moves in space. More...
 
int getMotionHint ()
 Get the motion hint of this target. More...
 
- Public Member Functions inherited from Trackable
Object getUserData ()
 
boolean setUserData (Object userData)
 
boolean equals (Object obj)
 
Type getType ()
 Get the Type for this instance (typically a subclass of Trackable). More...
 
boolean isOfType (Type type)
 Check whether this instance is of the given Type or any of its subclasses. More...
 
int getId ()
 Get a unique id for this Trackable. More...
 
String getName ()
 Get the name of this Trackable's name. More...
 

Static Public Member Functions

static Type getClassType ()
 Get the Type for class "MultiTarget". More...
 
- Static Public Member Functions inherited from ObjectTarget
static Type getClassType ()
 Get the Type for class "ObjectTarget". More...
 
- Static Public Member Functions inherited from Trackable
static Type getClassType ()
 Get the Type of class 'Trackable'. More...
 

Member Function Documentation

boolean equals ( Object  obj)
static Type getClassType ( )
static

Get the Type for class "MultiTarget".

TrackableList getParts ( )

Returns the list of Trackables that form the MultiTarget.

Trackable getPart ( String  name)

Get a Trackable part by name.

Parameters
nameThe name of the part to get.
Returns
The requested part, or NULL of none of the parts of this MultiTarget have the given name.
int addPart ( Trackable  trackable)

Add a Trackable part to this MultiTarget.

The newly-added part defaults to having zero offset (no translation, no rotation). Use the returned index with setPartOffset() to set an offset transform for the new part.

This method will fail if the given Trackable has already been added to this MultiTarget, or if the DataSet that owns this MultiTarget is currently active.

Parameters
trackableThe part to add. It must exist on the DataSet that owns this MultiTarget.
Returns
The index of the newly added part, or -1 on failure.
boolean removePart ( int  idx)

Remove a Trackable part from this MultiTarget.

Parameters
idxThe index of the part to remove, in the range 0..getNumParts()-1.
Returns
true on success, or false if the requested index is out of range or if the DataSet that owns this MultiTarget is currently active.
boolean setPartOffset ( int  idx,
Matrix34F  offset 
)

Set the offset transform of a part, relative to the MultiTarget's origin.

If a part has zero offset (i.e. no rotation and no translation, represented by an identity rotation matrix with (0,0,0) translation), the pose of the part will be identical to the pose of the MultiTarget.

By default, parts newly-added via addPart() have zero offset.

If multiple parts share the same offset, the parts will be co-located.

Parameters
idxThe index of the part, in the range 0..getNumParts()-1.
offsetThe pose of the part, relative to the MultiTarget's origin.
Returns
true on success, or false if the index is invalid or if the DataSet that owns this MultiTarget is currently active.
boolean getPartOffset ( int  idx,
Matrix34F  offset 
)

Get the offset transform of a part, relative to the MultiTarget's origin.

Parameters
idxThe index of the part, in the range 0..getNumParts()-1.
offsetWill be populated with the pose of the part (relative to the MultiTarget's origin) when this method returns.
Returns
true on success, or false if the requested index is out of range.