Tangible Tracker API

tangible_tracker.h contains the primary API of the tangible engine.

Data Structures

TYPE

Name

struct
union
struct

Macros


 #define DLLAPI __declspec( dllimport )
 

Typedefs


 typedef __int32 touch_id_t
 

Functions

TE_Deinit

Release all resources used by Tangible Engine. After calling this function, TE_Init must be called before any other Tangible Engine functions.

 TE_Deinit()
 
  • Type: DLLAPI int
  • Returns: A non-zero value for success and 0 otherwise.

Javascript


 function deinit()
 
  • Returns: true for success and false otherwise.

TE_GetPatterns

Get the set of working patterns. This function retrieves the working set of patterns from Tangible Engine.

 TE_GetPatterns (TE_Pattern *patterns, int *count)
 
  • Type: DLLAPI void
  • Parameters:
Note
The full pattern API is not currently available through C# or Electron.‍

TE_GetPatternsFromFile

Read a patterns file from disk directly. This function reads and parses a patterns file and returns the patterns directly to the caller.

 TE_GetPatternsFromFile (TE_Pattern *patterns, int *count, char *filename)
 
  • Type: DLLAPI int
  • Parameters:
  • Returns: A non-zero value for success and 0 otherwise.
Note
The full pattern API is not currently available through C# or Electron.

TE_GetTangibles

Retrieve all currently tracked tangibles. The returned tangibles have coordinates in the same coordinate system as the touch events passed through TE_ProcessTouchEvent.

 TE_GetTangibles (TE_Tangible *tangibles, int *tangible_count)
 
  • Type: DLLAPI void
  • Parameters:

Javascript


 function getTangibles()
 
  • Returns: An array of tangible objects. The propreties of a tangible object are the same as the members of TE_Tangible.

TE_Init

Initializes the Tangible Engine. This function must be called before any other Tangible Engine functions.

 TE_Init()
 
  • Type: DLLAPI int
  • Returns: A non-zero value and 0 otherwise.

Javascript


 function init()
 
  • Returns: true for success and false otherwise.

TE_IsTouchPointOwned

Check if a touch point is owned by a currently tracked tangible.

 TE_IsTouchPointOwned (touch_id_t touch_id)
 
  • Type: DLLAPI int
  • Parameters:
  • Returns: A non-zero value if the touch point is owned by a tangible and 0 otherwise.

Javascript


 function isTouchPointOwned(touch_id)
 
  • Returns: true if the touch point is owned and false otherwise..

TE_ProcessTouchEvent

Forward touch events to the Tangible Engine. For example, if you are receiving touch events through window's WM_POINTER* API, this function should be called on WM_POINTERENTER, WM_POINTERLEAVE, and WM_POINTERUPDATE with down taking values of 1, 0, and 0 respectively. The coordinate system used by the tangible engine and tangible configuration tool have the x axis pointing to the right and the y axis pointing down. All touch events passed to the Tangible Engine must be specified in a coordinate system following this convention.

 TE_ProcessTouchEvent (int down, touch_id_t touch_id, float touch_x, float touch_y)
 
  • Type: DLLAPI void
  • Parameters:

Javascript


 function processTouchEvent(down, touch_id, touch_x, touch_y)
 
  • Returns: true  for success and false otherwise.

TE_SetPatterns

Set working patterns manually. This function replaces the internal set of patterns used by the Tangible Engine. As a side effect, all currently tracked tangibles are removed.

 TE_SetPatterns (const TE_Pattern *patterns, int count)
 
  • Type: DLLAPI void
  • Parameters:
Note
The full pattern API is not currently available through C# or Electron.

TE_SetPatternsFromFile

Load patterns file from disk using Tangible Engine. This function replaces the current set of patterns with the patterns stored in the specified file pattern file. Pattern files can be created with the Tangible Engine configuration utility located at tangible_trainer/TangibleApp.exe

 TE_SetPatternsFromFile (char *filename)
 
  • Type: DLLAPI int
  • Parameters:
  • Returns: A non-zero value for success and 0 otherwise.

Javascript


 function setPatternsFromFile(filename)
 
  • Returns: true  for success and false otherwise.

TE_WritePatternsToFile

Write patterns directly to a file. Writes patterns specified by the caller to a file.

 TE_WritePatternsToFile (TE_Pattern *patterns, int count, char *filename)
 
  • Type: DLLAPI int
  • Parameters:
  • Returns: A non-zero value for success and 0 otherwise.
Note
The full pattern API is not currently available through C# or Electron.

Source Reference

Tangible.tracker.h


 #ifndef TANGIBLE_TRACKER_H
 #define TANGIBLE_TRACKER_H

 typedef __int32 touch_id_t;

 #pragma pack(push, 1)

 typedef struct
 {
  int id;
  float x;
  float y;
  float angle;
  char name[128];
 } TE_Tangible;

 typedef union {
  struct { float x, y; };
  float e[2];
 } TE_Point;

 typedef struct {
  TE_Point points[8];
  int num_points;
  char name[128];
 } TE_Pattern;

 #pragma pack(pop)


 #ifdef _WINDLL
 #define DLLAPI __declspec( dllexport )
 #else
 #define DLLAPI __declspec( dllimport )
 #endif

 #ifdef __cplusplus
 extern "C" {
 #endif

 DLLAPI void TE_SetPatterns(const TE_Pattern *patterns, int count);

 DLLAPI int TE_SetPatternsFromFile(char *filename);



 DLLAPI void TE_GetPatterns(TE_Pattern *patterns, int *count);

 DLLAPI int TE_GetPatternsFromFile(TE_Pattern *patterns, int *count, char *filename);

 DLLAPI int TE_WritePatternsToFile(TE_Pattern *patterns, int count, char *filename);


 DLLAPI int TE_Init();

 DLLAPI int TE_Deinit();

 DLLAPI void TE_ProcessTouchEvent(int down, touch_id_t touch_id, float touch_x, float touch_y);


 DLLAPI void TE_GetTangibles(TE_Tangible *tangibles, int *tangible_count);

 DLLAPI int TE_IsTouchPointOwned(touch_id_t touch_id);


 #ifdef __cplusplus
 }
 #endif
 #endif
 
Last Updated: 9/8/2020