Skip to main content



ultramouse3d_api.h

// Karl Gluck
// David DeTomaso
// Written April 2009
#ifndef __ULTRAMOUSE3D_API__H__
#define __ULTRAMOUSE3D_API__H__

#include <windows.h>


// This structure exposes all of the stuff inside Ultramouse3D.  You want
// to read data from the 'position' variable.
struct Ultramouse3D {

   struct Vector3D {
     double x, y, z;
   };

   // Whether or not the button on the mouse is pushed
   bool button;

   // Help further smooth the output
   Vector3D position;
   Vector3D target_position;

   // Used to read data from the serial port
   HANDLE hIDComDev;

   // This is used to perform a median filtering algorithm on the incoming
   // receiver delay times.  This nonlinear filter removes outliers and
   // prevents spiky jumps in the data that can't be removed with a linear
   // filtering algorithm such as averaging.
   static const int NUMBER_OF_RECEIVERS = 3;
   static const int HISTORY_LENGTH = 20;
   unsigned short receiver_delay_history[NUMBER_OF_RECEIVERS][HISTORY_LENGTH];
};



// Initializes the mouse to read data from the given serial port.
BOOL UM3DAPI_Create(UINT serial_port, Ultramouse3D* mouse);

// Advances the internal state with the latest data from the device
VOID UM3DAPI_Update(Ultramouse3D* mouse);

// Deallocates data used by the mouse structure
VOID UM3DAPI_Destroy(Ultramouse3D* mouse);




#endif


More Information

Declaration file for the UltraMouse 3D API, which lets users easily add the mouse to any Win32/C++ application