OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

ot::QtAppScreen Class Reference
[OTQt Classes]

Updates of application screen location and mouse cursor coordinates. More...

#include <QtAppScreen.h>

Inheritance diagram for ot::QtAppScreen:

Inheritance graph
[legend]
Collaboration diagram for ot::QtAppScreen:

Collaboration graph
[legend]
List of all members.

Public Types

 MPD_LOC_UNKNOWN = 0x00
 MPD_LOC_INSIDE_SC = 0x01
 MPD_LOC_OUTSIDE_SC = 0x02
enum  MPDLocationState { MPD_LOC_UNKNOWN = 0x00, MPD_LOC_INSIDE_SC = 0x01, MPD_LOC_OUTSIDE_SC = 0x02 }

Public Member Functions

 QtAppScreen (StringTable &table)
 ~QtAppScreen ()
void updateASPD (Event const &as_cs_root)
void updateMPD (Event const &mpd_pos)
MPDLocationState getMPDLocation () const
bool isMPDInsideScreenCuboid () const
QPoint getMPD2DCoords () const
Event getMPD3DPosition () const

Static Public Member Functions

static void convert (CalibInputData const &in, CalibOutputData &out)
static void convert (CalibOutputData const &out, StringTable &table)

Private Member Functions

 QtAppScreen ()
 QtAppScreen (QtAppScreen const &ref)
QtAppScreen operator= (QtAppScreen const &ref)

Private Attributes

CalibOutputData calib_out_
ASData as_data_init_
ASData as_data_
MPData mp_data_

Classes

class  ASCorner
 Container to store the position and associated local coordinate system of a desktop screen corner. More...
class  ASData
 Geometric 3D data specifying spatial location and extent of application desktop screen. More...
class  CalibInputData
 Tracking data collected during the calibration procedure. More...
class  CalibOutputData
 Output data of calibration routine. More...
class  MPData
 Data collection reflecting latest perceived (current) MPD tracking state. More...

Detailed Description

Updates of application screen location and mouse cursor coordinates.

Without accurate information about the location and extent of the desktop screen, the next step, the computation of the mouse cursor coordinates would be impossible. This class provides method updateASPD() in order to update the geometric information about the location of the desktop screen in case the ASPD changed its position and/or orientation.

OTQt-WorldCS2ScreenPlaneTrafo.jpg

Transformation from world CS to target application screen plane

Geometric transformations applied to compute the spatial desktop screen location starting from the world (tracking) coordinate system origin and its correlations with the data gained in the calibration routine from the user-marked screen corner positions (1), (2), (3) and (4). $\phi$ determines the orientation difference of the ASPD to the world coordination system. The positional vector $ w$ directs from the application screen coordinate system origin to the screen root position, per definition the top left corner of the screen. The vectors $ v_1$ and $ v_2$ span the extent of the screen plane. During operation mode the location of the screen plane must be recomputed if the position or orientation of the ASPD changes. If the new orientation angle is $\phi'$, the recomputation is established by rotating the position vectors $ w$ and $ v_1, v_2$ about the difference angle $\phi' - \phi$. These operations match vector transformations from one coordinate system (represented by $\phi$) to another coordinate system (represented by $\phi'$).

In order to compute 2D desktop mouse cursor coordinates from tracking data (the MPD) this class provides the updateMPD() method. OTQt defines a certain 3D volume located in front of the target desktop screen as mouse event sensible region. This region is called screen cuboid} (SC).

OTQt-ScreenCuboidWithPen.jpg

Screen Cuboid with Mouse Position Device (MPD) displayed as pen

The screen cuboid is spanned by the screen width $v_1$, screen height $v_2$ and screen depth $v_3$. $v_3$ is computed as dot product of $v_1 \times v_2$. The volume marks the mouse event sensitive region. That means: only while the MPD (displayed here as pen) actually intersects the screen coboid volume, the OTQt module will generate and post mouse events. In that case, the MPD position is converted into corresponding desktop coordinates and OTQt will post a MouseMove event to the Qt applicaton, whereupon the correct mouse cursor position is set.

