welcome to linkAR technical documentation

previous

Tracking Results


In order to accept traking results, 3 callbacks are used. One callback for recieving tracked object corners, another to receive the projection matrix of tracked object and a last one to receive touch events.

@protocol trackerProtocol <NSObject>
 
@optional
 
/**
 *  Optional callback: Called when an Image is tracked to new corners.
 *  @param x: point in the polygon representing the images position
 *  @param y: point in the polygon representing the images position
 *  @param z: point in the polygon representing the images position
 *  @param w: point in the polygon representing the images position
 */
-(void)imageCornersChanged:(CGPoint)x :(CGPoint)y :(CGPoint)z :(CGPoint)w;
 
/**
 *  Optional callback: Called when an Image is tracked.
 *  @param matrix: An array of NSNumbers. Size 16.
 */
-(void)projectionMatrixChanged:(NSArray*)matrix;
 
/**
 *  Optional callback: Called when an User touches the tracked image.
 *  @param uId: id of the touched image.
 */
-(void)trackedImageTouched:(NSNumber*)uId;
 
@end

4.1.- Implementation of image trakcing Callback

This callback is used to receive corners changes of tracked object. It receives an array size 8 of coordinates x,y of the phone screen.

-(void)imageCornersChanged:(CGPoint)x :(CGPoint)y :(CGPoint)z :(CGPoint)w
{
   //implement your code that uses the points x,y,z,w
   NSLog(@"X(%f,%f)\nY(%f,%f)\nZ(%f,%f)\nW(%f,%f)",x.x,x.y,y.x,y.y,z.x,z.y,w.x,w.y);
}

4.2.- Implementation of projection matrix tracking Callback

This function is not implemented yet.


This callback is used to recieve projection matrix changes of traked object , it recieves 4*4 matrix that consists of 16 floats.

-(void)projectionMatrixChanged:(NSArray*)matrix
{
   NSLog(@"%@",matrix); //best used to rotate your 3D model
}

4.3.- Implementation of tracked image touched Callback


This callback is used to receive touch events over the tracked image:

-(void)trackedImageTouched:(NSNumber*)uId;
{
   NSLog(@"Image with Id=%d Touched",[uId intValue]); 
}


previous