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.
Public Member Functions | |
virtual List< Trackable > | getParts ()=0 |
Returns the list of Trackables that form the MultiTarget. More... | |
virtual List< const Trackable > | getParts () const =0 |
Provides read-only access to the list of Trackables that form the MultiTarget. More... | |
virtual Trackable * | getPart (const char *name)=0 |
Get a Trackable part by name. More... | |
virtual const Trackable * | getPart (const char *name) const =0 |
Get a Trackable part by name. More... | |
virtual int | addPart (Trackable *trackable)=0 |
Add a Trackable part to this MultiTarget. More... | |
virtual bool | removePart (int idx)=0 |
Remove a Trackable part from this MultiTarget. More... | |
virtual bool | setPartOffset (int idx, const Matrix34F &offset)=0 |
Set the offset transform of a part, relative to the MultiTarget's origin. More... | |
virtual bool | getPartOffset (int idx, Matrix34F &offset) const =0 |
Get the offset transform of a part, relative to the MultiTarget's origin. More... | |
Public Member Functions inherited from ObjectTarget | |
virtual const char * | getUniqueTargetId () const =0 |
Get the persistent system-wide unique id for this target. More... | |
virtual Vec3F | getSize () const =0 |
Get the size of this target. More... | |
virtual bool | setSize (const Vec3F &size)=0 |
Apply a uniform scale to this target that makes it the given size. More... | |
virtual bool | setMotionHint (MOTION_HINT hint)=0 |
Set the motion hint to indicate how the target moves in space. More... | |
virtual MOTION_HINT | getMotionHint () const =0 |
Get the motion hint of this target. More... | |
Public Member Functions inherited from Trackable | |
virtual Type | getType () const =0 |
Get the Type for this instance (typically a subclass of Trackable). More... | |
virtual bool | isOfType (Type type) const =0 |
Check whether this instance is of the given Type or any of its subclasses. More... | |
virtual int | getId () const =0 |
Get a unique id for this Trackable. More... | |
virtual const char * | getName () const =0 |
Get the name of this Trackable's name. More... | |
virtual bool | setUserData (void *userData)=0 |
Set user data for this Trackable. More... | |
virtual void * | getUserData () const =0 |
Get the user data that was previously set using setUserData(). More... | |
virtual | ~Trackable () |
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... | |
Additional Inherited Members | |
Public Types inherited from ObjectTarget | |
enum | MOTION_HINT { STATIC, ADAPTIVE } |
Target property that indicates how the target moves in space. More... | |
Returns the list of Trackables that form the MultiTarget.
Provides read-only access to the list of Trackables that form the MultiTarget.
|
pure virtual |
Get a Trackable part by name.
name | The name of the part to get. |
|
pure virtual |
Get a Trackable part by name.
name | The name of the part to get. |
|
pure virtual |
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.
trackable | The part to add. It must exist on the DataSet that owns this MultiTarget. |
|
pure virtual |
Remove a Trackable part from this MultiTarget.
idx | The index of the part to remove, in the range 0..getNumParts()-1. |
|
pure virtual |
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.
idx | The index of the part, in the range 0..getNumParts()-1. |
offset | The pose of the part, relative to the MultiTarget's origin. |
|
pure virtual |
Get the offset transform of a part, relative to the MultiTarget's origin.
idx | The index of the part, in the range 0..getNumParts()-1. |
offset | Will be populated with the pose of the part (relative to the MultiTarget's origin) when this method returns. |