Provides several methods to query the current MPD status: spatial 3D position with getMPD3DPosition(), desktop mouse coordinates with getMPD2DCoords(), and the location of the MPD relative to the screen cuboid can be retrieved with getMPDLocation().

Definition at line 141 of file QtAppScreen.h.


Member Enumeration Documentation

Location states of the MPD relative to the SC.

Enumerator:
MPD_LOC_UNKNOWN  MPD location unknown.
MPD_LOC_INSIDE_SC  MPD resides inside SC.
MPD_LOC_OUTSIDE_SC  MPD resides outside SC.

Definition at line 202 of file QtAppScreen.h.


Constructor & Destructor Documentation

ot::QtAppScreen::QtAppScreen ( StringTable table  ) 

ot::QtAppScreen::~QtAppScreen (  )  [inline]

Definition at line 294 of file QtAppScreen.h.

ot::QtAppScreen::QtAppScreen (  )  [private]

ot::QtAppScreen::QtAppScreen ( QtAppScreen const &  ref  )  [private]


Member Function Documentation

void ot::QtAppScreen::convert ( CalibOutputData const &  out,
StringTable table 
) [static]

Wraps the geometric data elements from in the specified container into XML attribute strings.

Stores each attribute string in the provided key/value map.

Parameters:
out final geometric data from the calibration routine
table XML attribute key/value map containing the geometric values

Definition at line 106 of file QtAppScreen.cxx.

References ot::QtAppScreen::CalibOutputData::as_cs_orient, ot::QtAppScreen::CalibOutputData::as_cs_root_to_screen_root, ot::QtAppScreen::CalibOutputData::as_height_vec, ot::QtAppScreen::CalibOutputData::as_width_vec, ot::copyV2A(), and ot::StringTable::put().

void ot::QtAppScreen::convert ( CalibInputData const &  in,
CalibOutputData out 
) [static]

Converts raw tracking data acquired during the calibration routine into final geometric data that can be stored in as XML attributes in an OpenTracker configuration file.

The given input data collection contains the position of the four application desktop screen corners. The method derives the geometric relation (angle and distance) between the local application screen coordinate system (as defined by the APSD) and the screen plane (represented by screen root position) as well as the screen plane extent (width/height spanning vectors computed from the four screen corners).

Passes the computed data to the provided output object.

Parameters:
in tracking data collected during calibration routine
out geometric data specifying the application screen plane location and extent

Definition at line 118 of file QtAppScreen.cxx.

References ot::QtAppScreen::CalibOutputData::as_cs_orient, ot::QtAppScreen::CalibInputData::as_cs_root, ot::QtAppScreen::CalibOutputData::as_cs_root_to_screen_root, ot::QtAppScreen::CalibOutputData::as_height_vec, ot::QtAppScreen::CalibOutputData::as_width_vec, ot::QtAppScreen::CalibInputData::bottom_left, ot::QtAppScreen::CalibInputData::bottom_right, ot::copyV2A(), ot::QtAppScreen::ASCorner::corner, ot::Event::getOrientation(), ot::Event::getPosition(), ot::QtAppScreen::ASCorner::local_cs_root, OTQT_DEBUG(), ot::QtAppScreen::CalibInputData::top_left, ot::QtAppScreen::CalibInputData::top_right, and ot::OTQtMath::transformVectorFromCSToCS().

Referenced by ot::OTQtMEMCalibProc::exec().

QPoint ot::QtAppScreen::getMPD2DCoords (  )  const [inline]

Returns the desktop mouse cursor (x,y) coordinate pair derived from latest perceived MPD position.

Returns:
desktop mouse coordinates

Definition at line 339 of file QtAppScreen.h.

Referenced by ot::QtMouseEventModule::pullEvent().

Event ot::QtAppScreen::getMPD3DPosition (  )  const [inline]

Returns the latest perceived spatial 3D MPD position.

Returns:
MPD 3D position

