Tangible Tracker API

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

Data Structures

TypeName
structTE_Pattern
unionTE_Point
structTE_Tangible

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:
    • [out] patterns The location to store the retrieved patterns.
    • [in, out] count The maximum number of patterns that can be stored at patterns. After calling this function count will store the number of patterns copied.

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:
    • [out] patterns The location to store the patterns read.
    • [in, out] count The maximum number of patterns that can be stored at patterns. After calling this function count will store the number of patterns read.
    • [in] filename The path of the patterns file.
  • 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:
    • [out] tangibles An array where the tangibles should be stored.
    • [in, out] tangible_count The number of elements that can be stored in tangibles. After the function returns the value pointed to by count is the number of currently tracked tangibles.

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 for success 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:
    • touch_id The id of a touch point.
  • 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:
    • down A non zero value indicates that a touch point is down, the value 0 indicates the touchpoint was released.
    • touch_id A unique number identifying the touchpoint.
    • touch_x The x coordinate in pixels of the touchpoint.
    • touch_y The y coordinate in pixels of the touchpoint.

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:
    • [in] patterns The new patterns.
    • count The number of patterns stored at patterns.

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:
    • [in] filename The path of the patterns file.
  • 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:
    • [out] patterns The location to store the patterns read.
    • count The maximum number of patterns that can be stored at patterns. After calling this function count will store the number of patterns read.
    • [in] filename The path of the patterns file.
  • 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: 8/7/2018, 10:26:02 AM