Definition at line 344 of file QtAppScreen.h.

QtAppScreen::MPDLocationState ot::QtAppScreen::getMPDLocation (  )  const

Returns the current location of the MPD relative to the screen cuboid.

Returns:
MPD location relative SC
See also:
MPDLocationState enumeration for possible return values

Definition at line 349 of file QtAppScreen.cxx.

References mp_data_, MPD_LOC_INSIDE_SC, ot::QtAppScreen::MPData::mpd_loc_inside_screen_cuboid, MPD_LOC_OUTSIDE_SC, and MPD_LOC_UNKNOWN.

bool ot::QtAppScreen::isMPDInsideScreenCuboid (  )  const [inline]

Return true if MPD resides inside the screen cuboid.

Returns:
true if inside SC, otherwise false

Definition at line 333 of file QtAppScreen.h.

Referenced by ot::QtMouseEventModule::pullEvent().

QtAppScreen ot::QtAppScreen::operator= ( QtAppScreen const &  ref  )  [private]

void ot::QtAppScreen::updateASPD ( Event const &  as_cs_root  ) 

Recalculates the application screen spatial 3D location based on the specified ASPD position/orientation which defines an updated application screen coordinate system.

Transforms the screen root position and the screen plane itself from the prior to the new local coordinate system.

Parameters:
as_cs_root ASPD position/orientation (new local application screen coordinate system)

Definition at line 217 of file QtAppScreen.cxx.

References ot::QtAppScreen::ASData::as_cs_root, as_data_, as_data_init_, ot::QtAppScreen::ASData::as_height_vec, ot::QtAppScreen::ASData::as_screen_root, ot::QtAppScreen::ASData::as_width_vec, ot::OTQtMath::rotateVectorFromCSToCS(), and ot::OTQtMath::transformVectorFromCSToCS().

Referenced by ot::QtMouseEventModule::pullEvent().

void ot::QtAppScreen::updateMPD ( Event const &  mpd_pos  ) 

Recomputes the 2D desktop mouse cursor position on based on specified MPD 3D position.

Stores derived MPD state internally.

Intersects the given MPD position with the screen cuboid. Returns immediately if the MPD resides outside the screen cuboid. Otherwise computes new desktop mouse cursor coordinates.

Parameters:
mpd_pos MPD position

Definition at line 243 of file QtAppScreen.cxx.

References as_data_, ot::QtAppScreen::ASData::as_depth_scalar_back, ot::QtAppScreen::ASData::as_depth_scalar_front, ot::QtAppScreen::ASData::as_height_vec, ot::QtAppScreen::ASData::as_screen_root, ot::QtAppScreen::ASData::as_width_vec, ot::copyV2A(), ot::OTQtMath::crossProductR3(), QApplication::desktop(), ot::QtAppScreen::MPData::desktop_coords, ot::Event::getPosition(), QRect::height(), ot::OTQtMath::isWithinPlaneBorders(), mp_data_, ot::QtAppScreen::MPData::mpd_loc_inside_screen_cuboid, OTQT_DEBUG(), ot::QtAppScreen::MPData::position, QPoint::setX(), QPoint::setY(), and QRect::width().

Referenced by ot::QtMouseEventModule::pullEvent(), and QtAppScreen().


Member Data Documentation

current application screen coordinate system and screen plane location

Definition at line 352 of file QtAppScreen.h.

Referenced by QtAppScreen(), updateASPD(), and updateMPD().

initial application screen coordinate system and screen plane location (remains constant after init)

Definition at line 350 of file QtAppScreen.h.

Referenced by QtAppScreen(), and updateASPD().

calibration geometrical data from the XML configuration file

Definition at line 344 of file QtAppScreen.h.

Referenced by QtAppScreen().

MPD position, state (concerning location relative to SC) and mouse cursor coordinates.

Definition at line 354 of file QtAppScreen.h.

Referenced by getMPDLocation(), and updateMPD().


The documentation for this class was generated from the following files:

copyright (c) 2006 Graz University of Technology